[swift-users] NSData vs Data write to string differently?

2016-09-22 Thread Robert Nikander via swift-users
Hi, I’ve run into a problem when updating to new Swift in Xcode 8. There was some NSData in a string like this: “ … \(data) … “ It changed to type `Data`, and the string went from hexadecimal bytes to writing “20 bytes”. I’m doing a quick bug fix app release now. I can’t remember if

[swift-users] wishing I could cast (sort of) to protocol with associated type

2016-11-02 Thread Robert Nikander via swift-users
Hi, In the following code, I want to test if x is a `SpecialController`. If it is, I want to get the `currentValue` as a `SpecialValue`. How do you do this? If not with a cast, then some other technique. I understand the error, and that SpecialController by itself is not a simple type to cast

[swift-users] Array not Encodable - error at runtime, not compile time?

2017-10-26 Thread Robert Nikander via swift-users
Hi, This error makes perfect sense, but I’m surprised it's a runtime error. I expected it at compile time. Am I doing something wrong? Is this on the type system to-do list? let c = JSONEncoder() struct Foo { … } let fs: [Foo] = [ Foo(...) ] let data = try! c.encode(fs) // Didn’t

Re: [swift-users] Array not Encodable - error at runtime, not compile time?

2017-10-26 Thread Robert Nikander via swift-users
ion Array : Decodable where Element : Decodable. > At the moment, this isn’t possible, so Array is unconditionally Codable and > the failure happens at runtime. This will be a compile-time error in a future > version of Swift. > > — Itai > > On 26 Oct 2017, at 9:47