iOS Tutorial in Using a Logo Image as Navigation Bar Title instead of a Plaintext.

Swift 4, Xcode 9.2

1.Assign value to navigation controller, UIImage. Adjust size by dividing frame and Image size.

func addNavBarImage() {        let navController = navigationController!        let image = UIImage(named: "logo-signIn6.png") //Your logo url here
let imageView = UIImageView(image: image)
let bannerWidth = navController.navigationBar.frame.size.width
let bannerHeight = navController.navigationBar.frame.size.height
let bannerX = bannerWidth / 2 - (image?.size.width)! / 2
let bannerY = bannerHeight / 2 - (image?.size.height)! / 2
imageView.frame = CGRect(x: bannerX, y: bannerY, width: bannerWidth, height: bannerHeight)
imageView.contentMode = .scaleAspectFit
navigationItem.titleView = imageView

Note on the image asset. Before uploading, I adjusted the logo with extra margins rather than cropped at the edges.

Final result:

I’ve published this answer in Stackoverflow.

Useful reminders in Git I found here.


When in the process of learning Git, make a habit of following these steps:

Did your Xcode just stopped letting you test app on your iPhone?

Your receiving the following Xcode error:

Swift Sdtlib tool error: Task failed with exit code 1

I use macOS High Sierra, Xcode 9.2: This worked for me.

Restarting xcode or macbook, dragging and dropping certificate in the keychain did not work for me.

SIGABRT (Signal abort) indicates that the app crash due to failure to access something which is nil or doesn’t exist, usually in my experience it’s Outlets.

2. Make sure you remove the connections with yellow warnings. These are invalid outlets.

Debug error

Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - 
perhaps the designated entry point is not set?

Not appearing in the Simulator along with a black screen. I did the following in order for my app to appear in the Simulator.

I have experienced this with my Tab Bar Controller not appearing in the Simulator along with a black screen. I did the following in order for my app to appear in the Simulator.

GitHub problem: “Your Contributions” section doesn’t show any recent activity.

In Github, I noticed a non-committer author.

Even though I made commits in Xcode. There was no contributions in the ‘Your Contributions` Calendar.


Change Committer Name and Email Globally
The email address used for the commits must be associated with your GitHub account.

In the Terminal:

$ git config --global "Full Name"
$ git config --global ""

See also GitHub Help: Setting your commit email address in Git

Displaying a picture in a circle.

Swift 4: This should display an image in a circle for iOS.

cornerRadius The radius to use when drawing rounded corners for the layer’s background. Animatable.

clipsToBounds property A Boolean value that determines whether subviews are confined to the bounds of the view.

2.Inside viewDidLoad(), Use the instance property layer.cornerRadius and clipsToBounds.

profileImage.layer.cornerRadius = 50
profileImage.clipsToBounds = true

Lets start creating

January marks the beginning of “the iOS developer’s path”- my long-term path to programming mastery. It might take thousands of hours of practice, but I am enjoying it to the bitter end. I’m not normally one who discuss or share “news” designed to create outrage or sarcasm, especially not on my blog, so be rest assured there won’t be any rant post.

Most of my postings are to match Apple’s documentation and community-accepted best practices. Some are derived from books, courses and networks. This blog is mainly targeted toward iOS development, but definitely applies to Mac as well.

Here’s a…

Cons Bulaquena

Developer & Designer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store