At some point you will want to present a list of items to your users and prompt them to select one. Whilst a spinner is an OK option I prefer the Alert Controller. It’s simple to use and doesn’t take up any screen space until you need it.

1. Create a new UIAlertController and specify that this is a preferred style of “.actionSheet”. Action sheet implies we’re going to present a whole bunch of options:

2. Add some actions to the alert:

Note that you can add as many actions as you like.

3. Finally you need to show the action. This is usually performed in your view controller class (hence the “self” ):

Optionally you can specify a further action once the alert has been shown.

The alert controller is very useful when requesting your user to select from a medium sized list of items.

Where to go Next

This tutorial comes straight out of The Complete iOS Developer Course. Over 40 hours long it contains everything you need to create awe inspiring apps fast!

Click here to check it out!

How to Show an Alert with a List of Items in Swift 3 and iOS 10

One thought on “How to Show an Alert with a List of Items in Swift 3 and iOS 10

  • June 30, 2017 at 4:22 pm
    Permalink

    Works for me! Tks! 🙂

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Share This

Want this Post in Easy to Understand Video Form?

Then get the Complete iOS Developer Course. Over 50 hours of pure Swift coding goodness designed to turn you into a coding master!

One Time Offer - $9! Click to Get it!



WARNING: Once this box is closed the offer will not be shown again.

Thank you!