Literals in Swift do not inherently have a type (at least conceptually).
They are simply literals.
The compiler will interpret them as whatever ExpressibleBy_Literal type
is required to make the expression sensible.
There are default types which literals will become if no type information
is
Thanks for that follow up, I’m still a little confused at why one direction
works and the other does not, but I’m getting there.
I’ve found another issue I’ll bug report, but it’s along the same lines and
wanted to run it by this thread. If I have an NSDecimalNumber, in Swift, and
perform math
NSDecimal is not toll free bridged, but it does have a bridge to
NSDecimalNumber.
So take this for example:
@objc class Exam: NSObject {
var grade: Double = 90.0
}
It would be reasonable to expect that is exposed in objc as:
@interface Exam : NSObject
@property double grade;
@end
NSDecimal has toll-free bridging with NSDecimalNumber so you can still do as
casting when talking to an Objective-C API.
> On Nov 11, 2016, at 2:56 PM, Chris Anderson via swift-users
> wrote:
>
> Sure thing. Yeah, ideally the bridging would be fixed, but at the least,
Hi Chris,
Can you file a radar or JIRA for us on this? It looks like something should be
fixed in the documentation at least, or perhaps in the bridging.
- Tony
> On Nov 11, 2016, at 1:46 PM, Chris Anderson via swift-users
> wrote:
>
> I'm having problems with the
I'm having problems with the type conversion between a Swift `Decimal` and
an Objective C `NSDecimalNumber`.
If I have the Swift class:
@objc class Exam: NSObject {
var grade: Decimal = 90.0
}
And try to use that Swift class in Objective C,
Exam *exam = [[Exam alloc] init];