-
-
Notifications
You must be signed in to change notification settings - Fork 465
Expand file tree
/
Copy pathSaverOptions.swift
More file actions
46 lines (41 loc) · 1.48 KB
/
SaverOptions.swift
File metadata and controls
46 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// LICENSE: see License.md in the package root
import Foundation
import UIKit
import UniformTypeIdentifiers
@objc public class SaverOptions: NSObject {
@objc public var transitionStyle: UIModalTransitionStyle
@objc public var presentationStyle: UIModalPresentationStyle
@objc public var initialDirectoryUrl: URL?
@objc public var sourceUrls: [URL]
@objc public var shouldShowFileExtensions: Bool
@objc public var asCopy: Bool
@objc public var fileName: String?
@objc public var data: String?
@objc public var uri: String?
@objc public override init() {
transitionStyle = .coverVertical
presentationStyle = .fullScreen
initialDirectoryUrl = nil
sourceUrls = []
shouldShowFileExtensions = true
asCopy = true
fileName = nil
data = nil
uri = nil
super.init()
}
@objc public init(sourceUrlStrings: [String], asCopy: Bool, initialDirectoryUrl: String? = nil, shouldShowFileExtensions: Bool, transitionStyle: UIModalTransitionStyle = .coverVertical, presentationStyle: UIModalPresentationStyle = .fullScreen) {
self.sourceUrls = sourceUrlStrings.map({ it in
URL(string: it)!
})
self.asCopy = asCopy
self.transitionStyle = transitionStyle
self.presentationStyle = presentationStyle
if let unwrappedUrl = initialDirectoryUrl, let url = URL(string: unwrappedUrl) {
self.initialDirectoryUrl = url
} else {
self.initialDirectoryUrl = nil
}
self.shouldShowFileExtensions = shouldShowFileExtensions
}
}