I don’t think this has anything to do with Swift 3. I ran your code in a newly-created app here in my office and it worked just fine.
If you’re getting back nil for
ubiquityIdentityToken it’s likely that either:
Your app is not set up for iCloud, or
iCloud is not set up on your device properly
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"