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 `default` case would not cat

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 > * http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf >

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

2017-10-28 Thread somu subscribe via swift-users
wrote: >>>> >>>> Hi Somu, >>>> >>>> You can certainly file a bug for us. It may be something we are already >>>> tracking or already fixed, but the bug report will let us double check >>>> that. >>>> >&

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, Mu

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

2017-09-17 Thread somu subscribe via swift-users
> On 17 Sep 2017, at 10:55 AM, somu subscribe via swift-users > 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 'C

[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 Observatio

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 documentatio

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

2017-09-12 Thread somu subscribe via swift-users
6c8) Thanks and regards, Muthu > On 13 Sep 2017, at 5:12 AM, Jordan Rose wrote: > > > >> On Sep 12, 2017, at 10:20, Andrew Trick via swift-users >> mailto:swift-users@swift.org>> wrote: >> >>> >>> On Sep 12, 2017, at 9:55 AM, somu su

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

2017-09-12 Thread somu subscribe via swift-users
ote: > >> >> On Sep 12, 2017, at 9:55 AM, somu subscribe via swift-users >> wrote: >> >> Hi Quinn, >> >> Thanks for the reply, >> >> It is an iOS Swift project (uses Foundation, UIKit, CloudKit and other >> native frameworks) i

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

2017-09-12 Thread somu subscribe via swift-users
, Muthu > On 12 Sep 2017, at 10:35 PM, Quinn The Eskimo! via swift-users > wrote: > > > On 12 Sep 2017, at 13:44, somu subscribe via swift-users > wrote: > >> 1. Is the above shown the correct way to get reference type memory address ? >> 2. What Is it the cor

[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 c

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 1:25

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 wrote: > >> >> On Jul 24, 2017, at 2:38 AM, somu subscribe via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Thank a lot Quinn, your solution to use inout work

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

2017-07-30 Thread somu subscribe via swift-users
ss. > } > } > } > > Zhao Xin > > On Mon, Jul 24, 2017 at 4:22 PM, Quinn "The Eskimo!" via swift-users > mailto:swift-users@swift.org>> wrote: > > On 24 Jul 2017, at 07:04, somu subscribe via swift-users > mailto:swift-users@swift.org&g

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 He

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 > wrote: > > > On 24 Jul 2017, at 07:04, somu subscribe via swift-

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

2017-07-23 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 doesn’t

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 jus

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

2017-06-16 Thread somu subscribe via swift-users
>> wrote: >>> >>> Hi Somu, >>> >>> You can certainly file a bug for us. It may be something we are already >>> tracking or already fixed, but the bug report will let us double check that. >>> >>> Thanks, >>> - Tony >>

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

2017-06-14 Thread somu subscribe via swift-users
he bug report will let us double check that. > > Thanks, > - Tony > >> On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users >> wrote: >> >> Thanks a lot Jordan for pointing out the root cause. >> >> The underlying executing and finis

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

2017-06-13 Thread somu subscribe via swift-users
toring to a private property. > > Hope that helps, > Jordan > > >> On Jun 13, 2017, at 06:40, somu subscribe via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hi, >> >> I am having trouble using KeyPath to KVC (Key Value Co

[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 KeyPat