What's New / App Services, Foundation & Diagnostics

What's new in PhotosUI

+8 New~2 DeprecatediOS · macOS · visionOS

PhotosUI provides SwiftUI and UIKit components for picking and displaying photo library content, including the system photo picker and views for posting to shared albums.

The 27 SDK adds 8 APIs and deprecates 2. New types include PHPickerSearchText, PHSharedAlbumCreationConfiguration, PHSharedAlbumCreationResult, the ExtensionHostNotifying protocol, the PHSharedAlbumCreationViewController and PHSharedAlbumPostingViewController controllers, and the View.photosSharedAlbumPostingSheet modifier. The two deprecations are overloads of View.postToPhotosSharedAlbumSheet, replaced by the new posting-sheet modifier.

New

8
protocol

ExtensionHostNotifying

NewvisionOS
public protocol ExtensionHostNotifying : AnyObject
Declaration
@MainActor public protocol ExtensionHostNotifying : AnyObject {

    @MainActor func notifyBeganGenerating()

    @MainActor func notifyEndedGenerating()

    @MainActor func notifyReadyForTermination()

    @MainActor func notifyFailure()

    @MainActor func notifyBeganGeneratingEnvironment(withUUID id: UUID)
}
struct

PHPickerSearchText

NewiOSmacOS
public struct PHPickerSearchText : Equatable, Hashable, @unchecked Sendable

A search text for PHPickerViewController.

Declaration
public struct PHPickerSearchText : Equatable, Hashable, @unchecked Sendable {

    /// Creates a search text from a string.
    @available(watchOS, unavailable)
    public init(_ string: String)

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: PHPickerSearchText, b: PHPickerSearchText) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
struct

PHSharedAlbumCreationConfiguration

NewiOSmacOS
public struct PHSharedAlbumCreationConfiguration : Equatable, Hashable

An object used to configure a PHSharedAlbumCreationViewController.

Declaration
public struct PHSharedAlbumCreationConfiguration : Equatable, Hashable {

    /// The photo library in which the shared album will be created.
    public let photoLibrary: PHPhotoLibrary

    /// The default title for the shared album. Useful for suggesting a relevant title to the user. Defaults to `nil`.
    public var defaultTitle: String?

    /// The default sharing policy of the shared album. If not specified, this defaults to `PHSharedAlbumCreationSharingPolicyPrivate`.
    public var defaultPolicy: PHSharedAlbumCreationSharingPolicy

    /// - Parameters:
    ///     - photoLibrary: The photo library in which the shared album will be created.
    public init(photoLibrary: PHPhotoLibrary)

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: PHSharedAlbumCreationConfiguration, b: PHSharedAlbumCreationConfiguration) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
struct

PHSharedAlbumCreationResult

NewiOSmacOS
public struct PHSharedAlbumCreationResult : Equatable, Hashable, Sendable

The result of a user creating a shared album.

Declaration
public struct PHSharedAlbumCreationResult : Equatable, Hashable, Sendable {

    /// The identifier of the created shared album.
    public var albumIdentifier: String { get }

    /// The URL of the created shared album.
    public var albumURL: URL { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: PHSharedAlbumCreationResult, b: PHSharedAlbumCreationResult) -> Bool

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }
}
extension

PHSharedAlbumCreationViewController

NewiOSmacOS
extension PHSharedAlbumCreationViewController
Declaration
extension PHSharedAlbumCreationViewController {

    /// Returns a view controller that allows the user to create a new shared album.
    ///
    /// - Parameters:
    ///   - configuration: The configuration for creating a new shared album.
    @MainActor @preconcurrency public convenience init(configuration: PHSharedAlbumCreationConfiguration)
}
extension

PHSharedAlbumPostingViewController

NewiOSmacOS
extension PHSharedAlbumPostingViewController
Declaration
extension PHSharedAlbumPostingViewController {

    /// Returns a view controller that allows the user to create a new shared album.
    ///
    /// - Parameters:
    ///   - items: The items to be posted to the shared album.
    ///   - defaultAlbumIdentifier: Identifier for the shared album to be pre-selected. If none provided, the user can manually choose a shared album.
    ///   - photoLibrary: The photo library to choose from.
    @MainActor @preconcurrency public convenience init(items: [PHPickerResult], defaultAlbumIdentifier: String?, photoLibrary: PHPhotoLibrary)
}
func

View.photosSharedAlbumPostingSheet

NewiOSmacOS
nonisolated public func photosSharedAlbumPostingSheet(isPresented: Binding<Bool>, items: [PhotosPickerItem], defaultAlbumIdentifier: String? = nil, photoLibrary: PHPhotoLibrary, completion: ((Result<String, any Error>) -> Void)? = nil) -> some View

Presents an "Add to Shared Album" sheet that allows the user to post the given items to a shared album.

Parameters

isPresented
The binding to whether the sheet should be shown.
items
The items to be posted to the shared album.
defaultAlbumIdentifier
Identifier for the shared album to be pre-selected. If none provided user can manually choose the shared album in UI.
photoLibrary
Library to choose from.
completion
Called with the result on completion of the request.
func

View.photosSharedAlbumPostingSheet

NewiOSmacOS
nonisolated public func photosSharedAlbumPostingSheet(isPresented: Binding<Bool>, items: [PHPickerResult], defaultAlbumIdentifier: String? = nil, photoLibrary: PHPhotoLibrary, completion: ((Result<String, any Error>) -> Void)? = nil) -> some View

Presents an "Add to Shared Album" sheet that allows the user to post the given items to a shared album.

Parameters

isPresented
The binding to whether the sheet should be shown.
items
The items to be posted to the shared album.
defaultAlbumIdentifier
Identifier for the shared album to be pre-selected. If none provided user can manually choose the shared album in UI.
photoLibrary
Library to choose from.
completion
Called with the result on completion of the request.

Deprecated

2
func

View.postToPhotosSharedAlbumSheet

DeprecatediOS
nonisolated public func postToPhotosSharedAlbumSheet(isPresented: Binding<Bool>, items: [PhotosPickerItem], photoLibrary: PHPhotoLibrary, defaultAlbumIdentifier: String? = nil, completion: ((Result<Void, any Error>) -> Void)? = nil) -> some View

Presents an "Add to Shared Album" sheet that allows the user to post the given items to a shared album.

Parameters

isPresented
The binding to whether the sheet should be shown.
items
The items to be posted to the shared album.
photoLibrary
Library to choose from.
defaultAlbumIdentifier
Identifier for the shared album to be pre-selected. If none provided user can manually choose the shared album in UI.
completion
Called with the result on completion of the request.
func

View.postToPhotosSharedAlbumSheet

DeprecatediOS
nonisolated public func postToPhotosSharedAlbumSheet(isPresented: Binding<Bool>, items: [PHPickerResult], photoLibrary: PHPhotoLibrary, defaultAlbumIdentifier: String? = nil, completion: ((Result<Void, any Error>) -> Void)? = nil) -> some View

Presents an "Add to Shared Album" sheet that allows the user to post the given items to a shared album.

Parameters

isPresented
The binding to whether the sheet should be shown.
items
The items to be posted to the shared album.
photoLibrary
Library to choose from.
defaultAlbumIdentifier
Identifier for the shared album to be pre-selected. If none provided user can manually choose the shared album in UI.
completion
Called with the result on completion of the request.

No APIs match your filter.

← More in App Services, Foundation & Diagnostics