Auto layout has become a crucial tool for iOS and OS X development. It makes creating layout for multiple screen sizes easy peasy. But sometimes it can drive you crazy, with verbose and misleading logs.
In iOS7 and OS X 10.9 Apple released NSProgess. Its a nice, helpful piece of code that was supposed to make our coding lifes easier. If you finally find a proper way to use it it can be very beneficial.
Besides of helpfull UserInfo object keys which give us comprehensive text information about progress of our tasks in proper language, NSProgress was supposed to provide us way of compositioning objects into trees. However, first version of class allowed this in an implicit way which does not look very clear first time you learn it.
This post is a quick update to Vombat’s blog post about using SQL instead of
NSDateFormatter when it comes to parsing dates in your project. If you don’t read it yet, I will highly recommend to do it now. This time we will use Swift to make same measurements.
You may haven’t heard about this law or if you have, you may have wondered who’s this Demeter guy. Regardless of it, the Law Of Demeter (LoD) is a foundation concept that’s used among several design patterns, to wit: Delegate, Proxy, Façade, Adapter and Decorator. Therefore, you probably are already taking advantage of this Law, knowing it or not.
Bash scripts are commonly used in Mac/iOS development to make repetitive operations hands-free. However sometimes things go wrong and in a perfect world I’d like to be properly informed about the errors. Here comes view called „Report Navigator”, which displays any type of errors, warnings at compile time of Objective-C/Swift, or even while typing new lines of code. Let me show how to use the Report Navigator.
I’m a huge fan of
UICollectionView. It’s way more customizable than his older brother
UITableView. Nowadays I use collection view even more often than table view. With iOS 9 it supports easy reordering. Before it wasn’t possible out of the box, and to do so means painful work. Let’s have look at the API. You can find the accompanying Xcode project on GitHub.
Developing multithreaded application is not something new and it’s become more and more popular with multicore processors. One thing it’s for sure, debugging multithread applications is tough.
iOS has some gotchas regarding multithread, things that if you don’t respect, may cause your application to crash or hang the users interface, for example:
Have you ever encountered a situation where you want to build some record or music app ? But you need to somehow react on a phone call which in many cases break recording or playing in more advanced app (mostly when it comes to
CoreAudio) or switch UI in case of call?
CoreTelephony is a great library which will help in most of the situations.
To detect phone call on your iPhone or iPad app (this may be the case now when we use continuity) simply use this piece of code:
UILabel properties cannot be easy animated due to some various reasons, so code like this will have no effect on it:
1 2 3 4 5 6 7
This error may happen when you try to load
UIImage and your asset string is
nil. For now this will not crash your app but may case some future problems. This may also lead to some UI inconsistency. To track down issue like this we need to set symbolic breakpoint: