This repository was archived by the owner on Feb 17, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,16 +29,38 @@ extension LOKLayout {
2929 so that the methods of the class are called. We do this to make sure that if
3030 someone were to subclass one of the LayoutKit provided layouts, we would want
3131 to call their overriden methods instead of just the underlying layout object directly.
32+
33+ Certain platforms don't have certain layouts, so we make a different array for each platform
34+ with only the layouts that it supports.
3235 */
33- let allLayoutClasses = [
34- LOKButtonLayout . self,
35- LOKInsetLayout . self,
36- LOKLabelLayout . self,
37- LOKOverlayLayout . self,
38- LOKSizeLayout . self,
39- LOKStackLayout . self,
40- LOKTextViewLayout . self
41- ]
36+ let allLayoutClasses : [ AnyClass ]
37+ #if os(OSX)
38+ allLayoutClasses = [
39+ LOKInsetLayout . self,
40+ LOKOverlayLayout . self,
41+ LOKSizeLayout . self,
42+ LOKStackLayout . self
43+ ]
44+ #elseif os(tvOS)
45+ allLayoutClasses = [
46+ LOKInsetLayout . self,
47+ LOKOverlayLayout . self,
48+ LOKTextViewLayout . self,
49+ LOKButtonLayout . self,
50+ LOKSizeLayout . self,
51+ LOKStackLayout . self
52+ ]
53+ #else
54+ allLayoutClasses = [
55+ LOKInsetLayout . self,
56+ LOKOverlayLayout . self,
57+ LOKTextViewLayout . self,
58+ LOKButtonLayout . self,
59+ LOKLabelLayout . self,
60+ LOKSizeLayout . self,
61+ LOKStackLayout . self
62+ ]
63+ #endif
4264 if let object = self as? NSObject {
4365 if allLayoutClasses. contains ( where: { object. isMember ( of: $0) } ) {
4466 // Executes if `self` is one of the LayoutKit provided classes; not if it's a subclass
You can’t perform that action at this time.
0 commit comments