Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Rien via swift-users
Facepalm! Of course!, thanks for clearing that up! I will file a bug report for the diagnostics. Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Balancingrock Project: http://swiftfire.nl > On 04 Feb 2017, at 02:14, Jordan Rose wro

[swift-users] unsafeBitCast to Unimplemented Class

2017-02-03 Thread Saagar Jha via swift-users
Hello, I’m having an issue migrating some old Objective-C code that looks like this: @implementation Foo - (void)load { // Swizzle one of Bar’s methods to call Foo’s baz method } - (void)baz { [self baz]; if ([self isKindOfClass:NSClassFromString(@“Bar”)]) {

Re: [swift-users] [swift-evolution] for-else syntax

2017-02-03 Thread Howard Lovatt via swift-users
Why not add to the library: extension Sequence { func forEach(_ eacher: (Iterator.Element) throws -> Void, elser: () throws -> Void) rethrows { var hasIterated = false for element in self { hasIterated = true try eacher(element) } guard h

Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Jordan Rose via swift-users
Interesting. I actually see two errors: /Users/jrose/Desktop/SwifterJSON/App/AppDelegate.swift:19:18: error: ambiguous operator declarations found for operator json["root"] &= 4 ^ :0: note: found this matching operator declaration :0: note: found this matching operator declar

Re: [swift-users] Swift 101: JSON or XML?

2017-02-03 Thread Jens Alfke via swift-users
> On Feb 3, 2017, at 5:00 AM, Roy Henderson via swift-users > wrote: > > I would welcome guidance regarding whether I should use JSON or XML to store > the data on the web server? The effort to generate either format will be > similar so my real decision driver is on the client side. Probabl

Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Rien via swift-users
This is the “defining” package/module: https://github.com/Balancingrock/SwifterJSON For the consuming package simply generate a new executable and put the following in main.swift: import SwifterJSON // Note: Error disappears when the line below is un-commented // infix operator &= var json

Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Jordan Rose via swift-users
The operator itself. If you’re not seeing that behavior, that’s a bug! Do you have a small test case that reproduces it? (I guess it would take two modules regardless, so either a SwiftPM package or an Xcode project would do it.) Jordan > On Feb 3, 2017, at 09:34, Rien wrote: > > Are you refe

Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Rien via swift-users
Are you referring to the definition of the operator (infix…) or the availability of the function that defines the operator? The functions are available, but I have to repeat the “infix…" everywhere I need them. I.e. I have a: infix operator &= And when I use that from another module I get “Op

Re: [swift-users] Custom operators in a framework

2017-02-03 Thread Jordan Rose via swift-users
Operator declarations are actually public all the time, not internal. That’s itself probably a bug, but not the world-limiting one you’re concerned about. Jordan > On Feb 3, 2017, at 01:18, Rien via swift-users wrote: > > It is possible to define custom operators in a framework, but it is not

Re: [swift-users] Debugger woes

2017-02-03 Thread Jim Ingham via swift-users
> On Feb 3, 2017, at 6:55 AM, Maury Markowitz wrote: > >> On Jan 31, 2017, at 1:59 PM, Jim Ingham wrote: >> >> From the symptoms, it looks like the compiler is not holding onto >> "background" because it is no longer used. That's a desirable thing to do >> for optimized code, but not at -O0

Re: [swift-users] Swift 101: JSON or XML?

2017-02-03 Thread Maury Markowitz via swift-users
Technically there is little to chose one over the other. I find working with JSON on Swift is somewhat easier than XML however, and that should not be a minor consideration. However, moving forward it seems that JSON will be more widely used and basing your comms on that is likely a very good i

Re: [swift-users] Swift 101: JSON or XML?

2017-02-03 Thread Rien via swift-users
I do not think there is a ‘best’ answer. I would go with JSON though. Apple’s JSON solution is fast, but it has some minor limitations and usability is not “up there”. Then again there are third party solutions, for example my own SwifterJSON single-class framework that you can download from g

Re: [swift-users] Swift 101: JSON or XML?

2017-02-03 Thread Saagar Jha via swift-users
Either should be fine, but in my experience JSON is a lot easier to work with due as compared to XML since JSONSerialization being simpler than XMLParser. Saagar Jha > On Feb 3, 2017, at 5:00 AM, Roy Henderson via swift-users > wrote: > > Hi, > > I'm about to develop my first non-trivial (fo

Re: [swift-users] Debugger woes

2017-02-03 Thread Maury Markowitz via swift-users
> On Jan 31, 2017, at 1:59 PM, Jim Ingham wrote: > > From the symptoms, it looks like the compiler is not holding onto > "background" because it is no longer used. That's a desirable thing to do > for optimized code, but not at -O0. > > What happens if you rewrite this to: > >

[swift-users] Swift 101: JSON or XML?

2017-02-03 Thread Roy Henderson via swift-users
Hi, I'm about to develop my first non-trivial (for me) Swift 3 app. It will retrieve data from a web server and present it on an iOS device. I would welcome guidance regarding whether I should use JSON or XML to store the data on the web server? The effort to generate either format will be sim

Re: [swift-users] [swift-evolution] for-else syntax

2017-02-03 Thread Jeremy Pereira via swift-users
> On 2 Feb 2017, at 20:12, Erica Sadun via swift-users > wrote: > > I've taken this over to Swift Users from Swift Evolution. > > I think you'd want to handle the exceptional case first, Although it is the way I would do it for an array, sometimes you don’t know that a sequence is empty unti

[swift-users] Custom operators in a framework

2017-02-03 Thread Rien via swift-users
It is possible to define custom operators in a framework, but it is not possible to assign access levels to them. As a consequence they are module internal and cannot be used outside the framework. Each project needs to redefine the custom operators in order to use them in that project. What