Converting Int to Bool

No, there is and has never been an explicit built in option for conversion of Int to Bool, see the language reference for Bool for details. There exists, still, however, an initializer by NSNumber. The difference is that implicit bridging between Swift numeric type and NSNumber has been removed in Swift 3 (which previously allowed … Read more

How can I decode JWT (JSON web token) token in Swift?

If you are okay with using a library i would suggest this and then import the library import JWTDecode and execute. let jwt = try decode(jwt: token) Since you didn’t want to include this library i brought out the needed parts to make it work. func decode(jwtToken jwt: String) -> [String: Any] { let … Read more

Type ‘NSAttributedStringKey’ (aka ‘NSString’) has no member ‘font’

Note: Ensure swift language version of your project. Here is how you can see/check your swift language version. You have two options as solution to your query: If your project has Swift versio 4.0 – You should choose/download POD compatible to your project’s swift language (Share me POD info and swift version, so I can … Read more

Read JSON file with Swift 3

Your problem here is that you force unwrap the values and in case of an error you can’t know where it comes from. Instead, you should handle errors and safely unwrap your optionals. And as @vadian rightly notes in his comment, you should use Bundle.main.url. private func readJson() { do { if let file = … Read more