Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread somu subscribe via swift-users
Also noticed that when Xcode prompts to fill the missing case statements, it fills it with the deprecated TouchID case statements (in an iOS 11 project). > On 5 Nov 2017, at 5:14 PM, Dennis Weissmann via swift-users > wrote: > > Hi Charles, > > You are right (the

Re: [swift-users] How can I set NSButton's keyEquivalent to the Escape key?

2017-11-02 Thread somu subscribe via swift-users
Or you could try "\\E" Thanks and regards, Muthu > On 3 Nov 2017, at 12:01 AM, C. Keith Ray via swift-users > wrote: > > try "\u{1b}" > > -- > C. Keith Ray > Senior Software Engineer / Trainer / Agile Coach > *

Re: [swift-users] KVC - KeyPath in Operation

2017-10-28 Thread somu subscribe via swift-users
n 15 Jun 2017, at 10:27 am, Tony Parker via swift-users >>>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >>>> >>>> Hi Somu, >>>> >>>> You can certainly file a bug for us. It may be something we are alre

Re: [swift-users] Initialization Catch-22?

2017-09-25 Thread somu subscribe via swift-users
Hi Kenny, You could use a lazy var and initialise it with a closure. class PDAudioPlayer { //Would be created lazily when first invoked lazy var mQueue : AudioQueueRef = { //create an audioQueue and return that instance return audioQueue }() } Thanks and regards,

Re: [swift-users] Generics with Protocols - Separate files

2017-09-17 Thread somu subscribe via swift-users
AM, somu subscribe via swift-users > <swift-users@swift.org> wrote: > > Hi, > > When using Generics with Protocols I get a compilation error depending on > whether or not conformance to a protocol is defined in the same file or not. > > Error: > Type 'Car.It

[swift-users] Generics with Protocols - Separate files

2017-09-16 Thread somu subscribe via swift-users
Hi, When using Generics with Protocols I get a compilation error depending on whether or not conformance to a protocol is defined in the same file or not. Error: Type 'Car.ItemID' (aka 'CarID') does not conform to protocol 'P2' I have 2 swift files: - CarID.swift - CreateCars.swift

Re: [swift-users] Swift 4 "Cannot use mutating member on immutable value: 'self' is immutable"

2017-09-13 Thread somu subscribe via swift-users
Not sure why it is happening, but given below are my observations: Simplified version: var array = [1, 2, 3, 4, 5] _ = array.popFirst() //error: cannot use mutating member on immutable value: 'array' is immutable _ = array.popLast() //works ok popFirst is not available in the Array

Re: [swift-users] Memory Address of value types and reference types

2017-09-12 Thread somu subscribe via swift-users
10b86c8) Thanks and regards, Muthu > On 13 Sep 2017, at 5:12 AM, Jordan Rose <jordan_r...@apple.com> wrote: > > > >> On Sep 12, 2017, at 10:20, Andrew Trick via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> &

Re: [swift-users] Memory Address of value types and reference types

2017-09-12 Thread somu subscribe via swift-users
lt;atr...@apple.com> wrote: > >> >> On Sep 12, 2017, at 9:55 AM, somu subscribe via swift-users >> <swift-users@swift.org> wrote: >> >> Hi Quinn, >> >> Thanks for the reply, >> >> It is an iOS Swift project (uses Foundation

[swift-users] Memory Address of value types and reference types

2017-09-12 Thread somu subscribe via swift-users
Hi, I would like to know the correct way to get the memory address of value types and reference types. Given below are the attempts made. class C {} struct S {} let c1 = C() var s1 = S() var s2 = s1 //Reference type: print("c1 address: \(Unmanaged.passUnretained(c1).toOpaque())") //Is this

Re: [swift-users] Generic inheritance with where clause

2017-08-29 Thread somu subscribe via swift-users
Hi Nikita, See if the below implementation fits your needs: protocol P1 {} protocol P2 : P1 where T : P1 { associatedtype T var input : T { get } } struct S1 : P1 {} struct S2 : P2 { typealias T = S1 var input: T } Regards, Muthu > On 30 Aug 2017, at

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-30 Thread somu subscribe via swift-users
). Thanks and regards, Muthu > On 31 Jul 2017, at 4:27 AM, Hooman Mehr <hoo...@mac.com> wrote: > >> >> On Jul 24, 2017, at 2:38 AM, somu subscribe via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> Th

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-30 Thread somu subscribe via swift-users
on requires exclusive access. > } > } > } > > Zhao Xin > > On Mon, Jul 24, 2017 at 4:22 PM, Quinn "The Eskimo!" via swift-users > <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: > > On 24 Jul 2017, at 07:04, somu subscr

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-24 Thread somu subscribe via swift-users
Thanks Joanna Carter, sorry forgot to mention it uses generics, so would contain associatedtype if protocol is used. Is the below mentioned approach the usual way to hide implementation details or is there a better approach ? With this approach, I had to pass functions of C1 as closures into

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-24 Thread somu subscribe via swift-users
(hiding implementation details) normally tackled using Helper class (or struct) or is there a more better approach ? Thanks and regards, Muthu > On 24 Jul 2017, at 4:14 PM, Quinn The Eskimo! via swift-users > <swift-users@swift.org> wrote: > > > On 24 Jul 2017, at 07:0

[swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-24 Thread somu subscribe via swift-users
Hi, I am having trouble with the below mentioned code. It crashes in Xcode 9.0 beta 3 (9M174d) but doesn’t crash in Xcode 8.3.3 (8E3004b) Observations in Xcode 9: - When Car is changed into a struct and test is made to be mutating, it doesn’t crash - When Helper is changed to class, it

Re: [swift-users] Filling two type parameters with the same type

2017-07-08 Thread somu subscribe via swift-users
Hi Taylor, If both Source and Displacement are going to be Noise, you could use just one placeholder type. class Noise {} struct DistortedNoise where Item:Noise { let source:Item, displacement:Item init(source:Item, displacement:Item) { self.source = source

Re: [swift-users] Decode a JSON object of unknown format into a Dictionary with Decodable in Swift 4

2017-06-18 Thread somu subscribe via swift-users
Create a struct for Metadata and conform to Coding Code: let string = """ { "id": "4yq6txdpfadhbaqnwp3", "email": "john@example.com", "name":"John Doe", "metadata": { "link_id": "linked-id", "buy_count": 4 } } """ let data = string.data(using: .utf8)! //Force unwrapping

Re: [swift-users] KVC - KeyPath in Operation

2017-06-14 Thread somu subscribe via swift-users
> tracking or already fixed, but the bug report will let us double check that. > > Thanks, > - Tony > >> On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users >> <swift-users@swift.org> wrote: >> >> Thanks a lot Jordan for pointing out the r

Re: [swift-users] KVC - KeyPath in Operation

2017-06-13 Thread somu subscribe via swift-users
nstead > of storing to a private property. > > Hope that helps, > Jordan > > >> On Jun 13, 2017, at 06:40, somu subscribe via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> Hi, >> >> I am hav

[swift-users] KVC - KeyPath in Operation

2017-06-13 Thread somu subscribe via swift-users
Hi, I am having trouble using KeyPath to KVC (Key Value Code) in Swift 4. I have a subclass of Operation and I am overriding the isFinished and isExecuting property. Problem: - When I use KeyPath, the completionBlock of the operation is not invoked. - However when I use String instead of