|
Possibly-stupid question: can I for-in iterate through an enum, e.g. the Suit enum in the card examples?
|
# ¿ Jun 3, 2014 05:27 |
|
|
# ¿ Apr 29, 2024 06:48 |
|
Can do! Let me know if you want the rdar ID once it's filed. As an aside, I just wrote my first (very simple) view controller in Swift and I'm ready to never look back. Great work, and thanks to you and your team. edit: filed, rdar://17102392 Meat Street fucked around with this message at 05:51 on Jun 3, 2014 |
# ¿ Jun 3, 2014 05:42 |
|
Sure: https://gist.github.com/tomburns/8975715cd4811d30417f Like I said, dead simple. But it works! Radar filed for the enum iteration and linked in my post above.
|
# ¿ Jun 3, 2014 05:53 |
|
Kind of a hack, but if you have the value as a variable and start typing its name, the autocomplete indicates its type.
|
# ¿ Jun 3, 2014 15:58 |
|
Axiem posted:Oh, and I think I heard an Apple Engineer today slip up and use the code name for Swift instead of Swift. Those in Apple: any idea if it is actually a Firefly reference? (Or is it just as likely to have been the wrong word, but not the codename) So uh, since you don't work at Apple: what was it? Serenity?
|
# ¿ Jun 6, 2014 13:13 |
|
So this is now a thing: http://terribleswiftideas.tumblr.com
|
# ¿ Jun 6, 2014 21:42 |
|
rjmccall: I saw that Chris retweeted someone talking about the -Otime flag to disable runtime safety checks. I have to assume this wasn't a general endorsement of using that flag, right? Am I missing something here? Unless your code is basically a series of proofs a la Haskell, I don't know why you'd want to opt out of that.
|
# ¿ Jun 6, 2014 22:39 |
|
I'm screwing around in a playground this morning, and noticing that my quick little fibonacci function isn't benefitting from any tail recursion. Is this due to the playground environment, or does Swift really not have any tail call optimization?
|
# ¿ Jun 7, 2014 16:54 |
|
Sanity check before I file a radar:code:
e: finally got it to spit out an error instead of crashing: code:
|
# ¿ Jun 8, 2014 04:40 |
|
Ender.uNF posted:edit: my rationale is that CoreData already uses exceptions so if you want to interoperate you need to be able to deal with them. It was a design decision of the language to not have exceptions and I doubt they'll double back on that, nor would I use them if they were added, but this does raise (heh) an interesting question: does the Core Data talk this year have anything to say about usage patterns in Swift?
|
# ¿ Jun 8, 2014 12:29 |
|
rjmccall (or anyone else), I'm curious: do you have any recommendations as far as getting up to speed on the more functional side of things? Obviously it doesn't have to be Swift-specific. Last time I tried Learn You A Haskell it flew over my head, but maybe I should give it another shot now that I have some more concrete motivation
|
# ¿ Jun 9, 2014 00:27 |
|
Just noticed that book 2, Using Swift with Cocoa and Objective-C, is up on iBooks: https://itunes.apple.com/us/book/using-swift-cocoa-objective/id888894773?mt=11
|
# ¿ Jun 13, 2014 15:08 |
|
New Apple Blog, three words I never thought I'd type together: https://developer.apple.com/swift/blog/
|
# ¿ Jul 11, 2014 18:55 |
|
Possibly-stupid question for rjmccall or anyone else: Why does ArraySlice exist? A friend and I were trying to reason about it, but given the copy-on-write Array semantics we couldn't come to a conclusion. I'm probably missing something obvious.
|
# ¿ Jun 16, 2015 03:44 |
|
|
# ¿ Apr 29, 2024 06:48 |
|
That's one way, or you can make the methods you want to test (and the classes they're declared in) public. Either way the issue you're running into is that your classes aren't exposed outside the app module, so your test target can't see them.
|
# ¿ Aug 6, 2015 20:50 |