I need a design opinion please

I am createing a Swift Framework that will support all current Apple Platforms (iOS, macOS, tvOS and maybe watchOS). Part of my goal is to create subclasses of all major controls so that code that I write uses ONE syntax so I can created projects that are “X-plat”. Since macOS uses AppKit (NSxxx) and iOS uses UIKit (UIxxx) this is part of what I wish to abstract… creating a DSxxx that will use compiler directives to create the proper code (like Xojo Target).

Now to the opinion. for all the macOS controls, there is Xojo like “lock” properties. However these properties are pretty much meaningless to iOS. So the question is, should I include non-operational versions for iOS? so that I can create a better consistency for the compiler?

something like this

#if os(macOS)
	var lockLeft: Bool {
		get { return getAssociated(associatedKey: &lockKeys.leftKey) }
		set { setAssociated(value: newValue, associatedKey: &lockKeys.leftKey) }
	}
#else
    var lockLeft: Bool {
		get { return false) }
		set {  }
	}
#endif

or should I leave that up to the developer? If they were making a macOS only or iOS only app, it wouldn’t matter, but if they were making a hybrid they’d have to isolate those from the compiler manually

And yes I know about Catalyst, but that doesn’t fit the paradigm I’m using

autolayout constraints for all
really - no joke
lock left is an “equals” constraint for the left edge of the control to ALWAYS be a fixed distance from the left of the super view
so are the rest

autolayout can do locks trivially

  • you HAD to know I’d suggest it - :stuck_out_tongue:

Autolayout doesn’t even enter this question… the question was if I should include parameters in the subclassed controls for both macOS (where they’d be used) and iOS where they would not … The locks make no sense in iOS since the screen/window never changes size.

As to the lock functionality itself. I have that working perfectly with way way less code than AL constraints would take (21 lines of code to be precise)

Guess I’m suggesting that IF you used AL then it would work on iOS macOS TVos etc etc and you’d have the same capabilities everywhere

No ?

AL can definitely do the same as locking and each “lock” is but one line of code