SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Implement Action Sheet and Image Picker

Implement an Action Sheet and Popover (for regular size class on iPad) to pick an image from Photo Library or Camera; the Image will later be fed to the Core ML Image Classification Model.

Overview

You will learn

  • ✔How to implement and Action Sheet and make sure it will automatically be replaced with a Popover when running on regular size class on iPad
  • ✔How to implement an Image Picker using Camera or Photo Library
Kevin Muessig K Kevin Muessig August 21, 2026
Created on January 9, 2023
Contributors

More from Kevin Muessig

See all 13 tutorials by Kevin Muessig →

Prerequisites

  • Development environment: Apple Mac running macOS Catalina or higher with Xcode 12 or higher
  • SAP BTP SDK for iOS: Version 6.0 or newer

Steps

Details

You will learn

  • How to implement and Action Sheet and make sure it will automatically be replaced with a Popover when running on regular size class on iPad
  • How to implement an Image Picker using Camera or Photo Library

Step 1 Add a Bar Button Item to Overview View Controller
—

In order for the user to pick an image for the classification you will implement a Bar Button Item bringing up an Action Sheet or a Popover when running on Regular mode on iPad.

  1. To do so open the Main.storyboard and locate the Overview View Controller. Use the Object Library to drag a Bar Button Item onto the Navigation Item of the Overview View Controller.

    Bar Button Item
    Bar Button Item

  2. Open the Assistant Editor in Xcode and create an IBOutlet for the Bar Button Item in the OverviewTableViewController.swift class by control + drag into the View Controller class, name it actionListButton and place it directly below the tableView outlet.

    Bar Button Item
    Bar Button Item

    In code the following line will appear:

    Swift
    
    @IBOutlet var actionListButton: UIBarButtonItem!
  3. Next you will need an IBAction for handling user’s interaction with that button.

    Create an IBAction in the OverviewTableViewController.swift class by control + drag into the View Controller class, choose Action this time instead of Outlet, name the action didPressActionListButton.

    Bar Button Item
    Bar Button Item

    The following method stub will appear in code:

    Swift
    
    @IBAction func didPressActionListButton(_ sender: UIBarButtonItem) {
    
    }
Step 2 Implement a UIImagePickerController
+
Step 3 Create segue and Product Classification Table View Controller
+
Step 4 Implement action for Bar Button Item
+
Step 5 Add permissions to Info.plist file
+
Step 6 Add back navigation
+
Step 7 Run app to see results of your work
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Add a Bar Button Item to Overview View Controller 2. Implement a UIImagePickerController 3. Create segue and Product Classification Table View Controller 4. Implement action for Bar Button Item 5. Add permissions to Info.plist file 6. Add back navigation 7. Run app to see results of your work
Next