Source: hamedulu01.medium.com

Using the New PHPicker With SwiftUI
In this article, I will walk you through how to use PHPicker in a SwiftUI app. Here’s the final code base on GitHub: These are the dependencies in this app: We will implement this app with the following steps: Let’s suppose that we will implement the functionality of picking a photo from the Photo Library and displaying it on a list. So we have a photo list in this app that looks like this: Sample app

In order to use PHPicker in SwiftUI, we need to prepare the view that conforms to the UIViewRepresentable protocol and create an instance of PHPicker inside of it. Ths step of connecting to PHPicker goes as follows: So, create ImagePicker.swift at the root folder: makeUIViewController is in charge of creating an instance of PHPicker and returning it.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners