override func viewDidAppear(_ animated: Bool) {      super.viewDidAppear(animated)      let value = UIInterfaceOrientation.landscapeLeft.rawValue      UIDevice.current.setValue(value, forKey: “orientation”) }   The above snippet of code works just fine when executed on any iPhone running iOS 12. But this will not work for any iPad running iOS…

I have 2 structs, Struct1, Struct2, which are both Codable.   When I try to encode a Dictionary which has both structs as values: typealias DataFileDictionary = [String: Any] var st1 = Struct1(…) var st2 = Struct2()         let dictForSave : DataFileDictionary = [“DataSettings”: st1,…

Instead of using an extension on the NSClipView Class I tried making my own class adopting NSClipView, reason being to add dragging functions and to be more specific which ClipView I’m working with.   For sme reason it’s not working, any tips why not ?…

In Objective-C, when I declare a writeable property, the compiler generates a “set” method for that property, and I can use the “respondsToSelector” function to check if the property exists in a generic way (for example if I want to automatically set a bunch of…

Hi,   I found a Swift example containing this expression:   attributes.substring(from: 1, to: 2)   When I type this into Xcode it comes up as a syntax error.   I guess this is something they changed in Swift between 3 and 4, or 2…