swisscovid-app-ios
swisscovid-app-ios copied to clipboard
The NS prefix should only be used by Apple
according to the Apple's docs the NS and UI prefixes are exclusively for Apple classes, otherwise your own classes could collide with future apple's classes
In order to keep class names unique, the convention is to use prefixes on all classes. You’ll have noticed that Cocoa and Cocoa Touch class names typically start either with NS or UI. Two-letter prefixes like these are reserved by Apple for use in framework classes. As you learn more about Cocoa and Cocoa Touch, you’ll encounter a variety of other prefixes that relate to specific frameworks: [..] Your own classes should use three letter prefixes.
e.g.: NSTracingErrorView NSSimpleModuleBaseView UIStateManager
You Actually don't need class prefixes in Swift
Create a Swift class for your corresponding Objective-C .m and .h files by choosing File > New > File > (iOS, watchOS, tvOS, or macOS) > Source > Swift File. You can use the same or a different name than your Objective-C class. Class prefixes are optional in Swift.
Solution:
You could either create your own Prefix (following the Objective-C Prefix convention) or remove it completely
Why This should be fixed At the moment users might imply that those classes are coming from Apple, and look for its documentation on Apple's doc page
It true, that was a bit of an unfortunate decision that happened that happened in one of the late nights eary in the project.
We might fix this somewhen, but security, stability and UX are more important right now. Would you be interested to start a PR?
Alright, I will remove the prefixes and create a PR
Great. A few remarks:
- Maybe start from https://github.com/DP-3T/dp3t-app-ios-ch/tree/feature/exposurenotification-entitlement, we'll soon merge it to develop with a few bigger changes
- We like to keep the UB-Prefix for reusable code that we have in several projects at Ubique
- I suggest to rename UIStateManager to InterfaceStateManager – UI is not really a prefix there.
As the code base is not changing much anymore, are you still interested in updating the pull-request?