Re: [swift-users] file io in Swift 2.2 for Linux (would like to be pointed in the right direction)

2016-05-20 Thread Maury Markowitz via swift-users
> On May 20, 2016, at 4:16 AM, Quinn The Eskimo! via swift-users > wrote: > I disagree. One-shot file system APIs make sense for a lot of reasons: I do most of my programming in .Net, where streams are the primary IO system. Even simple tasks often require multiple objects and loops copying da

[swift-users] #selector with Swift 3?

2016-06-17 Thread Maury Markowitz via swift-users
I was asked to try out the latest betas of Cocoa to check if a SceneKit bug I reported has been fixed. As part of this I decided to try an update to Swift 3. I've run into a number of minor issues, but one has me frustrated. In my menu validate method, I have: switch menuItem.ac

[swift-users] See documentation comment for discussion

2016-06-17 Thread Maury Markowitz via swift-users
I've previously used myString[0...1] to get the first character of a string. I assume that is now myString[0..<2]? In any event, the error states: 'subscript' is unavailable: cannot subscript String with a CountableClosedRange, see the documentation comment for discussion What documentation is

Re: [swift-users] #selector with Swift 3?

2016-06-17 Thread Maury Markowitz via swift-users
> On Jun 17, 2016, at 1:31 PM, Brent Royal-Gordon > wrote: > tl;dr: Write this instead: > > case #selector(showRescale)?: Tried that too, it causes another error: /Developer/SwiftNEC 3/SwiftNEC/CardViews.swift:139:28: Expected ':' after 'case' Here are the formats I have tried; all

Re: [swift-users] See documentation comment for discussion

2016-06-19 Thread Maury Markowitz via swift-users
> On Jun 17, 2016, at 10:38 PM, Brent Royal-Gordon > wrote: > The standard library includes definitions of these subscripts But how would one select those in the Xcode UI? The documentation doesn't link off the error (AFAIK) itself, only the code. So one could select, say, the var the error is

Re: [swift-users] See documentation comment for discussion

2016-06-20 Thread Maury Markowitz via swift-users
On Jun 19, 2016, at 10:45 PM, Marco S Hyman wrote: > As for your subscript... in the code "mystring[0...1]” [0...1] is not a > Range, it is a CountableClosedRange. But that doesn't explain why it works fine under Swift 2.2, which is the basis of the question. The change does not appear to be t

Re: [swift-users] Swift to Javascript

2016-06-22 Thread Maury Markowitz via swift-users
> On Jun 22, 2016, at 12:44 AM, Mr Bee via swift-users > wrote: > > Hi all, > > I wish I will be able write web app using Swift instead of JavaScript. It > would be wonderfull if we could develop desktop app, mobile app, server-side > app, and web app, all using Swift. It will be complete.

Re: [swift-users] Performance critical code in Swift

2016-10-02 Thread Maury Markowitz via swift-users
> On Oct 1, 2016, at 4:50 PM, Игорь Никитин via swift-users > wrote: > > For such of tasks C (or maybe C++) is a good choice. But how can Swift do > this as fast as C? > Of course I need to use low level C I/O api, but there are another things > that I need to know? All things considered, the

Re: [swift-users] Dimensional analysis

2016-11-30 Thread Maury Markowitz via swift-users
Let me add my support for this as well. I am currently using a bridge version of: https://github.com/unixpickle/Expressions And it works quite well. But I think a pure Swift implementation, especially with dimensional analysis, would be useful to a great number of people. __

[swift-users] Bug? Bad behaviour?

2016-12-02 Thread Maury Markowitz via swift-users
Check out this line of code: if parts[2].characters.count > 0 { data["I3"] = Int(parts[2]) } This worked fine in 2.x, but in 3.0 it complains: Cannot subscript a value of type 'inout [String]' (aka 'inout Array') It took me a *long* time before I consider that the error was incorrect and found

[swift-users] Debugger woes

2017-01-31 Thread Maury Markowitz via swift-users
I hope this is the right place to ask this: I'm using Xcode Version 8.2.1 (8C1002) and I'm trying to find out what's going wrong in my Swift3 app. Here's the code: let background = sceneView.snapshot().cgImage! let cropped = background.cropping(to: overlayView.fra

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

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] for with optional collection?

2017-02-10 Thread Maury Markowitz via swift-users
> On Feb 10, 2017, at 10:04 AM, Tino Heth via swift-users > wrote: > > for i in? test { > print(i) > } > > Imho looks even better, but this would need an extension of the language > itself… Oh, yes please! Please post on evolution. ___ swift-

Re: [swift-users] JSON keys survey

2017-06-24 Thread Maury Markowitz via swift-users
> On Jun 23, 2017, at 12:42 PM, Tony Parker via swift-users > wrote: > > Hi all, > > This has come up a few times in recent threads, and I wanted to gather some > additional info on your real world use cases. Just reply to me, and any input > is appreciated: > > 1. Does your JSON use snake_c

Re: [swift-users] Class vs Structures

2017-06-30 Thread Maury Markowitz via swift-users
> On Jun 29, 2017, at 2:42 PM, Taylor Swift via swift-users > wrote: > > When in doubt, go with a struct. Probably nineteen types out of twenty I > write are structs. The the 20th is likely when you're using one of Obj-C's features, like KVO. ___ s

[swift-users] pattern matching in if improvement?

2016-03-26 Thread Maury Markowitz via swift-users
Before I stick my head into the other list, consider: if statusCode >= 200 && statusCode <= 299 I'm sure examples of something like this occur throughout your code. But the actual semantics of the test is hidden here, you're really testing if statusCode lies within a range. Swift 2.0 has a c

Re: [swift-users] pattern matching in if improvement?

2016-03-27 Thread Maury Markowitz via swift-users
> On Mar 26, 2016, at 7:13 PM, Erica Sadun wrote: > > if 200...299 ~= statusCode { print("within 200-299") } Yes, I should have touched on this one too. My concern here is one of the concerns of the case version, it's cart before the horse. General programming practice for tests is something l

[swift-users] Replacement for NSNumber?

2016-04-11 Thread Maury Markowitz via swift-users
I have a primary data structure that is currently defined such: var data: [String: NSNumber] This is the only place in my app where I use a Foundation type *as* a Foundation type (as opposed to a bridge), and I would strongly prefer this to be purely Swift types. I used NSNumber because the or