Re: How to get a value in Swift?
Re: How to get a value in Swift?
- Subject: Re: How to get a value in Swift?
- From: Roland King <email@hidden>
- Date: Sat, 12 Jul 2014 17:51:06 +0800
Nothing to do with Swift, NSValue *doesn't* convert to CGRect, nor does NSValue have a size member nor does it have a rectValue method.
If you use CGRectValue(), which is the method listed in the documentation for iOS which is what you’re using, you’ll do a whole lot better.
Why there’s no autocomplete which shows the choices I have no idea, autocomplete in Swift is a bit hit or miss it seems, especially inside closures.
Why is this on the Xcode list by the way - all this stuff is Cocoa, you should be posting there.
> On 12 Jul 2014, at 4:19 pm, Gerriet M. Denkmann <email@hidden> wrote:
>
> keyBrd = center.addObserverForName( UIKeyboardWillShowNotification, object: nil, queue: mainQueue )
> { (b : NSNotification! ) in
>
> let userInfo = b!.userInfo as NSDictionary
>
> let rectEnd = userInfo[UIKeyboardFrameEndUserInfoKey] as NSValue
> println("rectEnd \(rectEnd)")
> // rectEnd NSRect: {{0, 264}, {320, 216}}
>
> //let rectEnd2 = rectEnd as CGRect
> // 'NSValue' is not convertible to 'CGRect'
>
> //let h = rectEnd.size.height
> // 'NSValue' does not have a member named 'size'
>
> //let v = rectEnd.rectValue
> // 'NSValue' does not have a member named 'rectValue'
>
> // what now?
> }
>
> How do I get the height of my rect?
>
>
> And a completely unrelated question:
>
> let a = ...
> println("a is of Class: \( what goes here?)")
>
> How to I get (at runtime) the class of some object?
>
> Gerriet.
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden