[swift-users] Generic type metadata pattern not found?

2016-06-11 Thread Jon Shier via swift-users
Swift Users: In preparation for an upcoming iOS app project I’m trying out some new project layout strategies. One of which is putting my network layer and custom UI elements in frameworks separate from my main app. I’ve done this with frameworks in my project, and then used CocoaPods to

[swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Jon Shier via swift-users
Swifters: It seems that in Xcode 8 beta 4, DispatchQueueAttributes was refactored to be DispatchQueue.Attributes but in the process lost the .serial attribute. How are we to create serial queues now? On a related note, where can we find the latest documentation for the Dispatch overlay?

Re: [swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Jon Shier via swift-users
Is it? I can’t tell by either the generated interface (default is not a useful value to expose) or a brief read of the Queue.swift file for it. Jon > On Aug 1, 2016, at 6:52 PM, Brent Royal-Gordon wrote: > >> On Aug 1, 2016, at 3:15 PM, Jon Shier via swift-users >> wrot

Re: [swift-users] Date and Data

2016-08-03 Thread Jon Shier via swift-users
If you think Date and Data look similar at a glance, wouldn’t NSDate and NSData? Or are you comparing this against your old Array type? > On Aug 3, 2016, at 6:33 PM, Travis Griggs via swift-users > wrote: > > I realize this ship has probably sailed a long while ago. I really like the > way th

[swift-users] Two Obj-C visible functions no longer overload?

2016-08-05 Thread Jon Shier via swift-users
Swifters: I’m attempting to update some library code to beta 4 and I’ve run into something that’s either a bug or a deliberate change. In a class that’s a Foundation.Operation subclass, there are two finish() functions: final func finish(_ receivedErrors: [Error] = []) { _finish(rece

[swift-users] SCNetworkReachabilityFlags beta 4 issue

2016-08-05 Thread Jon Shier via swift-users
Swifters: I’m attempting to port a library to Xcode 8 beta 4 and have run into a peculiar issue with SCNetworkReachabilityFlags. Prior to beta 4, this extension on SCNetworkReachabilityFlags which provided convenience Bool properties worked just fine: extension SCNetworkReachabilityFlag

Re: [swift-users] Two Obj-C visible functions no longer overload?

2016-08-08 Thread Jon Shier via swift-users
s and now we do. > > Jordan > > >> On Aug 5, 2016, at 14:57, Jon Shier via swift-users > <mailto:swift-users@swift.org>> wrote: >> >> Swifters: >> I’m attempting to update some library code to beta 4 and I’ve run into >> some

[swift-users] ProcessInfo arguments when running as a script?

2016-08-18 Thread Jon Shier via swift-users
Swift Users: I’m trying to parse the command-line arguments of a Swift 3 script using Xcode 8 beta 6. However, ProcessInfo’s arguments array now contains all of the swift compiler arguments as well as the command itself. For example, this script: #!/usr/bin/env swift import Foundation

Re: [swift-users] ProcessInfo arguments when running as a script?

2016-08-18 Thread Jon Shier via swift-users
ne (formerly Swift.Process, unrelated to ProcessInfo) should > have the script arguments only. > > Jordan > > >> On Aug 18, 2016, at 19:14, Jon Shier via swift-users >> wrote: >> >> Swift Users: >> I’m trying to parse the command-line argume

[swift-users] Capturing difference with typealias

2016-08-19 Thread Jon Shier via swift-users
Users: I’m updating more code to beta 6 and have noticed a strange difference when calling functions with closure parameters where that closure is declared with a typealias. Take this class: typealias Closure = () -> Void class Thing { var array: [String] = [] func doClosur

Re: [swift-users] Capturing difference with typealias

2016-08-19 Thread Jon Shier via swift-users
Another general question I have is how the self requirement in general has changed. I’m noticing several instances where my previous @noescape closures, which of course had that attribute removed, are now requiring self when they didn’t before and aren’t marked @escaping either. So I guess my qu

Re: [swift-users] Is 12:01:00A.M in DataFormatter.localizedString correct?

2016-08-29 Thread Jon Shier via swift-users
The ambiguity isn’t the 11 or 12 but what “midnight” refers to. If you say midnight the 30th, what time is that? That’s the issue the style guides are trying to clarify. Jon > On Aug 29, 2016, at 2:53 AM, Jens Alfke via swift-users > wrote: > > >> On Aug 28, 2016, at 10:19 PM, Michael Nisi

Re: [swift-users] Linux Swift: Strange bug found in a simple arithmetic

2016-09-07 Thread Jon Shier via swift-users
It’s related to this: http://www.cocoawithlove.com/blog/2016/07/12/type-checker-issues.html Jon > On Sep 7, 2016, at 11:32 AM, Lou Zell via swift-users > wrote: > > Also hoping someone more knowledgeable can explain why these seemingly simple > cases do in fact take so long! :) > __

Re: [swift-users] Swift 3 (Xcode 8 GM) issue with @escaping

2016-09-07 Thread Jon Shier via swift-users
Perhaps relatedly, it no longer seems possible to mark typealiased closures as @escaping. That was quite handy when you know that closures will always be used asynchronously. Jon > On Sep 7, 2016, at 6:15 PM, Shawn Erickson via swift-users > wrote: > > I should note that this issue also ap

Re: [swift-users] Issues with UITableView*

2016-09-12 Thread Jon Shier via swift-users
UITableView already has the notion of “selected rows” built in, so I’d suggest starting there. Jon > On Sep 12, 2016, at 6:41 PM, Ole Begemann via swift-users > wrote: > > > Hmm - interesting to know. Unfortunately, if I do that, then I get > > NO indication of selection when I click on ANY

[swift-users] Generic type for a generic type?

2016-09-20 Thread Jon Shier via swift-users
Swifters: I’m running into a type inference problem when attempting to pass a generic type which is generic to a generic type to a function which expects a generic type. I’ll explain: I have a function: func add(observer: Observer) where Observer.Procedure == Procedure Which I’m sendin

Re: [swift-users] find std lib doc

2016-10-12 Thread Jon Shier via swift-users
I’m guessing you only came to Apple’s developer environment with Swift? (If not I apologize.) The searchability and discoverability of anything on Apple’s dev site is rather low. You learn to live with it and use Google whenever you need to find something. (Which turns up the standard li

Re: [swift-users] Segmentation fault: 11 after updating codebase to Swift 3.0

2016-10-21 Thread Jon Shier via swift-users
With Swift 3 I’ve found these crashes to be indicative of an underlying source issue rather than something random in the compiler. When you get the crash, can you get the backtrace in the Xcode build log? Sometimes that has clues about what it was doing when it crashed. A lot of the time when th

Re: [swift-users] Segmentation fault: 11 after updating codebase to Swift 3.0

2016-10-24 Thread Jon Shier via swift-users
If you haven’t tried it yet, perhaps commenting out the content of the Row file will prevent the crash and let the build fail with normal errors? Then you can comment in parts of the file and see where the crash is occurring. As to the overall stability of the compiler, stuff lik

Re: [swift-users] NSTouchBar naming decision

2016-10-28 Thread Jon Shier via swift-users
The Great Renaming was only about Foundation (and libdispatch), not the UI frameworks of Apple’s platforms, AppKit, UIKit, or WatchKit. Jon > On Oct 28, 2016, at 5:12 PM, Robert Schwalbe via swift-users > wrote: > > So why is the NS prefix being used on a brand new API? > > After all the

[swift-users] Reducing Array to OptionSet

2016-11-03 Thread Jon Shier via swift-users
Swifters: I’m dealing with a JSON API where sets of options are returned as arrays of strings. Representing these as OptionSets seems ideal. I can decode the arrays of strings into an array of individual OptionSet values, but I’ve run into a dead end when trying generically reduce the ar

Re: [swift-users] Reducing Array to OptionSet

2016-11-03 Thread Jon Shier via swift-users
let stringArray: [String] = ["one", "three"] > let stringOptions = MyOptionSet(strings: stringArray) > stringOptions.rawValue > >> On Nov 3, 2016, at 7:09 PM, Jon Shier via swift-users > <mailto:swift-users@swift.org>> wrote: >> >> Swifters: >&

Re: [swift-users] Reducing Array to OptionSet

2016-11-03 Thread Jon Shier via swift-users
t; var set = MyOptionSet() >>> strings.flatMap({ StringEnum(rawValue: $0) }) >>> .flatMap({ MyOptionSet(rawValue: 1 << $0.hashValue) }) >>> .forEach { set.insert($0) } >>> _rawValue = set.rawValue >>> } &g

Re: [swift-users] Reducing Array to OptionSet

2016-11-03 Thread Jon Shier via swift-users
<< 2) >>>> >>>> public var rawValue: Int { return _rawValue } >>>> public init(rawValue: Int) { self._rawValue = rawValue } >>>> private let _rawValue: Int >>>> >>>> private enum StringEnum: String

Re: [swift-users] Bool to Int

2016-11-20 Thread Jon Shier via swift-users
Except in that case true isn’t a Bool but an NSNumber, which is why you can initialize an Int from it. It seems trivially easy to add an Int extension to do what you want though. Jon > On Nov 20, 2016, at 10:48 PM, Rick Mann via swift-users > wrote: > > It seems I can't do this: > > let r

Re: [swift-users] Documentation for Linux Development

2016-12-18 Thread Jon Shier via swift-users
http://swiftdoc.org is a good online reference, though not always completely up to date (just mostly). Jon > On Dec 18, 2016, at 9:44 PM, Steven Harms via swift-users > wrote: > > Hi, > > I've been playing with Swift in Linux contexts, but I was wondering, how is > o

Re: [swift-users] EnumerateUsingObjects in Swift

2017-01-23 Thread Jon Shier via swift-users
enumerateObjects(options:using:) exists on NSArray in Swift. And I was able to create your generic class just fine: class Test { var array: [T] = [] init() { var temp = array as NSArray } } I’m not sure what the canonical parallel array enumeration would be, but you can

[swift-users] Alamofire on Linux

2017-01-24 Thread Jon Shier via swift-users
Swifters: I’m one of the two maintainers for the Alamofire networking library. We’re in the process of porting Alamofire to Linux but have run into a major issue. We’re looking for feedback on our GitHub issue here: https://github.com/Alamofire/Alamofire/issues/1935

Re: [swift-users] Debugger woes

2017-01-31 Thread Jon Shier via swift-users
This is pretty normal debugger behavior for me. Issues with printing variables clearly in scope, using types or operators from other modules, and poor performance happen every time I try to debug Swift under Xcode. I’ve never found anything that works reliably. Jon > On Jan 31, 2017,

[swift-users] Crash with swift_weakLoadStrong in the stack

2017-02-13 Thread Jon Shier via swift-users
Swift Users: I’m currently seeing a crash in my iOS app that has no apparent cause, but a bit of Swift runtime machinery in the stack has me confused. #0. Crashed: com.apple.main-thread 0 App0x665ac Controller.handleOtherNotification(Notification) -> () (Controll

Re: [swift-users] Crash with swift_weakLoadStrong in the stack

2017-02-13 Thread Jon Shier via swift-users
k references I can see, except perhaps the implicit ones from NotificationCenter. Badly resymbolicated log? Is that even possible? Jon > On Feb 13, 2017, at 6:52 PM, Greg Parker wrote: > >> >> On Feb 13, 2017, at 12:18 PM, Jon Shier via swift-users >> mailto:swift-u

Re: [swift-users] Rational behind having 2 different behaviors for flatMap?

2017-02-13 Thread Jon Shier via swift-users
According to the compiler, the closure argument for flatMap is not optional or defaulted, so it’s always required. I think it should default to { $0 }, but whatever. Jon > On Feb 13, 2017, at 8:26 PM, Saagar Jha via swift-users > wrote: > > flatMap was designed to work this way. How I ratio

Re: [swift-users] ambiguous minus operator

2017-02-16 Thread Jon Shier via swift-users
I’ve had good luck with being able to click the candidates in cases like this so Xcode will navigate to those bits of code. However, in this case I think the issue is that the candidates weren’t from user code but from the standard library, which Xcode has all sorts of issues navigating

Re: [swift-users] The case of broken polymorphism or "Cannot convert value of type to expected argument type"?

2017-02-20 Thread Jon Shier via swift-users
Also possibly related is the covariance in protocol requirements. The following example doesn’t compile without casting the arrays or single values to the exact types required in the protocols, despite being covariant through protocol conformance or subclass. protocol HasViews { var vi

[swift-users] Confusing Error localizedDescription output

2017-02-28 Thread Jon Shier via swift-users
Swifters: I have a custom error enum: enum MyError: Error { case network(error: Error) case json(error: Error) case value(error: Error) var localizedDescription: String { switch self { case let .network(error): return error.localizedDescription

Re: [swift-users] Confusing Error localizedDescription output

2017-02-28 Thread Jon Shier via swift-users
or-bridging.md>. > > Hope this helps, > Jordan > > >> On Feb 28, 2017, at 12:54, Jon Shier via swift-users > <mailto:swift-users@swift.org>> wrote: >> >> Swifters: >> I have a custom error enum: >> >> enum MyEr

Re: [swift-users] Confusing Error localizedDescription output

2017-02-28 Thread Jon Shier via swift-users
e bridged to NSError.) >> >> If you're interested, you can find more information about the design in its >> proposal, SE-0112 >> <https://github.com/apple/swift-evolution/blob/master/proposals/0112-nserror-bridging.md>. >> >> Hope this helps, >

Re: [swift-users] Confusing Error localizedDescription output

2017-02-28 Thread Jon Shier via swift-users
. You need to actually conform to >>> LocalizedError and provide a valid 'errorDescription' instead. >>> >>> (It's too bad that your second test works at all, since MyError doesn't >>> conform to LocalizedError. Unfortunately NSError doe

Re: [swift-users] [swift-evolution] Plan to move swift-evolution and swift-users mailing lists to Discourse

2017-03-20 Thread Jon Shier via swift-users
So when is this transition happening? The sooner the better, as Mail can’t really handle threads with large messages, like the recent evolution threads about Foundation serialization and decoding. It just stops rendering messages. Discourse would help a lot for these sorts of discussions

Re: [swift-users] [swift-evolution] Plan to move swift-evolution and swift-users mailing lists to Discourse

2017-03-20 Thread Jon Shier via swift-users
Sorry, didn’t see the other threads about this. Sooner is better but I’m glad to know it’s at least planned. Jon > On Mar 20, 2017, at 12:39 PM, Jon Shier wrote: > > So when is this transition happening? The sooner the better, as Mail > can’t really handle threads with large messages,

Re: [swift-users] Improving compilation times?

2017-03-22 Thread Jon Shier via swift-users
It’s a rather severe regression from Objective-C, where equivalent amounts of code could be compiled in 2 - 3 minutes. I think we all understand why swiftc is so much slower than clang, but it’s concerning that, with all of the talk of new features or changes for Swift 4, there’s no comm

Re: [swift-users] Improving compilation times?

2017-03-28 Thread Jon Shier via swift-users
That setting breaks incremental compilation, so you're getting clean build speed at the expense of incremental builds. Jon > On Mar 28, 2017, at 7:35 AM, Bartłomiej Nowak via swift-users > wrote: > > I’ve had the same issue and adding a user-defined setting > `SWIFT_WHOLE_MODULE_OPTIMIZAT

Re: [swift-users] Swift 3.1 String(

2017-04-05 Thread Jon Shier via swift-users
This was something that sounded like a good change but is extremely annoying in use. Once I get time I’m going to try writing an extension on Optional that generates a logDescription property so I don’t have to use that awful String(describing:) API. Jon Shier > On Apr 5, 2017, at 1

Re: [swift-users] Linux equivalent of macOS/iOS run loop, aka libdispatch/Dispatch on Linux

2017-04-05 Thread Jon Shier via swift-users
Dispatch equivalent should be dispatchMain(), unless that’s not available on Linux for some reason. Jon > On Apr 5, 2017, at 4:28 PM, Rick Mann via swift-users > wrote: > > I've got Swift and libdispatch installed and linking under Ubuntu 16.04, but > I'm not sure how to set up the Linux e

Re: [swift-users] Reporting crashes that only happen in large project

2017-05-22 Thread Jon Shier via swift-users
bugreport.apple.com, bugs filed there are confidential. Only Apple employees will be able to see, so I’ve uploaded entire client projects before. Jon > On May 22, 2017, at 1:59 PM, Halen Wooten via swift-users > wrote: > > Hi, > > I'm working with a weird crash at the moment, and my hunch

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

2017-06-18 Thread Jon Shier via swift-users
Your issue here is Any, which will likely never be Decodable. You’ll need an actual type to contain the raw JSON. Hilariously, I have to wonder if Argo’s JSON enum could be made Decodable, as it can represent every valid JSON type typically contained in the Any returned by JSONSerializat

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

2017-06-18 Thread Jon Shier via swift-users
The more I use Codable, the less suited to networking it becomes. In reading a variety of blog posts about implementing custom Decodable support from JSON, I kept running across the same pattern. Basically, users had started implementing their own decoding protocols which wrap Decodable

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

2017-06-18 Thread Jon Shier via swift-users
ser = try decoder.decode(User.self, from: data) > print(user) > } > catch { > print("error:\(error)") > } > > Reference: > > https://developer.apple.com/videos/play/wwdc2017/212/ > <https://developer.apple.com/videos/play/wwdc2017/212/> >

Re: [swift-users] Extensions on Typealiased Existential Protocols

2017-06-19 Thread Jon Shier via swift-users
What I usually do here is: typealias CProtocol = A & B protocol C: CProtocol { } // or just A & B directly, I think extension C {} So it’s a bit silly to me. Jon > On Jun 19, 2017, at 3:44 PM, Slava Pestov via swift-users > wrote: > > Hi Steven, > >> On Jun 19, 2017, at 11:44 AM, Steven Br

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

2017-06-22 Thread Jon Shier via swift-users
; how we believe this API is best used. > > - Tony > >> On Jun 18, 2017, at 7:23 PM, Jon Shier via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Given that, per his description, “metadata” can be anything, creating a >>

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

2017-06-22 Thread Jon Shier via swift-users
actually intended to handle all JSON you should probably call it something else. Jon > On Jun 22, 2017, at 9:42 PM, Greg Parker wrote: > > >> On Jun 22, 2017, at 6:00 PM, Jon Shier via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> M

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

2017-06-23 Thread Jon Shier via swift-users
never be fixed. Jon > On Jun 23, 2017, at 4:34 AM, David Hart wrote: > > > On 23 Jun 2017, at 03:45, Jon Shier via swift-users <mailto:swift-users@swift.org>> wrote: > >> I’m sorry, are you complaining about my use of Codable instead of more >> pre

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

2017-06-23 Thread Jon Shier via swift-users
Your gist is extremely interesting to me. I had tried something similar with Argo’s existing JSON enum, but was somewhat stymied by trying to decode it from an unkeyed container. I suppose I still don’t have a good grasp on all of the existing container types. Jon > On Jun 23, 2017,

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

2017-06-23 Thread Jon Shier via swift-users
t in the upcoming betas, should > be fairly simple introduce. Would this solve that use case? > > We’re also working on improving NSISO8601DateFormatter. I don’t think I saw > it in any of your emails — what specific use case are you looking for that it > doesn’t at the moment

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-23 Thread Jon Shier via swift-users
Crashlytics can pick up these strings just fine. I thought they were part of the full crash dump. > On Jun 24, 2017, at 12:13 AM, David Baraff via swift-users > wrote: > > I realize this is slightly centric to iOS, but it irks me that both Apple’s > crash report logs and popular platforms li

[swift-users] Swift 4 thread sanitizer more sensitive?

2017-06-25 Thread Jon Shier via swift-users
Running Alamofire through the thread sanitizer and the thread sanitizer finds issues in Swift 4 mode but not Swift 3.2. Does Swift 4 add additional threading instrumentation that you don’t get under other versions? Or is there some other runtime difference that explains it? Jon Shier

Re: [swift-users] intercept fatalError() or other termination messages from swift?

2017-06-26 Thread Jon Shier via swift-users
If you export the crash from Xcode, do you see the string in the raw report? Jon > On Jun 26, 2017, at 3:22 PM, David Baraff via swift-users > wrote: > > To be very clear, i’m concerned about iOS not mac os x. I pulled up a crash > report using xcode tools, and saw no mention of the string

Re: [swift-users] Swift Documentation question

2017-07-01 Thread Jon Shier via swift-users
swiftdoc.org should be integrated into swift.org and be kept officially up to date. Unfortunately it doesn’t have Swift 4 coverage yet, which is a shame, as I like that documentation format more than Apple’s official one. Jon > On Jul 1, 201

Re: [swift-users] Swift 4 thread sanitizer more sensitive?

2017-07-02 Thread Jon Shier via swift-users
4 PM, Joe Groff wrote: > > >> On Jun 26, 2017, at 10:33 AM, Joe Groff via swift-users >> wrote: >> >> >>> On Jun 25, 2017, at 3:56 PM, Jon Shier via swift-users >>> wrote: >>> >>> Running Alamofire through the thread s

Re: [swift-users] Disable "indexing while building" in Xcode9 (unknown argument: `-index-store-path`)

2017-07-04 Thread Jon Shier via swift-users
Xcode 9 fixes my biggest complaint about Xcode, which was the text editor. The new one, based off the one used in the Playgrounds iPad app, is far better in pretty much every way than the old one. It’s still missing features (which should be added by release) but I use it as much as I ca

Re: [swift-users] Disable "indexing while building" in Xcode9 (unknown argument: `-index-store-path`)

2017-07-04 Thread Jon Shier via swift-users
whatever level of privacy they > desire. And, the iPad Playgrounds Application is Apple-proprietary as well. > > What components/Swift features are you concerned about? > > Just asking. > > Jonathan > >> On Jul 4, 2017, at 9:20 PM, Jon Shier via swift-users > &

Re: [swift-users] Disable "indexing while building" in Xcode9 (unknown argument: `-index-store-path`)

2017-07-04 Thread Jon Shier via swift-users
s you explicitly mentioned (the source code editor, the build >>> system, for example) are all part of the Xcode application, and should be >>> developed by Apple as part of their product offering to whatever level of >>> privacy they desire. And, the iPad

Re: [swift-users] Swift 4 thread sanitizer more sensitive?

2017-07-06 Thread Jon Shier via swift-users
; legit issue. Thanks! >> >> >> >> Jon >> >>>> On Jun 26, 2017, at 1:54 PM, Joe Groff wrote: >>>> >>>> >>>>> On Jun 26, 2017, at 10:33 AM, Joe Groff via swift-users >>>>> wrote: >>>

Re: [swift-users] extension on UISlider breaks interface builder??

2017-07-14 Thread Jon Shier via swift-users
Yep, known issue, fixed in Xcode 9 beta 3 according to the release notes. Hugely annoying, but comment out the extension, connect the outlet, and comment it back it and should work fine. Jon > On Jul 14, 2017, at 11:51 PM, David Baraff via swift-users > wrote: > > TL;DR > Add an ex

Re: [swift-users] extension on UISlider breaks interface builder??

2017-07-14 Thread Jon Shier via swift-users
In my experience, yes, it started with Xcode 8, though I don’t specifically remember extending types I was using in IB in Xcode 7. Jon > On Jul 14, 2017, at 11:54 PM, David Baraff wrote: > >> >> On Jul 14, 2017, at 8:53 PM, Jon Shier via swift-users >> mail

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-17 Thread Jon Shier via swift-users
Like Notification.Name, I believe those types are supposed to help you namespace your string constants when you access them. I’d recommend using a code gen tool to generate them from your image assets, like: extension NSImage.Name { static let customImage = NSImage.Name(rawValue:

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-17 Thread Jon Shier via swift-users
Making them an extension on String makes them visible everywhere String is used, unless you limit the visibility in some way, which impacts the performance of autocomplete and fills it with random constants. Like I said, part of the reason for this is to separate the constants. Jon >

Re: [swift-users] Printing Enums?

2017-07-17 Thread Jon Shier via swift-users
Certain Objective-C enums don’t print a useful debug description. I usually work around this by implementing CustomStringConvertible (or the debug version) for the type myself. You probably want to file a bug with Apple. Jon > On Jul 17, 2017, at 6:15 PM, Michael Rogers via swift-user

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-18 Thread Jon Shier via swift-users
I'd agree with that. Fortunately there are tools out there that can parse such things and generate the constants for us already. Waiting for Xcode to implement such common sense quality of life improvements probably won't end. I'll file bugs in the meantime though. Jon > On Jul 18, 2017, at

Re: [swift-users] Still can't derive from a generic class

2017-08-29 Thread Jon Shier via swift-users
This works fine for me in a playground in the latest Xcode 9 beta: class Test { } class Base { } class Sub: Base { } let sub = Sub() Jon > On Aug 29, 2017, at 1:04 PM, Joanna Carter via swift-users > wrote: > > Hi > > I would have hoped by now that it should be possible to do : > > cl

Re: [swift-users] Still can't derive from a generic class

2017-08-29 Thread Jon Shier via swift-users
Ah, I see. Making a subclass that inherits from a superclass generic to the subclass doesn’t seem like it should be a thing, but I’m not a type theorist. In any case, this is a bug (unexpected runtime crash and all) and you should file it. Jon > On Aug 29, 2017, at 1:25 PM, Joanna Carter

[swift-users] No Generic Decoders?

2017-09-02 Thread Jon Shier via swift-users
Swift Users: I’ve been exploring the creation of Decodable response serializers for Alamofire. However, there doesn’t actually seem to be any way to express the notion of a generic decoder. The Decoder protocol itself doesn’t require a `decode(type:from:)` method, and neither JSONDecoder

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

2017-09-13 Thread Jon Shier via swift-users
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. Jon > On Sep 13, 2017, at 9:47 PM, Zhao Xin via swift-users > wrote: >

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

2017-09-14 Thread Jon Shier via swift-users
It also doesn’t explain why removeFirst would work but popFirst doesn’t. The mutation to the underlying array should be the same, the only different is that one returns the element optionally. It also doesn’t explain why popFirst doesn’t show up I the autocomplete but compiles anyway.

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

2017-09-14 Thread Jon Shier via swift-users
sort of Swift bug here. Jon > On Sep 14, 2017, at 10:48 AM, Jon Shier via swift-users > wrote: > > It also doesn’t explain why removeFirst would work but popFirst > doesn’t. The mutation to the underlying array should be the same, the only > different is that one r

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

2017-09-14 Thread Jon Shier via swift-users
d have it, but in any case, this looks like a bad error message at least. Jon > On Sep 14, 2017, at 11:05 AM, Jon Shier via swift-users > wrote: > > This seems oddly similar to https://bugs.swift.org/browse/SR-5659 > <https://bugs.swift.org/browse/SR-5659>,

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

2017-09-17 Thread Jon Shier via swift-users
Yes, it seems to fly in the face of protocols as they exist in Swift at the moment. Given the inability of protocols to guarantee performance characteristics, breaking conformant types like this seems like a bad way to try and fulfill a separate axis of concern. Wouldn’t a better idea be

[swift-users] Swift Version Conditionals in Objective-C?

2017-09-22 Thread Jon Shier via swift-users
In moving a hybrid project from Swift 3 to 4, I’ve run into some issues from my Objective-C code. I’ve been able to conditionalize my Swift code for both versions pretty easily, but there are APIs imported from Objective-C that need to change definition for Swift 4. Is there anyway, in p

Re: [swift-users] Parsing Decimal values from JSON

2017-10-31 Thread Jon Shier via swift-users
The appropriate solution here would be for Swift to have its own native JSON parser that allows direct decoding into generic types without the intermediary of JSONSerialization. For whatever reason there seems to be resistance to this from the Swift team, but until we have that ability,

[swift-users] Refining generics in classes

2017-11-15 Thread Jon Shier via swift-users
Swift Users: I have a generics use case which has somewhat stumped me. I have two related protocols, JSONDecodable and CompressedDecodable, and CompressedDecodable inherits from JSONDecodable (though that relationship isn’t strictly necessary). I also have a generic function that

Re: [swift-users] I ve found a serious Bug in JSONEncoder (SR-6131) and would like to fix it.

2017-12-18 Thread Jon Shier via swift-users
I’m pretty sure JSON isn’t localized, so this isn’t a bug. Using anything but a . as a decimal separator isn’t valid JSON. Jon > On Dec 18, 2017, at 11:51 AM, Benoit Pereira da silva via swift-users > wrote: > > Dear all > > I've found a serious Bug in JSONEncoder SR-6131 >

Re: [swift-users] "Month 13 is out of bounds"

2018-01-02 Thread Jon Shier via swift-users
This is a known issue for High Sierra, and is output from a variety of apps during normal system usage. Just search your Console logs and you’ll see many instances. Unfortunately I’m not sure how to ignore the output in Xcode, but you don’t need to care about it. Who knows if it’ll be f

[swift-users] Synthesized Equatable Bug?

2018-01-15 Thread Jon Shier via swift-users
Swifters: Take this simple Point type: struct Point: Hashable { let x: Int let y: Int init(_ x: Int, _ y: Int) { self.x = x self.y = y } } Using the latest Swift 4.1 snapshot, the Hashable conformance is generated for me. Adding Comparable conformance lik

Re: [swift-users] Synthesized Equatable Bug?

2018-01-15 Thread Jon Shier via swift-users
te: > > On Mon, Jan 15, 2018 at 2:30 PM, Jon Shier via swift-users > wrote: >> This is pretty straightforward code, so am I missing something here? > > Your '<' function does not define a valid strict total order. > > For > > let p1 = Point(1, 1) >

Re: [swift-users] Superclass constraint cannot depend on type parameter

2016-03-19 Thread Jon Shier via swift-users
b.com/apple/swift/commit/3aacf5d805768527b59d24e6da2a03911b3dd5b0 > > <https://github.com/apple/swift/commit/3aacf5d805768527b59d24e6da2a03911b3dd5b0> > > It would be great if you could try the latest compiler with your code. > > Slava > >> On Mar 9, 2016, at 12:48 PM, Jon Shier via swift-users