Display AlertController with ActionSheet in Swift (XCODE 8.3)

Last Updated: October 24, 2017

You can display list of items (Action Sheet ) with the UIAlertController in the iOS application

In the following example I have created Alert Controller to select the theme.
Simulator Screen Shot Oct 24 2017 1.31.15 PM

This is the Swift code required to make the Alert Sheet in your iOS app development

 let uiAlertControl = UIAlertController(title: "Theme", message: "Please Select the Theme", preferredStyle: .actionSheet)
            uiAlertControl.addAction(UIAlertAction(title: "Dark Theme", style: .default, handler: { (_) in
                print("Dark Theme")
              })
            )
        
            uiAlertControl.addAction(UIAlertAction(title: "Light Theme", style: .default, handler: { (_) in
                print("Light Theme")
              })
            )
        
        uiAlertControl.addAction(UIAlertAction(title: "Autumn Theme", style: .default, handler: { (_) in
            print("Autumn Theme")
        })
        )
        
        
      
        uiAlertControl.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
        self.present(uiAlertControl, animated: true, completion: nil)
        
Test