Re: [swift-users] Codable Range in Xcode 9 playground

2017-10-20 Thread Thierry Passeron via swift-users
ent Royal-Gordon <br...@architechies.com> wrote: > >> On Oct 17, 2017, at 10:00 AM, Thierry Passeron via swift-users >> <swift-users@swift.org> wrote: >> >> Hi everyone, >> >> In the process of familiarising myself with Encodable/Decodable prot

[swift-users] Codable Range in Xcode 9 playground

2017-10-17 Thread Thierry Passeron via swift-users
Hi everyone, In the process of familiarising myself with Encodable/Decodable protocols I was trying to apply it to the Range struct in order to persist a Range in CoreData records. However, I seem to hit the wall with it and keep getting errors. This happens in the Xcode 9.0.1 playground, not

Re: [swift-users] ThreadSanitizer: data race

2017-07-26 Thread Thierry Passeron via swift-users
Thanks Devin, that was the problem! After initialising with the recursive type attribute, it is now working. This list is my saviour. Thank you guys! I hope I can make it up to you someday. > Le 25 juil. 2017 à 22:37, Devin Coughlin a écrit : > > pthread_mutex_init(, nil)

[swift-users] ThreadSanitizer: data race

2017-07-25 Thread Thierry Passeron via swift-users
Hi everyone, I don’t know if it’s the good place to ask for this, so if it’s not, please be kind enough to tell me where I should post this question. I’m having a hard time figuring out why, since I activated ThreadSanitizer to my Xcode 9 scheme, I keep seeing race conditions when using

Re: [swift-users] UserDefaults with generic keys

2017-07-07 Thread Thierry Passeron via swift-users
ension DefaultsKeys { > static let version = DefaultsKey("version") > } > > let defaults = UserDefaults.standard > defaults.set(.version, to: "1.0") > let version = defaults.get(.version) > print(version ?? "N/A") > ``` > > On Fri, 7 Ju

[swift-users] UserDefaults with generic keys

2017-07-07 Thread Thierry Passeron via swift-users
Hi Everyone, Using Swift 3.1, I was wondering if I could come up with something largely inspired by Notification.Name to help me deal with UserDefaults so I started by doing something like: public struct DefaultsKey: RawRepresentable, Equatable, Hashable, Comparable { public var rawValue:

[swift-users] Migrating to Swift 3 Dispatch

2016-10-16 Thread Thierry Passeron via swift-users
Hello All, I’m in the process of migrating older code to Swift 3 and I’m stuck on this one. How do you create a timer dispatch source? Old code: let source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue) dispatch_source_set_timer(source, dispatch_time(DISPATCH_TIME_NOW, 0),