-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swift3 conversion #11
base: master
Are you sure you want to change the base?
Conversation
thanksss!!!!!!!!!! |
Thanks! Bro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now is a good time to handle optional unwrapping properly.
@@ -58,22 +55,22 @@ class GATracker { | |||
#endif | |||
|
|||
self.tid = tid | |||
self.appName = NSBundle.mainBundle().infoDictionary!["CFBundleName"] as! String | |||
let nsObject: AnyObject? = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"] | |||
self.appName = Bundle.main.infoDictionary!["CFBundleName"] as! String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should handle this conditional properly.
self.appName = NSBundle.mainBundle().infoDictionary!["CFBundleName"] as! String | ||
let nsObject: AnyObject? = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"] | ||
self.appName = Bundle.main.infoDictionary!["CFBundleName"] as! String | ||
let nsObject: AnyObject? = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as AnyObject? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here.
let nsObject: AnyObject? = Bundle.main.infoDictionary["CFBundleShorVersionString"] as? AnyObject
should do the job.
let language = NSLocale.preferredLanguages().first | ||
if language?.characters.count > 0 { | ||
let language = NSLocale.preferredLanguages.first | ||
if (language?.characters.count)! > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe if (language?.characters.count ?? 0) > 0
?
@@ -111,7 +108,7 @@ class GATracker { | |||
else { | |||
if (error != nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionals should not be handled like this. Use if let error = error
or some other optional binding mechanism.
@@ -111,7 +108,7 @@ class GATracker { | |||
else { | |||
if (error != nil) { | |||
#if DEBUG | |||
print(error!.description) | |||
print(error!.localizedDescription) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proper handling will help you get rid of this forced-unwrapping usage.
conversion to swift3