[swift-users] Swift4/iOS question

2017-08-28 Thread Travis Griggs via swift-users
If I need to take this question elsewhere, please point me to the right list. I decided to take the dive this morning and give XCode9 beta and Swift 4 a try. I’m tired of not being able to refactor. There are two things that the importer is trying to commonly change that I’m curious about: 1)

Re: [swift-users] any wisdom about sharing "common" overloads/extensions in base libraries?

2017-06-20 Thread Travis Griggs via swift-users
> On Jun 20, 2017, at 2:25 PM, Travis Griggs wrote: > >> >> On Jun 20, 2017, at 7:02 AM, David Baraff via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> I posted this on Apple’s developer forums, and someone suggested trying this >> here. >> Basically, see https://forums.develope

Re: [swift-users] any wisdom about sharing "common" overloads/extensions in base libraries?

2017-06-20 Thread Travis Griggs via swift-users
> On Jun 20, 2017, at 7:02 AM, David Baraff via swift-users > wrote: > > I posted this on Apple’s developer forums, and someone suggested trying this > here. > Basically, see https://forums.developer.apple.com/thread/80349 > > > but in a nuts

Re: [swift-users] Restricting associated values

2017-06-19 Thread Travis Griggs via swift-users
> On Jun 18, 2017, at 10:33 PM, Howard Lovatt via swift-users > wrote: > > To me Angle is a unit with two common representations: radians and degrees. > It's not an enum because it doesn't have two values, it has one value that > you can view in two ways. > > Therefore I would make an Angle

Re: [swift-users] Future(of: self.references)?

2017-05-24 Thread Travis Griggs via swift-users
> On May 22, 2017, at 5:56 PM, Greg Power wrote: > > Hi Travis, > > I’m certainly not a core contributor, but I could point you to the rejection > email for this proposal, which you might not have seen: > > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005478.html >

[swift-users] Can I have my cake and share it too with extensions?

2017-05-24 Thread Travis Griggs via swift-users
In my own project, I add some extensions to Data and other objects to make building/parsing Data objects easier. Amongst others, I have extensions like this: func += (data:inout Data, string:String) { data.append(string.data(using: .utf8)!) } func += (data:inout Data, convertible:DataCo

[swift-users] Future(of: self.references)?

2017-05-22 Thread Travis Griggs via swift-users
I’m trying to figure out how to ask this question without generating flame and heat. Like tabs and spaces, under_scores and camelCase, whether or not one thinks that a message dispatch receiver should be explicit or implicit seems to be highly personal, (I think*) based on where/how you learned

Re: [swift-users] Swift 3.1 String(

2017-04-10 Thread Travis Griggs via swift-users
> On Apr 5, 2017, at 7:37 AM, Jon Shier via swift-users > wrote: > > 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

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

2017-02-13 Thread Travis Griggs via swift-users
Not sure if I got the "reply all" right… I’ll throw my 2c in. I like mailing lists. I like them, because they let me choose the viewer that I want to participate with(separation of presentation and data). I lose that with a web forum. And there’s something valuable about actually forcing people

[swift-users] Confused by this error message

2017-01-30 Thread Travis Griggs via swift-users
I’m currently refactoring some code (Swift 3.?, latest XCode), and I ended up with the following: func spansTSON() -> TSON { var docs = self.spans.map() { $0.tson } for (span, doc) in zip(self.spans, docs) { if let datum = span.begin

Re: [swift-users] Confused by this error message

2017-01-30 Thread Travis Griggs via swift-users
> On Jan 30, 2017, at 3:19 PM, Travis Griggs wrote: > > I’m currently refactoring some code (Swift 3.?, latest XCode), and I ended up > with the following: > > func spansTSON() -> TSON { > var docs = self.spans.map() { $0.tson } > for (span, doc) in zip(self.s

[swift-users] Confused/Surprised by IndexingIterator.forEach behavior

2016-12-28 Thread Travis Griggs via swift-users
The behavior of the following playground snippet surprised me: var source = [10, 20, 30, 40] var stream = source.makeIterator() stream.next() // 10 stream.next() // 20 stream.forEach { (each) in print("\(each)") } // prints 30, 40 to the console stream.next() // 30 stream.next() // 40

[swift-users] Identity based object hash?

2016-10-05 Thread Travis Griggs via swift-users
I have a class that I’d rather not have based off of NSObject, but I do want to have identity based equality. I’ve done that as follows: class Foobar { } extension Foobar:Equatable { } func == (a:Foobar, b:Foobar) -> Bool { return a === b } What’s less clear to me is how to go about im

[swift-users] Regression in Xcode8-beta6 Swift?

2016-08-24 Thread Travis Griggs via swift-users
Upgrading to beta6 of Xcode8, I’ve read through various SE’s and made fixes as appropriate, but the following behavior I didn’t catch an explanation as to why its now an error where it was fine before. In a ViewController, I have something that looks like: var addButton = UIButton(type: .cu

Re: [swift-users] Date and Data

2016-08-03 Thread Travis Griggs via swift-users
> On Aug 3, 2016, at 3:36 PM, Jon Shier wrote: > > 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? Fair question. I did think of that. I did actually port this code from Objective C. For whatever reason,

[swift-users] Date and Data

2016-08-03 Thread Travis Griggs via swift-users
I realize this ship has probably sailed a long while ago. I really like the way the Foundation library is shaping up. With the changes in Swift3, I’ve been moving any of my Array cases to using Data. A handful of handy extensions to Data have made working with it nice. It’s much easier to figure

[swift-users] They had parens upon thars

2016-08-02 Thread Travis Griggs via swift-users
Chapter 1: Coming from a Smalltalk background, I was enjoying added all kinds of properties to basic number types, for example: extension Double { var rounded:Double { return round(self) } } Chapter 2: I upgraded to XCode8Beta4 yesterday and firstly got to change all of UICol