Apps Developer Blog

Swift

In this short Swift code example, we will use the UIAlertController to create an alert dialog message with only one “OK” button. The code example below will demonstrate how to: Create UIAlertController with a Title and a Message to display, Add a UIAlertAction with the OK label to UIAlertController, Handle UIAlertAction to know when the user taps…

Read More Create UIAlertController with OK Button in Swift

The following Swift code example demonstrates how to create a UIWebView programmatically and how to make it render HTML code. To break it into smaller steps, the below code snippet demonstrates how to: Create UIWebView programmatically, Implement UIWebViewDelegate functions webViewDidStartLoad and webViewDidFinishLoad, Make UIWebView render HTML Code. Render HTML in UIWebView import UIKit import WebKit class…

Read More Create UIWebView Programmatically and Render HTML Code

The Swift code example below demonstrates how to create a UIWebView programmatically and how to load a webpage using the URL.  If we look at the below code example in details, it will also show how to: Create UIWebView programmatically, Implement the UIWebViewDelegate functions like the webViewDidStartLoad and the webViewDidFinishLoad Make UIWebView load a webpage…

Read More Create UIWebView Programmatically and Load Webpage Using URL

The following Swift code example demonstrates how to make UIImage corners rounded. Additionally, the code snippet below also demonstrates how to: Add a border around UIImage, Change the UIImage border color. Making UIImage Corners Rounded import UIKit class ViewController: UIViewController { @IBOutlet weak var profile_picture: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Make image borders rounded…

Read More Make UIImage Corners Rounded

The following Swift code snippet demonstrated how to make a UIImage circular.  It will also show how to: Make UIImage Circular programmatically and How to add a border around UIImage, Change UIImage border color. import UIKit class ViewController: UIViewController { @IBOutlet weak var profile_picture: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Make image circular profile_picture.layer.cornerRadius =…

Read More Make UIImage Circular Programmatically

The following Swift code example will demonstrate how we can customize UINavigationBar appearance in UIViewController. It will also cover how to: Set UINavigationBar tint color, Set Navigation bar Title color, Set navigation bar ItemButton tint color, Set Navigation bar background image. import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional…

Read More Customize UINavigationBar Appearance Programmatically in UIViewController

The Swift code example below demonstrates how to customize the UINavigationBar appearance via the AppDelegate.swift file. The blow Swift code example covers: Set UINavigationBar tint color, Set Navigation bar Title color, Set navigation bar ItemButton tint color, Set Navigation bar background image, Set navigation bar Back button tint color. import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate…

Read More Customize UINavigationBar Appearance Programmatically via AppDelegate

The below code snippet in Swift demonstrates how to create a UISegmentedControl programmatically. The code example below is very simple but additionally to creating a UISegmentedControl programmatically, it also demonstrates how to: Add a UISegmentedControl as a Subview Add custom function which gets triggered when UISegmentedControl value is changed Change UISegmentedControl tint colour Change UISegmentedControl background colour…

Read More Create UISegmentedControl in Swift Programmatically

The below Swift code example demonstrates how to create a UIStepper programmatically. If we break it down into smaller parts the code example below also demonstrates: How to add UIStepper as a Subview, Add custom function which gets triggered when UIStepper value is changed, Position UIStepper in the center of UIView, Make UIStepper value continuously increment…

Read More Create UIStepper Programmatically

In this short blog post, you will learn how to create a UIView in Swift programmatically. The code example below will cover the following: How to create UIView in Swift programmatically, How to add UIView as a Subview, Change UIView background color Add a border around UIView, Change UIView border color, Make UIView corners rounded.…

Read More Create UIView in Swift Programmatically

In this short Swift code example, you will learn how to create a UISlider Programmatically. The code example below will cover the following: Create UISlider programmatically, Position UISlider within a UIView, Set UISlider minimum and maximum values, Change UISlider tint color, Handle UISlider value changed event, Make UISlider sliding continuously, Make UISlider move in steps by…

Read More Create UISlider Programmatically in Swift

This short example demonstrates how to create a UISwitch in Swift programmatically. The Swift code snippet below will coder the following: Create UISwitch in Swift programmatically, How to position UISwitch on a view, How to set UISwitch state to On and Off, How to call your custom function when UISwitch state changes. import UIKit class…

Read More Create UISwitch in Swift Programmatically

In this short Swift code example, I am going to share with you how to load the content of a property file into NSDictionary. And in this particular example, I will load the content of the Info.plist file which is available in our projects. But you can use this approach to load up the content…

Read More Info.plist. Read Content of a Property File in Swift

Free Video Lessons

Enter your email and stay on top of things,

Subscribe!