Re: [swift-users] Cannot pass immutable value as inout argument

2018-01-16 Thread Roderick Mann via swift-users
Xcode can't properly parse the C header to show me the Swift signature, but if I try calling it like this: let p = lgs_notify_params_t(notify: lgs_notify_did_enter_background) lgs_notify(self.ctx, p) I get this error: Cannot convert value of type 'lgs_notify_params_t' to expected argume

Re: [swift-users] .apinotesc file placement?

2017-11-29 Thread Roderick Mann via swift-users
> On Nov 29, 2017, at 16:23 , Jonathan Prescott wrote: > > As a general question since I’m just getting into Swift frameworks, could the > framework architecture not be right? When I build a > non-Swift(C/C++/Obj-C/Obj-C++/other language/etc) based framework using Xcode > to build the frame

Re: [swift-users] Modulo operation in Swift?

2017-11-09 Thread Roderick Mann via swift-users
Ah, I see. So, here's my issue. I recently ported some C code for satellite position prediction to Swift. This code used fmod() a lot. I had thought fmod() was just % for floats, but I see now it's not. What is truncatingRemainder in all this? It would be great if there were a documentation se

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

2017-09-15 Thread Roderick Mann via swift-users
> On Sep 13, 2017, at 18:59 , Jon Shier wrote: > > I think there’s something strange with popFirst. It doesn’t show up in > the autocomplete in Xcode, but it compiles, and popLast doesn’t throw the > same error. removeFirst doesn’t either, though it’s unsafe. Weird. extension Array {

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

2017-09-13 Thread Roderick Mann via swift-users
Yeah, that's not it. I made the change you suggested, I get the same error. > On Sep 13, 2017, at 18:11 , Zhao Xin wrote: > > Change `self` to `ModelFetcher`. You are calling a class static property, not > a class instance property. > > Zhao Xin > > On Thu, Sep 14, 2017 at 8:37 AM, Rick Mann

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

2017-09-13 Thread Roderick Mann via swift-users
Did this change in Swift 4? I like being able to refer to the class in a class func as "self". If I ever change the name of the class, or refactor the code, or something, I don't have to change it in a bunch of places. > On Sep 13, 2017, at 18:11 , Zhao Xin wrote: > > Change `self` to `ModelF

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

2017-09-13 Thread Roderick Mann via swift-users
Also, it works fine at a couple of other call sites. Why is this one special? > On Sep 13, 2017, at 18:11 , Zhao Xin wrote: > > Change `self` to `ModelFetcher`. You are calling a class static property, not > a class instance property. > > Zhao Xin > > On Thu, Sep 14, 2017 at 8:37 AM, Rick Man

Re: [swift-users] dynamic requires @objc in Framework, but not in monolithic project

2017-09-13 Thread Roderick Mann via swift-users
Ah. That's the difference. Okay. Nevertheless, the Apple docs on the matter are unclear at best (https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html): "Declarations marked with the dynamic modifier must also be explicit

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 14:05 , Philippe Hausler wrote: > > > >> On Jun 26, 2017, at 1:47 PM, Roderick Mann wrote: >> >>> >>> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: >>> >>> Rats, I was hoping that one of the reasons about being so explicit what >>> we’re going to access and wher

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. > > In that case, the simplest way to do it is prob

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
> On Jun 26, 2017, at 10:20 , Charles Srstka wrote: > > Rats, I was hoping that one of the reasons about being so explicit what we’re > going to access and where with bindMemory() and friends would be to take care > of these sorts of issues. > > In that case, the simplest way to do it is prob

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-26 Thread Roderick Mann via swift-users
Thanks, I'll give that a try. > On Jun 25, 2017, at 23:11 , Charles Srstka wrote: > >> On Jun 26, 2017, at 12:00 AM, Roderick Mann via swift-users >> wrote: >> >> I mean, it's as straightforward as my example. I have a Data of arbitrary >> size

Re: [swift-users] Extracting arbitrary types (e.g. UInt16) out of Data

2017-06-25 Thread Roderick Mann via swift-users
I mean, it's as straightforward as my example. I have a Data of arbitrary size (anywhere from 3 to 29 bytes, let's say). The last two bytes form a UInt16 CRC. I need to get those last two out and compare them against the CRC I compute for the rest of the bytes. Having said that, I just used wit

Re: [swift-users] Bool to Int

2016-11-21 Thread Roderick Mann via swift-users
> On Nov 21, 2016, at 13:14 , Nevin Brackett-Rozinsky > wrote: > > I don’t see what there is to be confused about. > > A “literal” is literally a bunch of characters in source code. The compiler > interprets those characters as representing whatever type is appropriate to > the context. > >

Re: [swift-users] Argument type 'Int' does not conform to expected type 'AnyObject'

2016-09-09 Thread Roderick Mann via swift-users
> On Sep 9, 2016, at 15:46 , Joe Groff wrote: > > >> On Sep 9, 2016, at 2:02 PM, Kevin Nattinger via swift-users >> wrote: >> >> You’ll need to explicitly add the “as NSNumber” now. >> >> https://github.com/apple/swift-evolution/blob/master/proposals/0072-eliminate-implicit-bridging-convers