Skip to main content

Gradient tint over a background image

How to apply a gradient tint over a background image?

Set the background image

The first step is to set the background image.  I wanted the image to cover the entire device, so scale aspect fill will be required.

self.backgroundImage = UIImageView(image: UIImage(named: "bgkMain"))
self.backgroundImage.contentMode = .scaleAspectFill
self.view.insertSubview(self.backgroundImage, at: 0)


date formatter

Working on formatting the date in Xcode, and you come across the situation where you need to check or test the date format.  NSDateFormatter is a great site to check your date format string.  I wanted to transform the 2019-08-15 10:34:49+1000 to Aug 15, 12:34 AM.

Number decimal places

Adding a floating decimal point for n number of places is quite easy to achieve.  The key to understand is the receive an outcome of a fraction the numbers need to be Double.  So Int numbers will result in a whole number product.  By way of example:

  • 80 / 3 = 26

We know that this result is incorrect.  To get the correct outcome the equation needs to be as follows:

Removing warnings

During the process of building the app, there are warnings about the code.  It's good practice to remove all warnings before you submit your apps to the App Store so there's a few steps you can follow to silence these warnings:

  1. Navigate the the Project Settings page below;
  2. Select the drop down menu next to Devices;
  3. Change from Universal to iPhone; then
  4. Run your app again and the warnings should disappear.

dyld: lazy symbol binding failed: can't resolve symbol

If you have this error, the core issue is the dyld issue.


dyld is a shared library (dylib).

The error is a product where the library path cannot be found at run time.  Most likely you have installed a framework to your project and there is an issue in the standard location (such as /Library/Frameworks) on your build and the framework that you have added.

Subscribe to App