Snippet of the Week: Rating Your App ⭐️
Everyone knows that a 5-star rating on the App Store is a great way to convince other users to download your app. And of course, we try to avoid 1-star reviews like the plague. However, how do you convince your user to leave a review?
Snippet of the Week: Lighter and Darker Colors 🎨
Especially when you’re prototyping user interfaces, you tend to use quite a bit of colors, especially colors that are derived from one another. You might have defined a base color; for example
UIColor.purple. But afterwards, you might also need a darker version for shadows, or a lighter version for emphasis. Instead of opening an color picker and searching around for awhile, consider how easy it would be if you could just do;
UIColor.purple.lightened. Let’s do this!
Snippet of the Week: Prototyping Views in Playgrounds
Swift Playgrounds are great and a fantastic tool to prototype and design your views in. But until recently, I’ve only been using them a lot for prototyping algorithms on models, not views, since somehow I could never get Playgrounds to show my views correctly. I’ve figured out the gotcha’s though and wanted to share them with you!
Snippet of the Week: Pinning Views
Sometimes you just need to create AutoLayout constraints in code. Maybe you can’t (or won’t) use Interface Builder. Or you still have to support iOS 8, which means
UIStackView is out (though you can use OAStackView if you want). But, handling the
NSLayoutConstraint API is pretty cumbersome, especially for seemingly ‘simple’ layouts.
Snippet of the Week: `NSLocalizedString(_:)`
It’s a good habit to start localizing all your user-facing strings from the get-go, even if you’re just tinkering around on a side project. But, while this is a good habit, it riddles your code with strings like these;