Swift 4: Pull To Refresh / UIRefreshControl

TableViews can have a useful feature to refresh the data inside of them, simply pull to refresh. Apple didn’t invent this, that was Loren Brichter of Tweetie, which was sold to Twitter and Twitter was eventually granted a Patent for the feature. Today this feature is absolutely ambiguous and very easy to implement.

For example, if you add the following code to your viewDidLoad() Function

This will create a blue background and use white color for the spinner and text. When the pull to refresh gets executed it will execute the  reloadData() function.

 

You Might Also Like