so, i convert to swift 4. get the errors squared away, compile and then run my app.
the debugger sends me a grave warning that a function, that I wrote, with no ties to Apple code whatsoever... is being deprecated in swift 4.
should I be worried? What does Apple know about my project that I don't?
anyway, the significant bits of the warning are as follows:
*** /path to the class.swift:24:5: implicit Objective-C entrypoint -[appname.classname functionName:] is deprecated and will be removed in Swift 4; add explicit '@objc' to the declaration to emit the Objective-C entrypoint in Swift 4 and suppress this message
i don't want to supress the message, the whole point of getting on swift 4 is to be a good citizen. I just don't understand what it's trying to tell me. I "think" that it's saying there's significant changes coming to the Notification system (which is what that function is... a method that cooresponds to an addObserver call) but you can see, the feedback is somewhat de-illuminating.
>> then another function … got flagged with the same warning
There's no particular reason why there can't be multiple declarations that need fixing, and they can be scattered throughout your code.
I don't have enough information to be sure, but I'm guessing that "viewNeedsUi" is a method you're using to observe notifications, and you've registered the observation using the selector form (addObserver(_:selector:name:object:)), and this method is declared in a class that ultimately inherits from NSObject.
In Swift 3.1, the fact that the class was NSObject-derived meant that unannoted methods typically were assumed to be @objc. (This was not the assumption if the methods were marked private, but yours isn't private.) In that case, Swift actually compiled two methods, one with the Swift mangled name that could be called statically from other Swift code, for performance reasons, and another with the expected Obj-C name that is called dynamically through the Obj-C runtime. The second one just calls the first, but provides the Obj-C compatibility.
In Swift 4, without the @objc annotation, only the first method exists. That's why the error message told you to "add explicit '@objc' to the declaration to emit the Objective-C entrypoint in Swift 4". The Obj-C entrypoint is the second method, and you need it in order to be able to create a selector from its name.
>> in order to get IB to recognise classes, I've been forced to use "@objc" in the class declarations
Actually, that's the wrong solution to that problem. Look at the Identity inspector for the item you're trying to set to a custom class. Immediately under the class name field, there's a module name field, and below that there's an "Inherit From Target" checkbox. If your class is written in Swift, just make sure the checkbox is checked, and IB will use the correct name. For classes written in Obj-C, make sure the checkbox is unchecked. That means you don't have to provide an explicit Obj-C-compatible class name in your source code.
AFAICT, this @objc(name) issue is unrelated to the original issue.