Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

With Xcode-beta 3 it doesn't compile #31

Closed
pbrewczynski opened this issue Jul 16, 2014 · 6 comments
Closed

With Xcode-beta 3 it doesn't compile #31

pbrewczynski opened this issue Jul 16, 2014 · 6 comments
Labels

Comments

@pbrewczynski
Copy link

There are some errors related to the optionals , probably due to api changes.

@erswelljustin
Copy link

I have found this as well the error I am getting is

'String' is not a subtype of 'DictioanryIndex<NSObject, AnyObject>'

on the following lines in ChatViewController.swift

let frameNew = userInfo[UIKeyboardFrameEndUserInfoKey].CGRectValue()
let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey].doubleValue
let frameNew = userInfo[UIKeyboardFrameEndUserInfoKey].CGRectValue()

Can someone show how to fix this as I have done some googling and I cannot find a solution as swift in Xcode Beta 3 is relatively new

@pbrewczynski
Copy link
Author

@erswelljustin

You can investigate problem (I unfortunately don't have a time):

Try conditionally unwrapping:

let frameNew = userInfo[UIKeyboardFrameEndUserInfoKey]?.CGRectValue()

And be careful since frameNew would be by this moment the optional value.

And then probably you can unwrap the value (in the following code) since your are sure that there have to be value for that key in dictionary.

I'm kind of not sure how it could pass in earlier version of Xcode since Dictionaries should return optionals

@matsuokashuhei
Copy link

@erswelljustin

I did

let frameNew = (userInfo[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()
let duration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as NSNumber).doubleValue
let frameNew = (userInfo[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue()

Let's try

@ma11hew28
Copy link
Member

Thanks, all. @matsuosh your solution seems to work. I pushed a fix. Thanks!

@matsuokashuhei
Copy link

@mattdipasquale
I have learned a lot in your app.
I will be glad if I was of any help.

@ma11hew28
Copy link
Member

@matsuosh I'm glad to hear that. Thank you for the positive feedback and for checking out this project. I learned a lot myself while building it, and still, I'm sure there are many more improvements to be made. And, I'm sure we both still have more to learn and to teach each other. I look forward to learning more from you and to sharing what I learn with you and others. Best wishes to you, my friend! :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants