There are a lot of different ways to check what device the user is currently using to use your application, one of the quickest ways is to use UIDevice class, like this:

let isIpad = UIDevice.current.userInterfaceIdiom == .pad
print(isIpad)

There you have it, enjoy!

--

--

UINavigationBar in iOS 13 and above has so many new APIs that changed the way we modify the navigationBar such as UINavigationBarAppearance. In the article, let’s look at how we change the tint color of UINavigationBar in iOS13 and above:

In SceneDelegate.swift, add the below code:

Build and run the project, you will see the navigation bar tint color has successfully changed.

--

--

Photo by Jay Mantri on Unsplash

In this article, let’s take a look at the code to see how we can persist UIColor using UserDefaults API between app launches.

Before we can store the color into the UserDefaults storage, we first need to turn UIColor to NSData using NSKeyedArchiver and vice versa.

Here is how you will use it in your project:

Awesome!

--

--

Photo by Mika Baumeister on Unsplash

When working with data, you need a data persistence solution so that when users terminate the app and open back in, the state of your data is still there.

Here, let’s take a look of a data persistence solution utilized FileManager that can be reused across several projects without re-writing every time.

--

--

I’m back with another article after a long break to focus on interview preparation for a job. Today, I will share with you the code on how to build the above star view.

  1. Go to the Assets.xcassets folder in Xcode and add any star image you found on the Web and name it “Star”.
  2. Copy this code below and use it in your project.

3. Profit!

That’s it for this quick article guys! I hope you have a fantastic day/night or anything in between. See you!

--

--

Parse JSON is one of the most common tasks when working as a developer. In this article, let’s take a look at how we can quickly make a GET request using Alamofire and parse JSON with Codable protocol:

First step is to set up the Model object, make sure it conforms to Codable protocol:

Next step is making a GET request to a remote server using Alamofire, make sure you have Alamofire imported:

I just recently have a chance to use Alamofire in a project and love it, it makes sending network requests very simple.

That’s it for today's writing. Thank you for reading!

--

--

Photo by Bench Accounting on Unsplash

Hey there! I’m back with another article. Today, I will show you how to add bottom refresh control to your UICollectionView in own your app, so let’s get started!

First step is to make a class called FooterView, we want to put the refresh control in the footer view, like so:

Next step, register the above footer view for your UICollectionView,

Third step, create a spinner or UIActivityIndicatorView:

Final step, hook up everything:

That’s the end of this article my friend!

Have a great day.

--

--

Photo by Jess Bailey on Unsplash

When dealing with color, my favorite feature built-in Xcode is Color Literal, by using it, I can grasp a color, any color that this universe has to offer to use it in my Xcode project. So, let’s go out on the Internet and get a nice color, for instance, the special green color from raywenderlich.com.

So, there’s you have it. Have a great day and I will see you in the next article.

--

--