Skip to content

Commit

Permalink
Update SecurityScopedAsset.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay committed Dec 10, 2024
1 parent 7571e97 commit b5f212b
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions Sources/WrkstrmFoundation/Persistence/SecurityScopedAsset.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation


/// A structure representing a security-scoped asset with its file path and associated bookmark data.
/// A structure representing a security-scoped asset with its file path and associated bookmark
/// data.
///
/// Security-scoped bookmarks allow an app to retain access permissions to files and directories
/// selected by the user, even after the app is relaunched. This structure pairs the asset's path
Expand Down Expand Up @@ -29,29 +29,29 @@ import Foundation
/// - Note: Security-scoped bookmarks are essential for maintaining file access across app launches
/// when working with files outside the app's sandbox.
public struct SecurityScopedAsset: Codable {
/// The file system URL representing the asset's location.
///
/// This URL points to the original location of the security-scoped resource. Note that the
/// actual file or directory might have moved since the bookmark was created, in which case
/// the bookmark data should be used to resolve the current location.
public let path: URL
/// The file system URL representing the asset's location.
///
/// This URL points to the original location of the security-scoped resource. Note that the
/// actual file or directory might have moved since the bookmark was created, in which case
/// the bookmark data should be used to resolve the current location.
public let path: URL

/// The security-scoped bookmark data for the asset.
///
/// This data allows the app to regain access to the resource in future launches. It should
/// be created using `URL.bookmarkData(options:)` with the `.withSecurityScope` option.
public let bookmarkData: Data
/// The security-scoped bookmark data for the asset.
///
/// This data allows the app to regain access to the resource in future launches. It should
/// be created using `URL.bookmarkData(options:)` with the `.withSecurityScope` option.
public let bookmarkData: Data

/// Creates a new security-scoped asset with the specified path and bookmark data.
///
/// - Parameters:
/// - path: The URL path to the asset
/// - bookmarkData: The security-scoped bookmark data that grants access to the asset
///
/// - Note: The bookmark data should be created with security scope options appropriate
/// for your use case, typically `.withSecurityScope`.
public init(path: URL, bookmarkData: Data) {
self.path = path
self.bookmarkData = bookmarkData
}
/// Creates a new security-scoped asset with the specified path and bookmark data.
///
/// - Parameters:
/// - path: The URL path to the asset
/// - bookmarkData: The security-scoped bookmark data that grants access to the asset
///
/// - Note: The bookmark data should be created with security scope options appropriate
/// for your use case, typically `.withSecurityScope`.
public init(path: URL, bookmarkData: Data) {
self.path = path
self.bookmarkData = bookmarkData
}
}

0 comments on commit b5f212b

Please sign in to comment.