iOS / Mac OS Developers
467 subscribers
2 photos
308 links
iOS / Mac OS를 다루는 개발자들을 위한 채널 입니다.
Download Telegram
Imagine a registration flow with a few steps (screens) and each of them fils some information about a user. Finally, you have to construct the user by the data from the previous steps... how?

There're many solutions to achieve it - using optional properties and just pass an object over the screens; maybe create a dictionary with filed data and so on.

But I really adore this solution by utilizing KeyPath's, Generics and subscripts to create a partial object. Of course, in no way without downsides, but they're so minor and it doesn't prevent to use it!

p.s. Recently I already posted the similar article, but this one looks really great with more details about a realization.

https://josephduffy.co.uk/partial-in-swift
#swift #keypath
A bit of array performance - need to be aware when it's preferable to use reserveCapacity rather than a simple array allocation. Be familiar with the Big-O notation! 😉
https://www.hackingwithswift.com/articles/128/array-performance-append-vs-reservecapacity
#swift #performance
Swift becomes more safety with each new release and this article describes what's new here. Sounds a bit complicated but interesting to read though :)

“By shipping with full exclusivity enforcement enabled in Release builds, Swift 5 helps to eliminate bugs and security issues, ensure binary compatibility, and enable future optimizations and language features.”

https://swift.org/blog/swift-5-exclusivity/
#swift
Every time I'm going to solve some interesting programming problem, implement a network layer, a collection with different types of cells and so on, PAT (protocol with associated type) is the first thing that comes to mind, it'd be awesome to implement it this way, I tell myself. Nevertheless, it sucks when Sequence or saving to a variable happens. But I'm not upset - googling "Swift type erasure", implementing _Box, AnyFoo and I'm happy again, not today though...

What I'm talking about? So, if you've felt yourself in the same situation, try thoughtfully reading this article. And maybe next time you won't spend much time on this.

http://robnapier.net/start-with-a-protocol
#swift
I've been waiting for this for so long - Swift 5.1 with Module Stability finally!
https://swift.org/blog/swift-5-1-released/
#swift