Re: Convert CGFloat to NSNumber
Re: Convert CGFloat to NSNumber
- Subject: Re: Convert CGFloat to NSNumber
- From: Marco S Hyman <email@hidden>
- Date: Tue, 24 Feb 2015 10:43:12 -0800
> On Feb 24, 2015, at 10:16 AM, Quincey Morris <email@hidden> wrote:
>
> The following work, too (Xcode 6.1.1):
>
> let f1: NSNumber = font.pointSize
> let f2 = font.pointSize as NSNumber
>
> ...
>
> (Things may have changed in Swift 1.2, though.)
>
Works fine in 1.2, too.
$ swift
Welcome to Swift version 1.2. Type :help for assistance.
1> import Foundation
2> let f0: CGFloat = 42.0
f0: CGFloat = 42
3> let f1: NSNumber = f0
f1: NSNumber = Double(42)
4> let f2 = f0 as NSNumber
f2: NSNumber = Double(42)
Marc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden