LookinDashboardBlueprint.m 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196
  1. #ifdef SHOULD_COMPILE_LOOKIN_SERVER
  2. //
  3. // LookinDashboardBlueprint.m
  4. // Lookin
  5. //
  6. // Created by Li Kai on 2019/6/5.
  7. // https://lookin.work
  8. //
  9. #import "LookinDashboardBlueprint.h"
  10. @implementation LookinDashboardBlueprint
  11. + (NSArray<LookinAttrGroupIdentifier> *)groupIDs {
  12. static NSArray<LookinAttrGroupIdentifier> *array;
  13. static dispatch_once_t onceToken;
  14. dispatch_once(&onceToken,^{
  15. array = @[
  16. LookinAttrGroup_Class,
  17. LookinAttrGroup_Relation,
  18. LookinAttrGroup_Layout,
  19. LookinAttrGroup_AutoLayout,
  20. LookinAttrGroup_ViewLayer,
  21. LookinAttrGroup_UIStackView,
  22. LookinAttrGroup_UIVisualEffectView,
  23. LookinAttrGroup_UIImageView,
  24. LookinAttrGroup_UILabel,
  25. LookinAttrGroup_UIControl,
  26. LookinAttrGroup_UIButton,
  27. LookinAttrGroup_UIScrollView,
  28. LookinAttrGroup_UITableView,
  29. LookinAttrGroup_UITextView,
  30. LookinAttrGroup_UITextField
  31. ];
  32. });
  33. return array;
  34. }
  35. + (NSArray<LookinAttrSectionIdentifier> *)sectionIDsForGroupID:(LookinAttrGroupIdentifier)groupID {
  36. static NSDictionary<LookinAttrGroupIdentifier, NSArray<LookinAttrSectionIdentifier> *> *dict;
  37. static dispatch_once_t onceToken;
  38. dispatch_once(&onceToken,^{
  39. dict = @{
  40. LookinAttrGroup_Class: @[LookinAttrSec_Class_Class],
  41. LookinAttrGroup_Relation: @[LookinAttrSec_Relation_Relation],
  42. LookinAttrGroup_Layout: @[LookinAttrSec_Layout_Frame,
  43. LookinAttrSec_Layout_Bounds,
  44. LookinAttrSec_Layout_SafeArea,
  45. LookinAttrSec_Layout_Position,
  46. LookinAttrSec_Layout_AnchorPoint],
  47. LookinAttrGroup_AutoLayout: @[LookinAttrSec_AutoLayout_Constraints,
  48. LookinAttrSec_AutoLayout_IntrinsicSize,
  49. LookinAttrSec_AutoLayout_Hugging,
  50. LookinAttrSec_AutoLayout_Resistance],
  51. LookinAttrGroup_ViewLayer: @[
  52. LookinAttrSec_ViewLayer_Visibility,
  53. LookinAttrSec_ViewLayer_InterationAndMasks,
  54. LookinAttrSec_ViewLayer_BgColor,
  55. LookinAttrSec_ViewLayer_Border,
  56. LookinAttrSec_ViewLayer_Corner,
  57. LookinAttrSec_ViewLayer_Shadow,
  58. LookinAttrSec_ViewLayer_ContentMode,
  59. LookinAttrSec_ViewLayer_TintColor,
  60. LookinAttrSec_ViewLayer_Tag
  61. ],
  62. LookinAttrGroup_UIStackView: @[
  63. LookinAttrSec_UIStackView_Axis,
  64. LookinAttrSec_UIStackView_Distribution,
  65. LookinAttrSec_UIStackView_Alignment,
  66. LookinAttrSec_UIStackView_Spacing
  67. ],
  68. LookinAttrGroup_UIVisualEffectView: @[
  69. LookinAttrSec_UIVisualEffectView_Style,
  70. LookinAttrSec_UIVisualEffectView_QMUIForegroundColor
  71. ],
  72. LookinAttrGroup_UIImageView: @[LookinAttrSec_UIImageView_Name,
  73. LookinAttrSec_UIImageView_Open],
  74. LookinAttrGroup_UILabel: @[
  75. LookinAttrSec_UILabel_Text,
  76. LookinAttrSec_UILabel_Font,
  77. LookinAttrSec_UILabel_NumberOfLines,
  78. LookinAttrSec_UILabel_TextColor,
  79. LookinAttrSec_UILabel_BreakMode,
  80. LookinAttrSec_UILabel_Alignment,
  81. LookinAttrSec_UILabel_CanAdjustFont],
  82. LookinAttrGroup_UIControl: @[LookinAttrSec_UIControl_EnabledSelected,
  83. LookinAttrSec_UIControl_QMUIOutsideEdge,
  84. LookinAttrSec_UIControl_VerAlignment,
  85. LookinAttrSec_UIControl_HorAlignment],
  86. LookinAttrGroup_UIButton: @[LookinAttrSec_UIButton_ContentInsets,
  87. LookinAttrSec_UIButton_TitleInsets,
  88. LookinAttrSec_UIButton_ImageInsets],
  89. LookinAttrGroup_UIScrollView: @[LookinAttrSec_UIScrollView_ContentInset,
  90. LookinAttrSec_UIScrollView_AdjustedInset,
  91. LookinAttrSec_UIScrollView_QMUIInitialInset,
  92. LookinAttrSec_UIScrollView_IndicatorInset,
  93. LookinAttrSec_UIScrollView_Offset,
  94. LookinAttrSec_UIScrollView_ContentSize,
  95. LookinAttrSec_UIScrollView_Behavior,
  96. LookinAttrSec_UIScrollView_ShowsIndicator,
  97. LookinAttrSec_UIScrollView_Bounce,
  98. LookinAttrSec_UIScrollView_ScrollPaging,
  99. LookinAttrSec_UIScrollView_ContentTouches,
  100. LookinAttrSec_UIScrollView_Zoom],
  101. LookinAttrGroup_UITableView: @[LookinAttrSec_UITableView_Style,
  102. LookinAttrSec_UITableView_SectionsNumber,
  103. LookinAttrSec_UITableView_RowsNumber,
  104. LookinAttrSec_UITableView_SeparatorStyle,
  105. LookinAttrSec_UITableView_SeparatorColor,
  106. LookinAttrSec_UITableView_SeparatorInset],
  107. LookinAttrGroup_UITextView: @[LookinAttrSec_UITextView_Basic,
  108. LookinAttrSec_UITextView_Text,
  109. LookinAttrSec_UITextView_Font,
  110. LookinAttrSec_UITextView_TextColor,
  111. LookinAttrSec_UITextView_Alignment,
  112. LookinAttrSec_UITextView_ContainerInset],
  113. LookinAttrGroup_UITextField: @[LookinAttrSec_UITextField_Text,
  114. LookinAttrSec_UITextField_Placeholder,
  115. LookinAttrSec_UITextField_Font,
  116. LookinAttrSec_UITextField_TextColor,
  117. LookinAttrSec_UITextField_Alignment,
  118. LookinAttrSec_UITextField_Clears,
  119. LookinAttrSec_UITextField_CanAdjustFont,
  120. LookinAttrSec_UITextField_ClearButtonMode],
  121. };
  122. });
  123. return dict[groupID];
  124. }
  125. + (NSArray<LookinAttrIdentifier> *)attrIDsForSectionID:(LookinAttrSectionIdentifier)sectionID {
  126. static NSDictionary<LookinAttrSectionIdentifier, NSArray<LookinAttrIdentifier> *> *dict;
  127. static dispatch_once_t onceToken;
  128. dispatch_once(&onceToken,^{
  129. dict = @{
  130. LookinAttrSec_Class_Class: @[LookinAttr_Class_Class_Class],
  131. LookinAttrSec_Relation_Relation: @[LookinAttr_Relation_Relation_Relation],
  132. LookinAttrSec_Layout_Frame: @[LookinAttr_Layout_Frame_Frame],
  133. LookinAttrSec_Layout_Bounds: @[LookinAttr_Layout_Bounds_Bounds],
  134. LookinAttrSec_Layout_SafeArea: @[LookinAttr_Layout_SafeArea_SafeArea],
  135. LookinAttrSec_Layout_Position: @[LookinAttr_Layout_Position_Position],
  136. LookinAttrSec_Layout_AnchorPoint: @[LookinAttr_Layout_AnchorPoint_AnchorPoint],
  137. LookinAttrSec_AutoLayout_Hugging: @[LookinAttr_AutoLayout_Hugging_Hor,
  138. LookinAttr_AutoLayout_Hugging_Ver],
  139. LookinAttrSec_AutoLayout_Resistance: @[LookinAttr_AutoLayout_Resistance_Hor,
  140. LookinAttr_AutoLayout_Resistance_Ver],
  141. LookinAttrSec_AutoLayout_Constraints: @[LookinAttr_AutoLayout_Constraints_Constraints],
  142. LookinAttrSec_AutoLayout_IntrinsicSize: @[LookinAttr_AutoLayout_IntrinsicSize_Size],
  143. LookinAttrSec_ViewLayer_Visibility: @[LookinAttr_ViewLayer_Visibility_Hidden,
  144. LookinAttr_ViewLayer_Visibility_Opacity],
  145. LookinAttrSec_ViewLayer_InterationAndMasks: @[LookinAttr_ViewLayer_InterationAndMasks_Interaction,
  146. LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds],
  147. LookinAttrSec_ViewLayer_Corner: @[LookinAttr_ViewLayer_Corner_Radius],
  148. LookinAttrSec_ViewLayer_BgColor: @[LookinAttr_ViewLayer_BgColor_BgColor],
  149. LookinAttrSec_ViewLayer_Border: @[LookinAttr_ViewLayer_Border_Color,
  150. LookinAttr_ViewLayer_Border_Width],
  151. LookinAttrSec_ViewLayer_Shadow: @[LookinAttr_ViewLayer_Shadow_Color,
  152. LookinAttr_ViewLayer_Shadow_Opacity,
  153. LookinAttr_ViewLayer_Shadow_Radius,
  154. LookinAttr_ViewLayer_Shadow_OffsetW,
  155. LookinAttr_ViewLayer_Shadow_OffsetH],
  156. LookinAttrSec_ViewLayer_ContentMode: @[LookinAttr_ViewLayer_ContentMode_Mode],
  157. LookinAttrSec_ViewLayer_TintColor: @[LookinAttr_ViewLayer_TintColor_Color,
  158. LookinAttr_ViewLayer_TintColor_Mode],
  159. LookinAttrSec_ViewLayer_Tag: @[LookinAttr_ViewLayer_Tag_Tag],
  160. LookinAttrSec_UIStackView_Axis: @[LookinAttr_UIStackView_Axis_Axis],
  161. LookinAttrSec_UIStackView_Distribution: @[LookinAttr_UIStackView_Distribution_Distribution],
  162. LookinAttrSec_UIStackView_Alignment: @[LookinAttr_UIStackView_Alignment_Alignment],
  163. LookinAttrSec_UIStackView_Spacing: @[LookinAttr_UIStackView_Spacing_Spacing],
  164. LookinAttrSec_UIVisualEffectView_Style: @[LookinAttr_UIVisualEffectView_Style_Style],
  165. LookinAttrSec_UIVisualEffectView_QMUIForegroundColor: @[LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color],
  166. LookinAttrSec_UIImageView_Name: @[LookinAttr_UIImageView_Name_Name],
  167. LookinAttrSec_UIImageView_Open: @[LookinAttr_UIImageView_Open_Open],
  168. LookinAttrSec_UILabel_Font: @[LookinAttr_UILabel_Font_Name,
  169. LookinAttr_UILabel_Font_Size],
  170. LookinAttrSec_UILabel_NumberOfLines: @[LookinAttr_UILabel_NumberOfLines_NumberOfLines],
  171. LookinAttrSec_UILabel_Text: @[LookinAttr_UILabel_Text_Text],
  172. LookinAttrSec_UILabel_TextColor: @[LookinAttr_UILabel_TextColor_Color],
  173. LookinAttrSec_UILabel_BreakMode: @[LookinAttr_UILabel_BreakMode_Mode],
  174. LookinAttrSec_UILabel_Alignment: @[LookinAttr_UILabel_Alignment_Alignment],
  175. LookinAttrSec_UILabel_CanAdjustFont: @[LookinAttr_UILabel_CanAdjustFont_CanAdjustFont],
  176. LookinAttrSec_UIControl_EnabledSelected: @[LookinAttr_UIControl_EnabledSelected_Enabled,
  177. LookinAttr_UIControl_EnabledSelected_Selected],
  178. LookinAttrSec_UIControl_QMUIOutsideEdge: @[LookinAttr_UIControl_QMUIOutsideEdge_Edge],
  179. LookinAttrSec_UIControl_VerAlignment: @[LookinAttr_UIControl_VerAlignment_Alignment],
  180. LookinAttrSec_UIControl_HorAlignment: @[LookinAttr_UIControl_HorAlignment_Alignment],
  181. LookinAttrSec_UIButton_ContentInsets: @[LookinAttr_UIButton_ContentInsets_Insets],
  182. LookinAttrSec_UIButton_TitleInsets: @[LookinAttr_UIButton_TitleInsets_Insets],
  183. LookinAttrSec_UIButton_ImageInsets: @[LookinAttr_UIButton_ImageInsets_Insets],
  184. LookinAttrSec_UIScrollView_ContentInset: @[LookinAttr_UIScrollView_ContentInset_Inset],
  185. LookinAttrSec_UIScrollView_AdjustedInset: @[LookinAttr_UIScrollView_AdjustedInset_Inset],
  186. LookinAttrSec_UIScrollView_QMUIInitialInset: @[LookinAttr_UIScrollView_QMUIInitialInset_Inset],
  187. LookinAttrSec_UIScrollView_IndicatorInset: @[LookinAttr_UIScrollView_IndicatorInset_Inset],
  188. LookinAttrSec_UIScrollView_Offset: @[LookinAttr_UIScrollView_Offset_Offset],
  189. LookinAttrSec_UIScrollView_ContentSize: @[LookinAttr_UIScrollView_ContentSize_Size],
  190. LookinAttrSec_UIScrollView_Behavior: @[LookinAttr_UIScrollView_Behavior_Behavior],
  191. LookinAttrSec_UIScrollView_ShowsIndicator: @[LookinAttr_UIScrollView_ShowsIndicator_Hor,
  192. LookinAttr_UIScrollView_ShowsIndicator_Ver],
  193. LookinAttrSec_UIScrollView_Bounce: @[LookinAttr_UIScrollView_Bounce_Hor,
  194. LookinAttr_UIScrollView_Bounce_Ver],
  195. LookinAttrSec_UIScrollView_ScrollPaging: @[LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled,
  196. LookinAttr_UIScrollView_ScrollPaging_PagingEnabled],
  197. LookinAttrSec_UIScrollView_ContentTouches: @[LookinAttr_UIScrollView_ContentTouches_Delay,
  198. LookinAttr_UIScrollView_ContentTouches_CanCancel],
  199. LookinAttrSec_UIScrollView_Zoom: @[LookinAttr_UIScrollView_Zoom_Bounce,
  200. LookinAttr_UIScrollView_Zoom_Scale,
  201. LookinAttr_UIScrollView_Zoom_MinScale,
  202. LookinAttr_UIScrollView_Zoom_MaxScale],
  203. LookinAttrSec_UITableView_Style: @[LookinAttr_UITableView_Style_Style],
  204. LookinAttrSec_UITableView_SectionsNumber: @[LookinAttr_UITableView_SectionsNumber_Number],
  205. LookinAttrSec_UITableView_RowsNumber: @[LookinAttr_UITableView_RowsNumber_Number],
  206. LookinAttrSec_UITableView_SeparatorInset: @[LookinAttr_UITableView_SeparatorInset_Inset],
  207. LookinAttrSec_UITableView_SeparatorColor: @[LookinAttr_UITableView_SeparatorColor_Color],
  208. LookinAttrSec_UITableView_SeparatorStyle: @[LookinAttr_UITableView_SeparatorStyle_Style],
  209. LookinAttrSec_UITextView_Basic: @[LookinAttr_UITextView_Basic_Editable,
  210. LookinAttr_UITextView_Basic_Selectable],
  211. LookinAttrSec_UITextView_Text: @[LookinAttr_UITextView_Text_Text],
  212. LookinAttrSec_UITextView_Font: @[LookinAttr_UITextView_Font_Name,
  213. LookinAttr_UITextView_Font_Size],
  214. LookinAttrSec_UITextView_TextColor: @[LookinAttr_UITextView_TextColor_Color],
  215. LookinAttrSec_UITextView_Alignment: @[LookinAttr_UITextView_Alignment_Alignment],
  216. LookinAttrSec_UITextView_ContainerInset: @[LookinAttr_UITextView_ContainerInset_Inset],
  217. LookinAttrSec_UITextField_Text: @[LookinAttr_UITextField_Text_Text],
  218. LookinAttrSec_UITextField_Placeholder: @[LookinAttr_UITextField_Placeholder_Placeholder],
  219. LookinAttrSec_UITextField_Font: @[LookinAttr_UITextField_Font_Name,
  220. LookinAttr_UITextField_Font_Size],
  221. LookinAttrSec_UITextField_TextColor: @[LookinAttr_UITextField_TextColor_Color],
  222. LookinAttrSec_UITextField_Alignment: @[LookinAttr_UITextField_Alignment_Alignment],
  223. LookinAttrSec_UITextField_Clears: @[LookinAttr_UITextField_Clears_ClearsOnBeginEditing,
  224. LookinAttr_UITextField_Clears_ClearsOnInsertion],
  225. LookinAttrSec_UITextField_CanAdjustFont: @[LookinAttr_UITextField_CanAdjustFont_CanAdjustFont,
  226. LookinAttr_UITextField_CanAdjustFont_MinSize],
  227. LookinAttrSec_UITextField_ClearButtonMode: @[LookinAttr_UITextField_ClearButtonMode_Mode]
  228. };
  229. });
  230. return dict[sectionID];
  231. }
  232. + (void)getHostGroupID:(inout LookinAttrGroupIdentifier *)groupID_inout sectionID:(inout LookinAttrSectionIdentifier *)sectionID_inout fromAttrID:(LookinAttrIdentifier)targetAttrID {
  233. __block LookinAttrGroupIdentifier targetGroupID = nil;
  234. __block LookinAttrSectionIdentifier targetSecID = nil;
  235. [[self groupIDs] enumerateObjectsUsingBlock:^(LookinAttrGroupIdentifier _Nonnull groupID, NSUInteger idx, BOOL * _Nonnull stop0) {
  236. [[self sectionIDsForGroupID:groupID] enumerateObjectsUsingBlock:^(LookinAttrSectionIdentifier _Nonnull secID, NSUInteger idx, BOOL * _Nonnull stop1) {
  237. [[self attrIDsForSectionID:secID] enumerateObjectsUsingBlock:^(LookinAttrIdentifier _Nonnull attrID, NSUInteger idx, BOOL * _Nonnull stop2) {
  238. if ([attrID isEqualToString:targetAttrID]) {
  239. targetGroupID = groupID;
  240. targetSecID = secID;
  241. *stop0 = YES;
  242. *stop1 = YES;
  243. *stop2 = YES;
  244. }
  245. }];
  246. }];
  247. }];
  248. if (groupID_inout && targetGroupID) {
  249. *groupID_inout = targetGroupID;
  250. }
  251. if (sectionID_inout && targetSecID) {
  252. *sectionID_inout = targetSecID;
  253. }
  254. }
  255. + (NSString *)groupTitleWithGroupID:(LookinAttrGroupIdentifier)groupID {
  256. static dispatch_once_t onceToken;
  257. static NSDictionary *rawInfo = nil;
  258. dispatch_once(&onceToken,^{
  259. rawInfo = @{
  260. LookinAttrGroup_Class: @"Class",
  261. LookinAttrGroup_Relation: @"Relation",
  262. LookinAttrGroup_Layout: @"Layout",
  263. LookinAttrGroup_AutoLayout: @"AutoLayout",
  264. LookinAttrGroup_ViewLayer: @"CALayer / UIView",
  265. LookinAttrGroup_UIImageView: @"UIImageView",
  266. LookinAttrGroup_UILabel: @"UILabel",
  267. LookinAttrGroup_UIControl: @"UIControl",
  268. LookinAttrGroup_UIButton: @"UIButton",
  269. LookinAttrGroup_UIScrollView: @"UIScrollView",
  270. LookinAttrGroup_UITableView: @"UITableView",
  271. LookinAttrGroup_UITextView: @"UITextView",
  272. LookinAttrGroup_UITextField: @"UITextField",
  273. LookinAttrGroup_UIVisualEffectView: @"UIVisualEffectView",
  274. LookinAttrGroup_UIStackView: @"UIStackView"
  275. };
  276. });
  277. NSString *title = rawInfo[groupID];
  278. NSAssert(title.length, @"");
  279. return title;
  280. }
  281. + (NSString *)sectionTitleWithSectionID:(LookinAttrSectionIdentifier)secID {
  282. static dispatch_once_t onceToken;
  283. static NSDictionary *rawInfo = nil;
  284. dispatch_once(&onceToken,^{
  285. rawInfo = @{
  286. LookinAttrSec_Layout_Frame: @"Frame",
  287. LookinAttrSec_Layout_Bounds: @"Bounds",
  288. LookinAttrSec_Layout_SafeArea: @"SafeArea",
  289. LookinAttrSec_Layout_Position: @"Position",
  290. LookinAttrSec_Layout_AnchorPoint: @"AnchorPoint",
  291. LookinAttrSec_AutoLayout_Hugging: @"HuggingPriority",
  292. LookinAttrSec_AutoLayout_Resistance: @"ResistancePriority",
  293. LookinAttrSec_AutoLayout_IntrinsicSize: @"IntrinsicSize",
  294. LookinAttrSec_ViewLayer_Corner: @"CornerRadius",
  295. LookinAttrSec_ViewLayer_BgColor: @"BackgroundColor",
  296. LookinAttrSec_ViewLayer_Border: @"Border",
  297. LookinAttrSec_ViewLayer_Shadow: @"Shadow",
  298. LookinAttrSec_ViewLayer_ContentMode: @"ContentMode",
  299. LookinAttrSec_ViewLayer_TintColor: @"TintColor",
  300. LookinAttrSec_ViewLayer_Tag: @"Tag",
  301. LookinAttrSec_UIStackView_Axis: @"Axis",
  302. LookinAttrSec_UIStackView_Distribution: @"Distribution",
  303. LookinAttrSec_UIStackView_Alignment: @"Alignment",
  304. LookinAttrSec_UIVisualEffectView_Style: @"Style",
  305. LookinAttrSec_UIVisualEffectView_QMUIForegroundColor: @"ForegroundColor",
  306. LookinAttrSec_UIImageView_Name: @"ImageName",
  307. LookinAttrSec_UILabel_TextColor: @"TextColor",
  308. LookinAttrSec_UITextView_TextColor: @"TextColor",
  309. LookinAttrSec_UITextField_TextColor: @"TextColor",
  310. LookinAttrSec_UILabel_BreakMode: @"LineBreakMode",
  311. LookinAttrSec_UILabel_NumberOfLines: @"NumberOfLines",
  312. LookinAttrSec_UILabel_Text: @"Text",
  313. LookinAttrSec_UITextView_Text: @"Text",
  314. LookinAttrSec_UITextField_Text: @"Text",
  315. LookinAttrSec_UITextField_Placeholder: @"Placeholder",
  316. LookinAttrSec_UILabel_Alignment: @"TextAlignment",
  317. LookinAttrSec_UITextView_Alignment: @"TextAlignment",
  318. LookinAttrSec_UITextField_Alignment: @"TextAlignment",
  319. LookinAttrSec_UIControl_HorAlignment: @"HorizontalAlignment",
  320. LookinAttrSec_UIControl_VerAlignment: @"VerticalAlignment",
  321. LookinAttrSec_UIControl_QMUIOutsideEdge: @"QMUI_outsideEdge",
  322. LookinAttrSec_UIButton_ContentInsets: @"ContentInsets",
  323. LookinAttrSec_UIButton_TitleInsets: @"TitleInsets",
  324. LookinAttrSec_UIButton_ImageInsets: @"ImageInsets",
  325. LookinAttrSec_UIScrollView_QMUIInitialInset: @"QMUI_initialContentInset",
  326. LookinAttrSec_UIScrollView_ContentInset: @"ContentInset",
  327. LookinAttrSec_UIScrollView_AdjustedInset: @"AdjustedContentInset",
  328. LookinAttrSec_UIScrollView_IndicatorInset: @"ScrollIndicatorInsets",
  329. LookinAttrSec_UIScrollView_Offset: @"ContentOffset",
  330. LookinAttrSec_UIScrollView_ContentSize: @"ContentSize",
  331. LookinAttrSec_UIScrollView_Behavior: @"InsetAdjustmentBehavior",
  332. LookinAttrSec_UIScrollView_ShowsIndicator: @"ShowsScrollIndicator",
  333. LookinAttrSec_UIScrollView_Bounce: @"AlwaysBounce",
  334. LookinAttrSec_UIScrollView_Zoom: @"Zoom",
  335. LookinAttrSec_UITableView_Style: @"Style",
  336. LookinAttrSec_UITableView_SectionsNumber: @"NumberOfSections",
  337. LookinAttrSec_UITableView_RowsNumber: @"NumberOfRows",
  338. LookinAttrSec_UITableView_SeparatorColor: @"SeparatorColor",
  339. LookinAttrSec_UITableView_SeparatorInset: @"SeparatorInset",
  340. LookinAttrSec_UITableView_SeparatorStyle: @"SeparatorStyle",
  341. LookinAttrSec_UILabel_Font: @"Font",
  342. LookinAttrSec_UITextField_Font: @"Font",
  343. LookinAttrSec_UITextView_Font: @"Font",
  344. LookinAttrSec_UITextView_ContainerInset: @"ContainerInset",
  345. LookinAttrSec_UITextField_ClearButtonMode: @"ClearButtonMode",
  346. };
  347. });
  348. return rawInfo[secID];
  349. }
  350. /**
  351. className: 必填项,标识该属性是哪一个类拥有的
  352. fullTitle: 完整的名字,将作为搜索的 keywords,也会展示在搜索结果中,如果为 nil 则不会被搜索到
  353. briefTitle:简略的名字,仅 checkbox 和那种自带标题的 input 才需要这个属性,如果需要该属性但该属性又为空,则会读取 fullTitle
  354. setterString:用户试图修改属性值时会用到,若该字段为空字符串(即 @“”)则该属性不可修改,若该字段为 nil 则会在 fullTitle 的基础上自动生成(自动改首字母大小写、加前缀后缀,比如 alpha 会被转换为 setAlpha:)
  355. getterString:必填项,业务中读取属性值时会用到。如果该字段为 nil ,则会在 fullTitle 的基础上自动生成(自动把 fullTitle 的第一个字母改成小写,比如 Alpha 会被转换为 alpha)。如果该字段为空字符串(比如 image_open_open)则属性值会被固定为 nil,attrType 会被指为 LookinAttrTypeCustomObj
  356. typeIfObj:当某个 LookinAttribute 确定是 NSObject 类型时,该方法返回它具体是什么对象,比如 UIColor、NSString
  357. enumList:如果某个 attribute 是 enum,则这里标识了相应的 enum 的名称(如 "NSTextAlignment"),业务可通过这个名称进而查询可用的枚举值列表
  358. patch:如果为 YES,则用户修改了该 Attribute 的值后,Lookin 会重新拉取和更新相关图层的位置、截图等信息,如果为 nil 则默认是 NO
  359. hideIfNil:如果为 YES,则当获取的 value 为 nil 时,Lookin 不会传输该 attr。如果为 NO,则即使 value 为 nil 也会传输(比如 label 的 text 属性,即使它是 nil 我们也要显示,所以它的 hideIfNil 应该为 NO)。如果该字段为 nil 则默认是 NO
  360. osVersion: 该属性需要的最低的 iOS 版本,比如 safeAreaInsets 从 iOS 11.0 开始出现,则该属性应该为 @11,如果为 nil 则表示不限制 iOS 版本
  361. */
  362. + (NSDictionary<NSString *, id> *)_infoForAttrID:(LookinAttrIdentifier)attrID {
  363. static NSDictionary<LookinAttrIdentifier, NSDictionary<NSString *, id> *> *dict;
  364. static dispatch_once_t onceToken;
  365. dispatch_once(&onceToken,^{
  366. dict = @{
  367. LookinAttr_Class_Class_Class: @{
  368. @"className": @"CALayer",
  369. @"getterString": @"lks_relatedClassChainList",
  370. @"setterString": @"",
  371. @"typeIfObj": @(LookinAttrTypeCustomObj)
  372. },
  373. LookinAttr_Relation_Relation_Relation: @{
  374. @"className": @"CALayer",
  375. @"getterString": @"lks_selfRelation",
  376. @"setterString": @"",
  377. @"typeIfObj": @(LookinAttrTypeCustomObj),
  378. @"hideIfNil": @(YES)
  379. },
  380. LookinAttr_Layout_Frame_Frame: @{
  381. @"className": @"CALayer",
  382. @"fullTitle": @"Frame",
  383. @"patch": @(YES)
  384. },
  385. LookinAttr_Layout_Bounds_Bounds: @{
  386. @"className": @"CALayer",
  387. @"fullTitle": @"Bounds",
  388. @"patch": @(YES)
  389. },
  390. LookinAttr_Layout_SafeArea_SafeArea: @{
  391. @"className": @"UIView",
  392. @"fullTitle": @"SafeAreaInsets",
  393. @"setterString": @"",
  394. @"osVersion": @(11)
  395. },
  396. LookinAttr_Layout_Position_Position: @{
  397. @"className": @"CALayer",
  398. @"fullTitle": @"Position",
  399. @"patch": @(YES)
  400. },
  401. LookinAttr_Layout_AnchorPoint_AnchorPoint: @{
  402. @"className": @"CALayer",
  403. @"fullTitle": @"AnchorPoint",
  404. @"patch": @(YES)
  405. },
  406. LookinAttr_AutoLayout_Hugging_Hor: @{
  407. @"className": @"UIView",
  408. @"fullTitle": @"ContentHuggingPriority(Horizontal)",
  409. @"getterString": @"lks_horizontalContentHuggingPriority",
  410. @"setterString": @"setLks_horizontalContentHuggingPriority:",
  411. @"briefTitle": @"H",
  412. @"patch": @(YES)
  413. },
  414. LookinAttr_AutoLayout_Hugging_Ver: @{
  415. @"className": @"UIView",
  416. @"fullTitle": @"ContentHuggingPriority(Vertical)",
  417. @"getterString": @"lks_verticalContentHuggingPriority",
  418. @"setterString": @"setLks_verticalContentHuggingPriority:",
  419. @"briefTitle": @"V",
  420. @"patch": @(YES)
  421. },
  422. LookinAttr_AutoLayout_Resistance_Hor: @{
  423. @"className": @"UIView",
  424. @"fullTitle": @"ContentCompressionResistancePriority(Horizontal)",
  425. @"getterString": @"lks_horizontalContentCompressionResistancePriority",
  426. @"setterString": @"setLks_horizontalContentCompressionResistancePriority:",
  427. @"briefTitle": @"H",
  428. @"patch": @(YES)
  429. },
  430. LookinAttr_AutoLayout_Resistance_Ver: @{
  431. @"className": @"UIView",
  432. @"fullTitle": @"ContentCompressionResistancePriority(Vertical)",
  433. @"getterString": @"lks_verticalContentCompressionResistancePriority",
  434. @"setterString": @"setLks_verticalContentCompressionResistancePriority:",
  435. @"briefTitle": @"V",
  436. @"patch": @(YES)
  437. },
  438. LookinAttr_AutoLayout_Constraints_Constraints: @{
  439. @"className": @"UIView",
  440. @"getterString": @"lks_constraints",
  441. @"setterString": @"",
  442. @"typeIfObj": @(LookinAttrTypeCustomObj),
  443. @"hideIfNil": @(YES)
  444. },
  445. LookinAttr_AutoLayout_IntrinsicSize_Size: @{
  446. @"className": @"UIView",
  447. @"fullTitle": @"IntrinsicContentSize",
  448. @"setterString": @""
  449. },
  450. LookinAttr_ViewLayer_Visibility_Hidden: @{
  451. @"className": @"CALayer",
  452. @"fullTitle": @"Hidden",
  453. @"getterString": @"isHidden",
  454. @"patch": @(YES)
  455. },
  456. LookinAttr_ViewLayer_Visibility_Opacity: @{
  457. @"className": @"CALayer",
  458. @"fullTitle": @"Opacity / Alpha",
  459. @"setterString": @"setOpacity:",
  460. @"getterString": @"opacity",
  461. @"patch": @(YES)
  462. },
  463. LookinAttr_ViewLayer_InterationAndMasks_Interaction: @{
  464. @"className": @"UIView",
  465. @"fullTitle": @"UserInteractionEnabled",
  466. @"getterString": @"isUserInteractionEnabled",
  467. @"patch": @(NO)
  468. },
  469. LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds: @{
  470. @"className": @"CALayer",
  471. @"fullTitle": @"MasksToBounds / ClipsToBounds",
  472. @"briefTitle": @"MasksToBounds",
  473. @"setterString": @"setMasksToBounds:",
  474. @"getterString": @"masksToBounds",
  475. @"patch": @(YES)
  476. },
  477. LookinAttr_ViewLayer_Corner_Radius: @{
  478. @"className": @"CALayer",
  479. @"fullTitle": @"CornerRadius",
  480. @"briefTitle": @"",
  481. @"patch": @(YES)
  482. },
  483. LookinAttr_ViewLayer_BgColor_BgColor: @{
  484. @"className": @"CALayer",
  485. @"fullTitle": @"BackgroundColor",
  486. @"setterString": @"setLks_backgroundColor:",
  487. @"getterString": @"lks_backgroundColor",
  488. @"typeIfObj": @(LookinAttrTypeUIColor),
  489. @"patch": @(YES)
  490. },
  491. LookinAttr_ViewLayer_Border_Color: @{
  492. @"className": @"CALayer",
  493. @"fullTitle": @"BorderColor",
  494. @"setterString": @"setLks_borderColor:",
  495. @"getterString": @"lks_borderColor",
  496. @"typeIfObj": @(LookinAttrTypeUIColor),
  497. @"patch": @(YES)
  498. },
  499. LookinAttr_ViewLayer_Border_Width: @{
  500. @"className": @"CALayer",
  501. @"fullTitle": @"BorderWidth",
  502. @"patch": @(YES)
  503. },
  504. LookinAttr_ViewLayer_Shadow_Color: @{
  505. @"className": @"CALayer",
  506. @"fullTitle": @"ShadowColor",
  507. @"setterString": @"setLks_shadowColor:",
  508. @"getterString": @"lks_shadowColor",
  509. @"typeIfObj": @(LookinAttrTypeUIColor),
  510. @"patch": @(YES)
  511. },
  512. LookinAttr_ViewLayer_Shadow_Opacity: @{
  513. @"className": @"CALayer",
  514. @"fullTitle": @"ShadowOpacity",
  515. @"briefTitle": @"Opacity",
  516. @"patch": @(YES)
  517. },
  518. LookinAttr_ViewLayer_Shadow_Radius: @{
  519. @"className": @"CALayer",
  520. @"fullTitle": @"ShadowRadius",
  521. @"briefTitle": @"Radius",
  522. @"patch": @(YES)
  523. },
  524. LookinAttr_ViewLayer_Shadow_OffsetW: @{
  525. @"className": @"CALayer",
  526. @"fullTitle": @"ShadowOffsetWidth",
  527. @"briefTitle": @"OffsetW",
  528. @"setterString": @"setLks_shadowOffsetWidth:",
  529. @"getterString": @"lks_shadowOffsetWidth",
  530. @"patch": @(YES)
  531. },
  532. LookinAttr_ViewLayer_Shadow_OffsetH: @{
  533. @"className": @"CALayer",
  534. @"fullTitle": @"ShadowOffsetHeight",
  535. @"briefTitle": @"OffsetH",
  536. @"setterString": @"setLks_shadowOffsetHeight:",
  537. @"getterString": @"lks_shadowOffsetHeight",
  538. @"patch": @(YES)
  539. },
  540. LookinAttr_ViewLayer_ContentMode_Mode: @{
  541. @"className": @"UIView",
  542. @"fullTitle": @"ContentMode",
  543. @"enumList": @"UIViewContentMode",
  544. @"patch": @(YES)
  545. },
  546. LookinAttr_ViewLayer_TintColor_Color: @{
  547. @"className": @"UIView",
  548. @"fullTitle": @"TintColor",
  549. @"typeIfObj": @(LookinAttrTypeUIColor),
  550. @"patch": @(YES)
  551. },
  552. LookinAttr_ViewLayer_TintColor_Mode: @{
  553. @"className": @"UIView",
  554. @"fullTitle": @"TintAdjustmentMode",
  555. @"enumList": @"UIViewTintAdjustmentMode",
  556. @"patch": @(YES)
  557. },
  558. LookinAttr_ViewLayer_Tag_Tag: @{
  559. @"className": @"UIView",
  560. @"fullTitle": @"Tag",
  561. @"briefTitle": @"",
  562. @"patch": @(NO)
  563. },
  564. LookinAttr_UIStackView_Axis_Axis: @{
  565. @"className": @"UIStackView",
  566. @"fullTitle": @"Axis",
  567. @"enumList": @"UILayoutConstraintAxis",
  568. @"patch": @(YES)
  569. },
  570. LookinAttr_UIStackView_Distribution_Distribution: @{
  571. @"className": @"UIStackView",
  572. @"fullTitle": @"Distribution",
  573. @"enumList": @"UIStackViewDistribution",
  574. @"patch": @(YES)
  575. },
  576. LookinAttr_UIStackView_Alignment_Alignment: @{
  577. @"className": @"UIStackView",
  578. @"fullTitle": @"Alignment",
  579. @"enumList": @"UIStackViewAlignment",
  580. @"patch": @(YES)
  581. },
  582. LookinAttr_UIStackView_Spacing_Spacing: @{
  583. @"className": @"UIStackView",
  584. @"fullTitle": @"Spacing",
  585. @"patch": @(YES)
  586. },
  587. LookinAttr_UIVisualEffectView_Style_Style: @{
  588. @"className": @"UIVisualEffectView",
  589. @"setterString": @"setLks_blurEffectStyleNumber:",
  590. @"getterString": @"lks_blurEffectStyleNumber",
  591. @"enumList": @"UIBlurEffectStyle",
  592. @"typeIfObj": @(LookinAttrTypeCustomObj),
  593. @"patch": @(YES),
  594. @"hideIfNil": @(YES)
  595. },
  596. LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color: @{
  597. @"className": @"QMUIVisualEffectView",
  598. @"fullTitle": @"ForegroundColor",
  599. @"typeIfObj": @(LookinAttrTypeUIColor),
  600. @"patch": @(YES),
  601. },
  602. LookinAttr_UIImageView_Name_Name: @{
  603. @"className": @"UIImageView",
  604. @"fullTitle": @"ImageName",
  605. @"setterString": @"",
  606. @"getterString": @"lks_imageSourceName",
  607. @"typeIfObj": @(LookinAttrTypeNSString),
  608. @"hideIfNil": @(YES)
  609. },
  610. LookinAttr_UIImageView_Open_Open: @{
  611. @"className": @"UIImageView",
  612. @"setterString": @"",
  613. @"getterString": @"lks_imageViewOidIfHasImage",
  614. @"typeIfObj": @(LookinAttrTypeCustomObj),
  615. @"hideIfNil": @(YES)
  616. },
  617. LookinAttr_UILabel_Text_Text: @{
  618. @"className": @"UILabel",
  619. @"fullTitle": @"Text",
  620. @"typeIfObj": @(LookinAttrTypeNSString),
  621. @"patch": @(YES)
  622. },
  623. LookinAttr_UILabel_NumberOfLines_NumberOfLines: @{
  624. @"className": @"UILabel",
  625. @"fullTitle": @"NumberOfLines",
  626. @"briefTitle": @"",
  627. @"patch": @(YES)
  628. },
  629. LookinAttr_UILabel_Font_Size: @{
  630. @"className": @"UILabel",
  631. @"fullTitle": @"FontSize",
  632. @"briefTitle": @"FontSize",
  633. @"setterString": @"setLks_fontSize:",
  634. @"getterString": @"lks_fontSize",
  635. @"patch": @(YES)
  636. },
  637. LookinAttr_UILabel_Font_Name: @{
  638. @"className": @"UILabel",
  639. @"fullTitle": @"FontName",
  640. @"setterString": @"",
  641. @"getterString": @"lks_fontName",
  642. @"typeIfObj": @(LookinAttrTypeNSString),
  643. @"patch": @(NO)
  644. },
  645. LookinAttr_UILabel_TextColor_Color: @{
  646. @"className": @"UILabel",
  647. @"fullTitle": @"TextColor",
  648. @"typeIfObj": @(LookinAttrTypeUIColor),
  649. @"patch": @(YES)
  650. },
  651. LookinAttr_UILabel_Alignment_Alignment: @{
  652. @"className": @"UILabel",
  653. @"fullTitle": @"TextAlignment",
  654. @"enumList": @"NSTextAlignment",
  655. @"patch": @(YES)
  656. },
  657. LookinAttr_UILabel_BreakMode_Mode: @{
  658. @"className": @"UILabel",
  659. @"fullTitle": @"LineBreakMode",
  660. @"enumList": @"NSLineBreakMode",
  661. @"patch": @(YES)
  662. },
  663. LookinAttr_UILabel_CanAdjustFont_CanAdjustFont: @{
  664. @"className": @"UILabel",
  665. @"fullTitle": @"AdjustsFontSizeToFitWidth",
  666. @"patch": @(YES)
  667. },
  668. LookinAttr_UIControl_EnabledSelected_Enabled: @{
  669. @"className": @"UIControl",
  670. @"fullTitle": @"Enabled",
  671. @"getterString": @"isEnabled",
  672. @"patch": @(NO)
  673. },
  674. LookinAttr_UIControl_EnabledSelected_Selected: @{
  675. @"className": @"UIControl",
  676. @"fullTitle": @"Selected",
  677. @"getterString": @"isSelected",
  678. @"patch": @(YES)
  679. },
  680. LookinAttr_UIControl_VerAlignment_Alignment: @{
  681. @"className": @"UIControl",
  682. @"fullTitle": @"ContentVerticalAlignment",
  683. @"enumList": @"UIControlContentVerticalAlignment",
  684. @"patch": @(YES)
  685. },
  686. LookinAttr_UIControl_HorAlignment_Alignment: @{
  687. @"className": @"UIControl",
  688. @"fullTitle": @"ContentHorizontalAlignment",
  689. @"enumList": @"UIControlContentHorizontalAlignment",
  690. @"patch": @(YES)
  691. },
  692. LookinAttr_UIControl_QMUIOutsideEdge_Edge: @{
  693. @"className": @"UIControl",
  694. @"fullTitle": @"qmui_outsideEdge"
  695. },
  696. LookinAttr_UIButton_ContentInsets_Insets: @{
  697. @"className": @"UIButton",
  698. @"fullTitle": @"ContentEdgeInsets",
  699. @"patch": @(YES)
  700. },
  701. LookinAttr_UIButton_TitleInsets_Insets: @{
  702. @"className": @"UIButton",
  703. @"fullTitle": @"TitleEdgeInsets",
  704. @"patch": @(YES)
  705. },
  706. LookinAttr_UIButton_ImageInsets_Insets: @{
  707. @"className": @"UIButton",
  708. @"fullTitle": @"ImageEdgeInsets",
  709. @"patch": @(YES)
  710. },
  711. LookinAttr_UIScrollView_Offset_Offset: @{
  712. @"className": @"UIScrollView",
  713. @"fullTitle": @"ContentOffset",
  714. @"patch": @(YES)
  715. },
  716. LookinAttr_UIScrollView_ContentSize_Size: @{
  717. @"className": @"UIScrollView",
  718. @"fullTitle": @"ContentSize",
  719. @"patch": @(YES)
  720. },
  721. LookinAttr_UIScrollView_ContentInset_Inset: @{
  722. @"className": @"UIScrollView",
  723. @"fullTitle": @"ContentInset",
  724. @"patch": @(YES)
  725. },
  726. LookinAttr_UIScrollView_QMUIInitialInset_Inset: @{
  727. @"className": @"UIScrollView",
  728. @"fullTitle": @"qmui_initialContentInset",
  729. @"patch": @(YES)
  730. },
  731. LookinAttr_UIScrollView_AdjustedInset_Inset: @{
  732. @"className": @"UIScrollView",
  733. @"fullTitle": @"AdjustedContentInset",
  734. @"setterString": @"",
  735. @"osVersion": @(11)
  736. },
  737. LookinAttr_UIScrollView_Behavior_Behavior: @{
  738. @"className": @"UIScrollView",
  739. @"fullTitle": @"ContentInsetAdjustmentBehavior",
  740. @"enumList": @"UIScrollViewContentInsetAdjustmentBehavior",
  741. @"patch": @(YES),
  742. @"osVersion": @(11)
  743. },
  744. LookinAttr_UIScrollView_IndicatorInset_Inset: @{
  745. @"className": @"UIScrollView",
  746. @"fullTitle": @"ScrollIndicatorInsets",
  747. @"patch": @(NO)
  748. },
  749. LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled: @{
  750. @"className": @"UIScrollView",
  751. @"fullTitle": @"ScrollEnabled",
  752. @"getterString": @"isScrollEnabled",
  753. @"patch": @(NO)
  754. },
  755. LookinAttr_UIScrollView_ScrollPaging_PagingEnabled: @{
  756. @"className": @"UIScrollView",
  757. @"fullTitle": @"PagingEnabled",
  758. @"getterString": @"isPagingEnabled",
  759. @"patch": @(NO)
  760. },
  761. LookinAttr_UIScrollView_Bounce_Ver: @{
  762. @"className": @"UIScrollView",
  763. @"fullTitle": @"AlwaysBounceVertical",
  764. @"briefTitle": @"Vertical",
  765. @"patch": @(NO)
  766. },
  767. LookinAttr_UIScrollView_Bounce_Hor: @{
  768. @"className": @"UIScrollView",
  769. @"fullTitle": @"AlwaysBounceHorizontal",
  770. @"briefTitle": @"Horizontal",
  771. @"patch": @(NO)
  772. },
  773. LookinAttr_UIScrollView_ShowsIndicator_Hor: @{
  774. @"className": @"UIScrollView",
  775. @"fullTitle": @"ShowsHorizontalScrollIndicator",
  776. @"briefTitle": @"Horizontal",
  777. @"patch": @(NO)
  778. },
  779. LookinAttr_UIScrollView_ShowsIndicator_Ver: @{
  780. @"className": @"UIScrollView",
  781. @"fullTitle": @"ShowsVerticalScrollIndicator",
  782. @"briefTitle": @"Vertical",
  783. @"patch": @(NO)
  784. },
  785. LookinAttr_UIScrollView_ContentTouches_Delay: @{
  786. @"className": @"UIScrollView",
  787. @"fullTitle": @"DelaysContentTouches",
  788. @"patch": @(NO)
  789. },
  790. LookinAttr_UIScrollView_ContentTouches_CanCancel: @{
  791. @"className": @"UIScrollView",
  792. @"fullTitle": @"CanCancelContentTouches",
  793. @"patch": @(NO)
  794. },
  795. LookinAttr_UIScrollView_Zoom_MinScale: @{
  796. @"className": @"UIScrollView",
  797. @"fullTitle": @"MinimumZoomScale",
  798. @"briefTitle": @"MinScale",
  799. @"patch": @(NO)
  800. },
  801. LookinAttr_UIScrollView_Zoom_MaxScale: @{
  802. @"className": @"UIScrollView",
  803. @"fullTitle": @"MaximumZoomScale",
  804. @"briefTitle": @"MaxScale",
  805. @"patch": @(NO)
  806. },
  807. LookinAttr_UIScrollView_Zoom_Scale: @{
  808. @"className": @"UIScrollView",
  809. @"fullTitle": @"ZoomScale",
  810. @"briefTitle": @"Scale",
  811. @"patch": @(YES)
  812. },
  813. LookinAttr_UIScrollView_Zoom_Bounce: @{
  814. @"className": @"UIScrollView",
  815. @"fullTitle": @"BouncesZoom",
  816. @"patch": @(NO)
  817. },
  818. LookinAttr_UITableView_Style_Style: @{
  819. @"className": @"UITableView",
  820. @"fullTitle": @"Style",
  821. @"setterString": @"",
  822. @"enumList": @"UITableViewStyle",
  823. @"patch": @(YES)
  824. },
  825. LookinAttr_UITableView_SectionsNumber_Number: @{
  826. @"className": @"UITableView",
  827. @"fullTitle": @"NumberOfSections",
  828. @"setterString": @"",
  829. @"patch": @(YES)
  830. },
  831. LookinAttr_UITableView_RowsNumber_Number: @{
  832. @"className": @"UITableView",
  833. @"setterString": @"",
  834. @"getterString": @"lks_numberOfRows",
  835. @"typeIfObj": @(LookinAttrTypeCustomObj)
  836. },
  837. LookinAttr_UITableView_SeparatorInset_Inset: @{
  838. @"className": @"UITableView",
  839. @"fullTitle": @"SeparatorInset",
  840. @"patch": @(NO)
  841. },
  842. LookinAttr_UITableView_SeparatorColor_Color: @{
  843. @"className": @"UITableView",
  844. @"fullTitle": @"SeparatorColor",
  845. @"typeIfObj": @(LookinAttrTypeUIColor),
  846. @"patch": @(YES)
  847. },
  848. LookinAttr_UITableView_SeparatorStyle_Style: @{
  849. @"className": @"UITableView",
  850. @"fullTitle": @"SeparatorStyle",
  851. @"enumList": @"UITableViewCellSeparatorStyle",
  852. @"patch": @(YES)
  853. },
  854. LookinAttr_UITextView_Text_Text: @{
  855. @"className": @"UITextView",
  856. @"fullTitle": @"Text",
  857. @"typeIfObj": @(LookinAttrTypeNSString),
  858. @"patch": @(YES)
  859. },
  860. LookinAttr_UITextView_Font_Name: @{
  861. @"className": @"UITextView",
  862. @"fullTitle": @"FontName",
  863. @"setterString": @"",
  864. @"getterString": @"lks_fontName",
  865. @"typeIfObj": @(LookinAttrTypeNSString),
  866. @"patch": @(NO)
  867. },
  868. LookinAttr_UITextView_Font_Size: @{
  869. @"className": @"UITextView",
  870. @"fullTitle": @"FontSize",
  871. @"setterString": @"setLks_fontSize:",
  872. @"getterString": @"lks_fontSize",
  873. @"patch": @(YES)
  874. },
  875. LookinAttr_UITextView_Basic_Editable: @{
  876. @"className": @"UITextView",
  877. @"fullTitle": @"Editable",
  878. @"getterString": @"isEditable",
  879. @"patch": @(NO)
  880. },
  881. LookinAttr_UITextView_Basic_Selectable: @{
  882. @"className": @"UITextView",
  883. @"fullTitle": @"Selectable",
  884. @"getterString": @"isSelectable",
  885. @"patch": @(NO)
  886. },
  887. LookinAttr_UITextView_TextColor_Color: @{
  888. @"className": @"UITextView",
  889. @"fullTitle": @"TextColor",
  890. @"typeIfObj": @(LookinAttrTypeUIColor),
  891. @"patch": @(YES)
  892. },
  893. LookinAttr_UITextView_Alignment_Alignment: @{
  894. @"className": @"UITextView",
  895. @"fullTitle": @"TextAlignment",
  896. @"enumList": @"NSTextAlignment",
  897. @"patch": @(YES)
  898. },
  899. LookinAttr_UITextView_ContainerInset_Inset: @{
  900. @"className": @"UITextView",
  901. @"fullTitle": @"TextContainerInset",
  902. @"patch": @(YES)
  903. },
  904. LookinAttr_UITextField_Font_Name: @{
  905. @"className": @"UITextField",
  906. @"fullTitle": @"FontName",
  907. @"setterString": @"",
  908. @"getterString": @"lks_fontName",
  909. @"typeIfObj": @(LookinAttrTypeNSString),
  910. @"patch": @(NO)
  911. },
  912. LookinAttr_UITextField_Font_Size: @{
  913. @"className": @"UITextField",
  914. @"fullTitle": @"FontSize",
  915. @"setterString": @"setLks_fontSize:",
  916. @"getterString": @"lks_fontSize",
  917. @"patch": @(YES)
  918. },
  919. LookinAttr_UITextField_TextColor_Color: @{
  920. @"className": @"UITextField",
  921. @"fullTitle": @"TextColor",
  922. @"typeIfObj": @(LookinAttrTypeUIColor),
  923. @"patch": @(YES)
  924. },
  925. LookinAttr_UITextField_Alignment_Alignment: @{
  926. @"className": @"UITextField",
  927. @"fullTitle": @"TextAlignment",
  928. @"enumList": @"NSTextAlignment",
  929. @"patch": @(YES)
  930. },
  931. LookinAttr_UITextField_Text_Text: @{
  932. @"className": @"UITextField",
  933. @"fullTitle": @"Text",
  934. @"typeIfObj": @(LookinAttrTypeNSString),
  935. @"patch": @(YES)
  936. },
  937. LookinAttr_UITextField_Placeholder_Placeholder: @{
  938. @"className": @"UITextField",
  939. @"fullTitle": @"Placeholder",
  940. @"typeIfObj": @(LookinAttrTypeNSString),
  941. @"patch": @(YES)
  942. },
  943. LookinAttr_UITextField_Clears_ClearsOnBeginEditing: @{
  944. @"className": @"UITextField",
  945. @"fullTitle": @"ClearsOnBeginEditing",
  946. @"patch": @(NO)
  947. },
  948. LookinAttr_UITextField_Clears_ClearsOnInsertion: @{
  949. @"className": @"UITextField",
  950. @"fullTitle": @"ClearsOnInsertion",
  951. @"patch": @(NO)
  952. },
  953. LookinAttr_UITextField_CanAdjustFont_CanAdjustFont: @{
  954. @"className": @"UITextField",
  955. @"fullTitle": @"AdjustsFontSizeToFitWidth",
  956. @"patch": @(YES)
  957. },
  958. LookinAttr_UITextField_CanAdjustFont_MinSize: @{
  959. @"className": @"UITextField",
  960. @"fullTitle": @"MinimumFontSize",
  961. @"patch": @(YES)
  962. },
  963. LookinAttr_UITextField_ClearButtonMode_Mode: @{
  964. @"className": @"UITextField",
  965. @"fullTitle": @"ClearButtonMode",
  966. @"enumList": @"UITextFieldViewMode",
  967. @"patch": @(NO)
  968. },
  969. };
  970. });
  971. NSDictionary<NSString *, id> *targetInfo = dict[attrID];
  972. return targetInfo;
  973. }
  974. + (LookinAttrType)objectAttrTypeWithAttrID:(LookinAttrIdentifier)attrID {
  975. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  976. NSNumber *typeIfObj = attrInfo[@"typeIfObj"];
  977. return [typeIfObj integerValue];
  978. }
  979. + (NSString *)classNameWithAttrID:(LookinAttrIdentifier)attrID {
  980. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  981. NSString *className = attrInfo[@"className"];
  982. NSAssert(className.length > 0, @"");
  983. return className;
  984. }
  985. + (BOOL)isUIViewPropertyWithAttrID:(LookinAttrIdentifier)attrID {
  986. NSString *className = [self classNameWithAttrID:attrID];
  987. if ([className isEqualToString:@"CALayer"]) {
  988. return NO;
  989. }
  990. return YES;
  991. }
  992. + (NSString *)enumListNameWithAttrID:(LookinAttrIdentifier)attrID {
  993. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  994. NSString *name = attrInfo[@"enumList"];
  995. return name;
  996. }
  997. + (BOOL)needPatchAfterModificationWithAttrID:(LookinAttrIdentifier)attrID {
  998. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  999. NSNumber *needPatch = attrInfo[@"patch"];
  1000. return [needPatch boolValue];
  1001. }
  1002. + (NSString *)fullTitleWithAttrID:(LookinAttrIdentifier)attrID {
  1003. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1004. NSString *fullTitle = attrInfo[@"fullTitle"];
  1005. return fullTitle;
  1006. }
  1007. + (NSString *)briefTitleWithAttrID:(LookinAttrIdentifier)attrID {
  1008. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1009. NSString *briefTitle = attrInfo[@"briefTitle"];
  1010. if (!briefTitle) {
  1011. briefTitle = attrInfo[@"fullTitle"];
  1012. }
  1013. return briefTitle;
  1014. }
  1015. + (SEL)getterWithAttrID:(LookinAttrIdentifier)attrID {
  1016. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1017. NSString *getterString = attrInfo[@"getterString"];
  1018. if (getterString && getterString.length == 0) {
  1019. // 空字符串,比如 image_open_open
  1020. return nil;
  1021. }
  1022. if (!getterString) {
  1023. NSString *fullTitle = attrInfo[@"fullTitle"];
  1024. NSAssert(fullTitle.length > 0, @"");
  1025. getterString = [NSString stringWithFormat:@"%@%@", [fullTitle substringToIndex:1].lowercaseString, [fullTitle substringFromIndex:1]].copy;
  1026. }
  1027. return NSSelectorFromString(getterString);
  1028. }
  1029. + (SEL)setterWithAttrID:(LookinAttrIdentifier)attrID {
  1030. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1031. NSString *setterString = attrInfo[@"setterString"];
  1032. if ([setterString isEqualToString:@""]) {
  1033. // 该属性不可在 Lookin 客户端中被修改
  1034. return nil;
  1035. }
  1036. if (!setterString) {
  1037. NSString *fullTitle = attrInfo[@"fullTitle"];
  1038. NSAssert(fullTitle.length > 0, @"");
  1039. setterString = [NSString stringWithFormat:@"set%@%@:", [fullTitle substringToIndex:1].uppercaseString, [fullTitle substringFromIndex:1]];
  1040. }
  1041. return NSSelectorFromString(setterString);
  1042. }
  1043. + (BOOL)hideIfNilWithAttrID:(LookinAttrIdentifier)attrID {
  1044. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1045. NSNumber *boolValue = attrInfo[@"hideIfNil"];
  1046. return boolValue.boolValue;
  1047. }
  1048. + (NSInteger)minAvailableOSVersionWithAttrID:(LookinAttrIdentifier)attrID {
  1049. NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];
  1050. NSNumber *minVerNum = attrInfo[@"osVersion"];
  1051. NSInteger minVer = [minVerNum integerValue];
  1052. return minVer;
  1053. }
  1054. @end
  1055. #endif /* SHOULD_COMPILE_LOOKIN_SERVER */