|
Huge congrats, rjmccall! Really excited to dig into Swift.
|
# ¿ Jun 2, 2014 21:42 |
|
|
# ¿ Apr 28, 2024 22:16 |
|
You use true and false instead of YES and NO. I liked YES and NO.
|
# ¿ Jun 2, 2014 21:53 |
|
rjmccall posted:(Advanced Swift, Thursday at 11:30) Stupid question for anyone: how exactly do I open the Swift Programming Language iBook in Playground? The Swift Programming Language posted:NOTE
|
# ¿ Jun 3, 2014 00:43 |
|
Plorkyeran posted:At the moment trying to learn Swift without knowing Objective-C is probably not going to end well, but long term it seems perfectly reasonable to learn it without knowing C or Objective-C first, although you'll probably end up needing to know all three to write anything substantial. I disagree. I think if your goal is to learn Swift you aren't going to get much benefit from trudging through ObjC. Plus the pedagogical advantage of learning in the Playground environment is fantastic.
|
# ¿ Jun 3, 2014 14:58 |
|
Plorkyeran posted:If your goal is to just learn Swift then sure, you won't need to ever learn objective-c once the docs are fully in place. If your goal is to actually write nontrivial apps in Swift, you'll need to know Objective-C at least well enough to debug issues when using Objective-C libraries. I look at it from the same perspective as what EL BROMANCE said about the books that insisted that you needed a solid C foundation. I skipped that when learning ObjC, and I work with old C frameworks like CoreAudio all the time. You just kind of look up what you need when you get there. I'm really excited for the talk about integrating Swift with ObjC. Question for rjmccall: will there be a Swift version of sets?
|
# ¿ Jun 3, 2014 15:59 |
|
Doctor w-rw-rw- posted:
|
# ¿ Jun 3, 2014 22:02 |
|
If Swift is a recent name, what did you guys call the language internally while you were developing it?
|
# ¿ Jun 4, 2014 01:47 |
|
code:
|
# ¿ Jun 6, 2014 15:33 |
|
Advanced Swift talk was great, rjmccall. It sounded like you guys could have used another session or two to get to everything you wanted to talk about.
|
# ¿ Jun 8, 2014 18:17 |
|
May be a dumb question, but is there a possibility of an Xcode Edit >> Refactor >> Convert to Swift... in the future?
|
# ¿ Jun 8, 2014 19:25 |
|
I got excited after seeing all the cool projection of Swift -> ObjC / ObjC -> Swift stuff. I figure if that much work is already done, it might not be too far of a leap to just translate an implementation completely.
|
# ¿ Jun 8, 2014 19:58 |
|
Are property observers meant to substitute for key value observation in ObjC? It seems to me that they're very local, like having a class observe itself, but not able to be used for MVC coordination the way I've been using KVO.
|
# ¿ Jun 9, 2014 18:35 |
|
The required type casting is feeling brutal. For a function that takes a CGFloat:code:
code:
|
# ¿ Jun 11, 2014 20:18 |
|
That worked, thanks.Gul Banana posted:not tested, i'm at a PC. i'm also not sure if there's a way to limit the scope of extensions.. ideally this would be something you import for a specific source file or module. Can you explain why it would be bad to have this project wide? If it's a valid conversion, what's the harm?
|
# ¿ Jun 11, 2014 21:13 |
|
dizzywhip posted:I'm super happy about the private(set) access modifier, I was really hoping for something like that. Can you quick explain this? I'm falling behind in my Swift blog reading / version updates. Speaking of, which blogs are you all reading?
|
# ¿ Jul 21, 2014 23:06 |
|
Regarding lazy loading: In some cases I've found it's nice to allow for recalculation of a property by nilling out its backing store. So in Obj-C: Objective-C code:
1. Since lazy properties are only calculated once, how could this be done in Swift? 2. Or is this a bad habit of mine and there's a better way?
|
# ¿ Aug 21, 2014 17:58 |
|
How do you write out Swift methods? For example, if I say viewDidLoad() that makes sense. Same with UIImage(named:). But what about UIButton's set image for control state? Is it: setImage(forState:) or setImage(image:forState:) The documentation uses the Obj-C way of -setImage:forState: which doesn't seem right.
|
# ¿ Sep 24, 2014 16:05 |
|
Is there a particular reason why arrays don't have a removeObject: method like NSArray? Is it a safety thing?
|
# ¿ Oct 1, 2014 16:39 |
|
Ran into some bad code from a student of mine, but I was wondering why it doesn't throw an exception about the named variable 'index' being used twice:code:
code:
|
# ¿ Oct 5, 2014 13:39 |
|
Wow never noticed that before in any other languages. Thanks for the example, that one makes a lot more sense.
|
# ¿ Oct 5, 2014 13:58 |
|
Not sure if this is a style question or not. Is there any functional difference between referring to properties with self.property vs. just property? I use the former because I think it clarifies that it's a class property and not just a local variable, but I'm wondering if others are doing the same.
|
# ¿ Nov 3, 2014 16:02 |
|
How would you filter a String to only have upper and lowercase letters? I'm trying to iterate through an NSCharacterSet and use stringByReplacingOccurrencesOfString:withString: to do this, but my brain is failing me.
|
# ¿ Nov 12, 2014 23:46 |
|
pokeyman posted:If you like NSScanner, you could do something like Thanks, that's great. It's just to clean up a textfield input, but like everything Swift I feel like I'm missing something when I rely on NSString methods / scanners / character sets, etc.
|
# ¿ Nov 13, 2014 17:57 |
|
I gave up trying to use lldb to drill down at all in Swift. I would show students breakpoints and 'po' but it would just hang for 10 seconds and then spit out gibberish, every time.
|
# ¿ Feb 5, 2015 16:12 |
|
Swift Blog posted:let constants are now more powerful and consistent — The new rule is that a let constant must be initialized before use (like a var), and that it may only be initialized, not reassigned or mutated after initialization. Actually, for everything in the post.
|
# ¿ Feb 9, 2015 20:17 |
|
me: UIColor *color = [uic Xcode: I know! UICollectionElementKindSectionFooter! me:
|
# ¿ Apr 3, 2015 21:04 |
|
Hey congrats on being the 'most loved' language on the Stack Overflow survey.
|
# ¿ Apr 20, 2015 23:17 |
|
Biggest applause break 2 years running
|
# ¿ Jun 8, 2015 21:01 |
|
KidDynamite posted:Is that rjmcall with the teapot shirt? Yeah and that shirt is great. Nice presentation!
|
# ¿ Jun 9, 2015 20:45 |
|
I've also been playing with protocol extensions since the WWDC talk. I can get a heterogeneous array of protocol adhering objects:code:
code:
|
# ¿ Jun 15, 2015 23:09 |
|
But wasn't that what Protocol-Oriented Programming in Swift was all about? Solving the Equatable issue by using protocol extensions so we can move forward with this kind of use?
|
# ¿ Jun 16, 2015 01:26 |
|
Is it possible to store an array of class types? I have a group of classes that conform to a protocol which declares a static variable.code:
code:
|
# ¿ Jun 16, 2015 14:59 |
|
pokeyman posted:Does let classes = [Foo.self, Bar.self] work? Yes! Requires Swift 2 to access the properties, but it works: code:
|
# ¿ Jun 16, 2015 15:41 |
|
Can you access a protocol's static variable in a protocol extension method?code:
|
# ¿ Jun 18, 2015 18:24 |
|
rjmccall posted:
I swear I tried this. =/ Maybe I just let it autocomplete to self. Ahh.
|
# ¿ Jun 20, 2015 16:16 |
|
Will enum values ever autocomplete in the shorthand form? I've been hoping for this since the syntax was first shown. I want code:
code:
|
# ¿ Jul 11, 2015 17:38 |
|
Is there something other than using po in the debugger that I should be aware of? po is constantly finding new ways to not show me anything at all, even as the local variable list shows me the objects I want to inspect.
|
# ¿ Aug 15, 2015 17:28 |
|
Syntax head scratcher: In Darwin >> C >> Math: code:
code:
code:
|
# ¿ Aug 17, 2015 20:16 |
|
Is it possible to share a struct type between a Metal shader file (C++) and the rest of my Swift code that uses SIMD vector types? Swift 2 supports SIMD, and you can import it into the shader file, but I can't seem to bridge the two so I can just create one struct that they both see.
|
# ¿ Aug 29, 2015 21:32 |
|
|
# ¿ Apr 28, 2024 22:16 |
|
Please school me on retain / release in array iterations. Here is a test app with a big array that I iterate through each frame: code:
My assumption is that this is ARC doing its thing. If this were Objective-C, I'd disable ARC for the file to avoid this. What are my options in Swift? It seems really wasteful to retain / release each object when I know they aren't going anywhere.
|
# ¿ Sep 3, 2015 16:24 |