DEV Community

Discussion on: Explain iOS development like I'm five

Collapse
 
hugh_jeremy profile image
Hugh Jeremy

I recently started diving into Swift as well. My hot tip would be to skip all the google results, and go straight for Apple's docs. Kind of the opposite of what I've experienced with other ecosystems. For example, their HTTP guide and JSON decode/encode guide are super comprehensive. The inbuilt documentation feature in Xcode is really good, I didn't even realise it was there until a few months in (Try option+click on a type).

Function re-use within a project

Go straight for a protocol. The whole language seems to be designed for 'protocol oriented programming', and Cocoa leans on it heavily. Create protocols with default implementations of functions with generic types. For example, the EntityObject protocol in Amatino Swift.

Function re-use across projects

Re-using functionality across projects seems to be a bit of a hair-ball. Whereas in Python or JS we can create self-contained modules, publish them to PyPi/NPM, and use them across projects, in Swift the community seems split between Carthage and CocoaPods. Neither are as turn-key as pip install x or npm install y.

Collapse
 
stevewight profile image
Steve

+1 for using the Apple docs. They are the best way I've found to get a real understanding of how a framework is used and the functionality it provides. The Xcode builtin docs are really great as well and save a ton of time when you just need a quick method definition or signature.

I'm in the CocoaPods camp myself. It's what I used when building open source frameworks, mainly because I started using it before Swift and Carthage came around and I'm waiting for Swift Package Manager to become more stable before I switch over.