In moving a hybrid project from Swift 3 to 4, I’ve run into some issues 
from my Objective-C code. I’ve been able to conditionalize my Swift code for 
both versions pretty easily, but there are APIs imported from Objective-C that 
need to change definition for Swift 4. Is there anyway, in preprocessor or at 
runtime, to detect what version of Swift the Objective-C is being imported 
into? It’s as simple as a typedef for NSAttributedString attributes 
dictionaries that needs a different generic type in Swift 3 vs. Swift 4. 
Browsing the documentation I don’t see anything, but I’m guess some such method 
exists, given Apple’s APIs can do so. This would only be a temporary situation 
until the move the Swift 4 can be completed.



Jon Shier
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to