⛄ Winter season was full of holidays, so this time we will recap iOS development tweets from January and February together. Last two months community shared nice debugging tips, advices on improving Xcode performance and smart ways to use functions in Swift. And I love that every month we see some interesting ideas how to write a more readable code. Good sign!
Hope, you will find useful tips and advices you didn’t notice before.
Twitter tip #1
This one is a true gem 💎 You should definitely enable mentioned build option to get notified about API availability issues in your Objective-C projects. We need more ObjC tips!
Twitter tip #2
Want to improve Xcode performance a bit here and there, after the remote debugging session? Just don’t forget to disable wireless debugging when you don’t need it :)
Twitter tip #3
If you heavily rely on logs during debugging you may find this little trick pretty useful:
Twitter tip #4
More debugging tips 🛠 So CustomDebugStringConvertible protocol makes a lot of difference while debugging. Confirm your type to this protocol and add a debugDescription String property to put useful debug information there. Voilà!
Twitter tip #5
Not the exact tip, but a useful reminder for working with LLDB commands:
Twitter tip #6
This list of strings is a pure gem! Check out the original repository to ensure that your validation check mechanism works as expected.
Twitter tip #7
A critical note to keep in mind: if you need to use a production CloudKit environment, just set a com.apple.developer.icloud-container-environment in entitlement to Production. That easy!
Twitter tip #8
If you’re using xcconfig file to manage multiple builds you’ll find this option pretty handy.
Twitter tip #9
In case you have ever wondered why Xcode code completion doesn’t tell you anything for initializers… That’s because you were asking for a wrong thing :) Now you know:
Twitter tip #10
Xcode 9.3b3 contains a new command-line tool
xccov. It allows you easily explore Xcode coverage reports in a “human-readable” way (according to official changelog).
Twitter tip #11
A simple way to match an optional value in a switch-case construction. Just add
? suffix to every pattern you have. Neat!
Twitter tip #12
A great little tip on how to make your code more readable and understandable. Forget old habits and don’t be scared to drop suffix away in your method name, you won’t regret it. And don’t forget to take a look at comments to John’s tweet :)
Twitter tip #13
A powerful & simple method for changing Bool value to its opposite. This kind of things makes your code more understandable for sure.
Twitter tip #14
Embrace the full power of functions in Swift. By calling instance method as a static function you’ll get a closure which represents the actual instance method.
Twitter tip #15
And by using “class” keyword you can constraint a protocol to a case, where you need its instances to be always mutable:
Twitter tip #16
A worth notice while working with URL/NSURL. Be careful with a comparison of relative and absolute URLs as they won’t be equal.
Twitter tip #17
Jordan Rose pointed out on a crucial note with using NSRegularExpression. Just remember that and try not to fall into a trap! Otherwise, you may waste days debugging.
Twitter tip #18
Did you know that’s it’s possible to override a stored property with a computed property and still have access to a superclass storage? Definitely, that might be useful in some cases.
Twitter tip #19
It’s better to be aware of APFS if you heavily rely on the file system in your application. Here is a nice code snippet to define where APFS is used:
Twitter tip #20
A great way to initialize UIEdgeInsets without unnecessary hassle. This extension must be in the standard library for sure.
Twitter tip #21
Do not test In-App-Purchase on your personal device or you’ll be stuck in infinite login alert loop forever. A useful note from Marcos Griselli:
Twitter tip #22
This handy Sequence extension will help to group your custom entities by some property that you’ve specified:
Twitter tip #23
Not entirely a development tip, but worth mentioning. If you want to increase your screen space — just use dark menu bar and you’ll get 1 extra pixel. I don’t know why but makes me smile :)
🙈 Twitter fun
And some funny moments to make you smile:
What a huge list of tips and funny tweets we got this time! Will see if March brings us so many great tips as well. Happy learning & coding!