In this short article we will see how to add activity indicator on top of UITableView.

For that, you have to create one tableView programmatically or using storyboard.

Step 1: Create one refresh control

// creating UIRefreshControl
lazy
var refreshControl: UIRefreshControl = {
let refreshControl = UIRefreshControl()// Add target for UIRefreshControlrefreshControl.addTarget(self, action: #selector(handleRefresh(_:)), for: UIControl.Event.valueChanged)// set tintColor for UIRefreshControlrefreshControl.tintColor = UIColor.greenreturn refreshControl}()@objc func handleRefresh(_ refreshControl: UIRefreshControl) {// do your refreshing partrefreshControl.endRefreshing()}

Step 2: Add UIRefreshControl in tableview

myTableView.addSubview(refreshControl)

Done😇😇😇

Hope you enjoyed reading this post!!

If you have any comment, question, or recommendation, feel free to post them in the comment section below!

Thank you!!! Happy coding.

--

--

In this small article we will see how to present a SwiftUI view as sheet and fullscreen.

Create one bool variable:

@State var show = false

To present view as fullscreen :

Button(action: {print(“Forgot tapped!”)self.show = true}) {Text(“Forgot Password?”).foregroundColor(Color(UIColor.PrimaryColor.MainColor)).fullScreenCover(isPresented: $show, content: {Home()})}
Fig1: full screen

To present view as sheet :

Button(action: {print(“Forgot tapped!”)self.show = true}) {Text(“Forgot Password?”).foregroundColor(Color(UIColor.PrimaryColor.MainColor)).sheet(isPresented: $show, content: {Home()})}

--

--

In this article, we will UIImagePickerController to get image from camera or gallery by following three simple steps:

Lets start,

Step 1 : Add ImagePickerManager

Create a swift file and add the below code and save in your project. We are creating a new swift file because we want our view controller clean.

Step 2: Add permission in Plist

Now add both Camera and Library permission in Plist as showing below.

--

--

In this article, we will create Underline segment control programmatically in 2 simple steps:

Step 1: Add extension in project.

Add both extensions (UIImage,SegmentControl) in your project.

Step 2: Add functions in view controller.

Add below functions in view controller and call CreateSegment() in viewdidload().

Boom💥 Boom💥

Hope you enjoyed reading this post!!

Please clap for the story if you enjoy it. Follow me and let us meet in the coming posts.

Thank you!!! Happy coding.

--

--

--

--

Nitish Kumar

Nitish Kumar

20 Followers

I developed and maintain applications aimed at a range of iOS devices including mobile phones and tablet computers.