In the near future, we can stop using % operator for checking if a number is odd or even and start utilizing a new proposed function - isMultiple(of:).
https://forums.swift.org/t/accepted-with-modifications-se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15689
and a bit of optimization of is-multiple checks with the weird trick:
http://duriansoftware.com/joe/Optimizing-is-multiple-checks-with-modular-arithmetic.html
https://forums.swift.org/t/accepted-with-modifications-se-0225-adding-iseven-isodd-ismultiple-to-binaryinteger/15689
and a bit of optimization of is-multiple checks with the weird trick:
http://duriansoftware.com/joe/Optimizing-is-multiple-checks-with-modular-arithmetic.html
Swift Forums
[Accepted with Modifications] SE-0225: Adding isMultiple to BinaryInteger
Review thread | Proposal This proposal prompted a lot of very interesting discussion. Many members of the community favor adding these methods, but others are concerned about opening the door to a large number of trivial additions. Adding many trivial…
A bit of undocumented Swift feature. Have you known, that you can set a default type for associatedtype?
associatedtype A: Foo
associatedtype B = Foo // default
https://swiftrocks.com/swift-associated-types-with-default-values.html
#swift
associatedtype A: Foo
associatedtype B = Foo // default
https://swiftrocks.com/swift-associated-types-with-default-values.html
#swift
Swiftrocks
Swift Associated Types With Default Values
I was browsing the Swift forums when I stumbled across a discussion regarding an undocumented feature of Swift (as of this post's date): the ability to give associated types a default value.
Mattt's decided to trawl through the API diffs from iOS 11.4 to 12, thus posted a new NSHipster article describing what's new here.
https://nshipster.com/ios-12/
#iOS12
https://nshipster.com/ios-12/
#iOS12
NSHipster
iOS 12
Here at NSHipster, we’re interested in the nitty-gritty: the small (dare we say, obscure?) changes that add up to make a big impact to our day-to-day. In celebration of this week’s release of iOS 12, we’re sharing a few gems we found by trawling through API…
https://numerics.diploid.ca/
Notes on numerics in Swift
Notes on numerics in Swift
I completely forgot about new logging system that works since the iOS 10, but then I noticed this article that describes this system with some thoughts on why we'd want to use it. So I think we have to try to stop using NSLog and print statements, as well as some kind of logging libs such as CocoaLumberjack.
https://www.bignerdranch.com/blog/migrating-to-unified-logging-swift-edition/
https://www.bignerdranch.com/blog/migrating-to-unified-logging-swift-edition/
Big Nerd Ranch
Migrating to Unified Logging, Swift Edition - Big Nerd Ranch
Check out our blog post Migrating to Unified Logging, Swift Edition from Big Nerd Ranch. Learn more and read it now!
It's the most popular question since the release of Xcode 10 - ”Where's the Library?”.
So this article describes some tips on how to simplify the process of working with new library popup.
The most useful tip is you need to hold the Option (⌥) key to keep the popup visible until you close it yourself.
https://useyourloaf.com/blog/xcode-10-library-tips/
So this article describes some tips on how to simplify the process of working with new library popup.
The most useful tip is you need to hold the Option (⌥) key to keep the popup visible until you close it yourself.
https://useyourloaf.com/blog/xcode-10-library-tips/
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
https://www.hackingwithswift.com/articles/128/array-performance-append-vs-reservecapacity
#swift #performance
Hacking with Swift
Array performance: append() vs reserveCapacity()
Sometimes its faster to let Swift figure things out for you
A step by step guide how to build an iOS app without Xcode's Build System. Why lol?
https://vojtastavik.com/2018/10/15/building-ios-app-without-xcode/
#iOS
https://vojtastavik.com/2018/10/15/building-ios-app-without-xcode/
#iOS
https://www.wtfautolayout.com/ 오토레이아웃이 깨지거나, 콘솔에 뜨는 로그를 넣으면 왜 깨지는지 알려 줍니다.
WTF Auto Layout?
Make sense of cryptic Auto Layout error logs.
There's an awesome tool I've found.
”It injects itself into the iOS Simulator so that it can monitor views and adjust them in real time.”
https://www.hackingwithswift.com/articles/131/sherlock-turbocharges-your-ios-simulator
#iOS #simulator
”It injects itself into the iOS Simulator so that it can monitor views and adjust them in real time.”
https://www.hackingwithswift.com/articles/131/sherlock-turbocharges-your-ios-simulator
#iOS #simulator
Hacking with Swift
Sherlock turbocharges your iOS simulator
Inspect and adjust any app in real time
There's a new hype post about snapshot testing on Twitter provided by guys from the Point Free. Many fellows liked it and highly recommend to try it out, so I can't miss to share it with you.
https://www.pointfree.co/blog/posts/23-snapshottesting-1-0-delightful-swift-snapshot-testing
#iOS #swift #Tests #snapshot_testing
https://www.pointfree.co/blog/posts/23-snapshottesting-1-0-delightful-swift-snapshot-testing
#iOS #swift #Tests #snapshot_testing
www.pointfree.co
SnapshotTesting 1.0: Delightful Swift snapshot testing
Today we are open sourcing SnapshotTesting 1.0: a modern, composable snapshot testing library built entirely in Swift!
Implementing the Coordinator pattern using UIResponder. 🤔
”With this approach, you can:
1. Call a Coordinator's method from anywhere: view controller, view, button's event handler, table/collection view cell, UIAlertAction etc.
2. That call will be passed up the responder chain until it reaches some Coordinator instance which overrides that method.”
…
http://aplus.rs/2018/coordinator-missing-pattern-uikit/
#iOS #coordinators #architecture
”With this approach, you can:
1. Call a Coordinator's method from anywhere: view controller, view, button's event handler, table/collection view cell, UIAlertAction etc.
2. That call will be passed up the responder chain until it reaches some Coordinator instance which overrides that method.”
…
http://aplus.rs/2018/coordinator-missing-pattern-uikit/
#iOS #coordinators #architecture
There’s one more article about new features in Swift 5 - Custom String Interpolation. Also don’t forget to check out the “Where next?” section at the end of the article to see more examples related to this feature.
p.s. Developers are still resting after the holidays - few articles only 🙂
https://www.hackingwithswift.com/articles/163/how-to-use-custom-string-interpolation-in-swift
p.s. Developers are still resting after the holidays - few articles only 🙂
https://www.hackingwithswift.com/articles/163/how-to-use-custom-string-interpolation-in-swift
Hacking with Swift
How to use custom string interpolation
Control how types look in strings, or create them from scratch.