Swift Around the Web
I love the discussions on Twitter this week around some advanced Swift concepts, and the resulting blog posts that come out as we, as a community, discuss best practices in Swift.
Changes in the Swift Standard Library in Beta 7
There aren't that many changes to Swift itself in Beta 7, but Airspeed Velocity gives a good overview of the very few that are there. As the Swift library becomes more stable for the Swift 1.0 release, one big question remains - "how will the library keep evolving post-1.0?"
Tuples, Structs and Enums. What are the differences?
This blog post is a follow up to a very heated discussion on Twitter here and here about Tuples, Structs, and (you guessed it) Enums! This all started when David Owens II posted Tuples Are The New Struct. As we play with these new (compared to Objective-C) data types in Swift, this is an overall fun discussion to consider as there are no best practices for programming in Swift yet.
Unsafe pointers in Swift: How to build a zombie
This is part III of sketchyTech's series about Unsafe Pointers in Swift.
- ]Part II: Unsafe pointers in Swift: Conversion to and from a COpaquePointer (and CFunctionPointer)](http://sketchytech.blogspot.com/2014/08/unsafe-pointers-in-swift-conversion-to.html)
- Part I: Unsafe pointers in Swift: A first look
App extensions in iOS 8 and Swift
The other day, I started discussing extensions with a few people only to realize that we were all talking about different types of extensions! In iOS8, there are extensions for Sharing, Notification Center, the iOS keyboard, and more. NSNerd explains the differences between them all and includes detailed diagrams for how they work.
Friday Q&A 2014-08-29: Swift Memory Dumping
Mike Ash walks through an implementation of a memory dumper in Swift. The full source code is on Github here.
Swift Default Protocol Implementations
Mattt Thompson goes over Protocols and how to use them with Generics. He also points out the tension between methods (functions that are part of a class or struct or enum) and functions in Swift: "The Object-Oriented paradigm is based around the concept of objects that encapsulate both state and behavior. However, in Swift, it's simply impossible to implement certain generic functions as methods on the struct or class itself."
Apple News
In case you missed it, Xcode 6 Beta 7 is out!!!!!!!!!!! The biggest change is the continuous effort of updating iOS APIs to work better with optionals in Swift. From the release notes:
A large number of Foundation, UIKit, CoreData, SceneKit, SpriteKit, Metal APIs have been audited for optional conformance, removing a significant number of implicitly unwrapped optionals from their interfaces. This clarifies the nullability of their properties, arguments and return values of their methods. This is an ongoing effort that started shipping in beta 5.
Apple has also posted two not-to-be-missed blog posts on their Swift blog:
Hope you're excited for the announcement next week!!!!
Other Cool Stuff
Github introduced split diffs this week!
Diffs now come in two flavors, unified and split. Switch between them on pull request, commit, and compare pages using the toggle in the top right of the page. The mode you last used will become your preferred default.
Videos
Swift: Enums, Pattern Matching & Generics
This is the recording of Austin Zheng's talk at the SLUG meetup a few weeks ago. If you watch one video this week, I highly recommend this one! Austin's code is very elegant, and he does a great job explaining advanced concepts around Swift Enums, Pattern Matching, and Generics. I definitely had a few breakthrough ah-ha moments during this talk! Note: the code in some slides is not updated for the latest betas, but the concepts still apply of course.
Swift Code
This week, I'm starting off with a functional programming library mentioned by Chris Eidhof that I'll have to look into a lot more now. Enjoy!
- swiftz - Functional programming in Swift
- Swift String Tools - A String extension that allows you to do some very awesome functions effortlessly.
- SwiftState - Elegant state machine for Swift.
- Swifty Login - Just a beautiful login, coded in Swift with Background changing every few seconds with animation.
Swift Thoughts
This week, I was really lucky to attend a talk by Chris Eidhof about Functional Programming in Swift at the SLUG Meetup. I haven't done much functional programming in my career yet, so it was really cool to have my default OO perspective challenged.
The thing that made me extra excited about functional programming was when Chris explained that functional programming is declarative - it's about what you want to do, not how you want to do it! The power of programming often makes me feel like a sorceress - I just wave my imaginary wand, and poof, the computer does exactly what I want. I like that functional programming falls more in line with this type of thinking :)
The video of the talk will be posted on realm in the next week or so (I'll make sure to send it out when it is!), but meanwhile you can check out Chris's slides here and buy his book on Functional Programming in Swift (I got it earlier this week, and cannot recommend it highly enough!).