LookinDashboardBlueprint.m 59 KB

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