NSUserDefaults-SevenSecurityLayers icon indicating copy to clipboard operation
NSUserDefaults-SevenSecurityLayers copied to clipboard

Secure keys cannot be made in Swift 3

Open fizker opened this issue 9 years ago • 0 comments

The Clang ObjC importer in Swift 3 does a transform that breaks the recommended key generation ("".M().y().S().e().c().r().e().t().K().e().y()).

In order to automatically comply with the new API guide lines (which says that you should start any non-type with a lowercase letter), the importer transforms the functions for uppercased letters to lowercase, which conflicts with the lowercase letter functions.

Unfortunately, because of the typical length of keys put through your code, the Swift compiler spins into a deep loop and never finishes compiling.

To read more about the change, see https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md and search for Lowercase values.

Side note: Because you expose the letter functions as functions instead of properties, they become almost unreadable in Swift (any version). It seems a simple solution to change them from e.g. - (NSString *)a; to @property(readonly, copy) NSString *a;, which would make Swift read the same as ObjC.

fizker avatar Sep 17 '16 15:09 fizker