Skip to content

Commit

Permalink
Merge pull request #44 from enebin/release/0.5.3
Browse files Browse the repository at this point in the history
Release/0.5.3
  • Loading branch information
enebin authored Jun 3, 2024
2 parents 334e5ab + bde72fc commit 66a9fac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
16 changes: 12 additions & 4 deletions Sources/Aespa/AespaOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public extension AespaOption {
/// The rule for naming video files.
public var fileExtension: String

init(
public init(
albumName: String?,
videoDirectoryName: String = "video",
photoDirectoryName: String = "photo",
Expand Down Expand Up @@ -103,27 +103,35 @@ public extension AespaOption {
/// An `AVCaptureDevice.DeviceType` value that determines camera device.
/// If not specified, the device is automatically selected.
public var cameraDevicePreference: AVCaptureDevice.DeviceType?

public init(cameraDevicePreference: AVCaptureDevice.DeviceType? = nil) {
self.cameraDevicePreference = cameraDevicePreference
}
}

/// `Log` provides an option for enabling or disabling logging.
struct Log {
/// Enable logging
public var loggingEnabled: Bool = true

public init(loggingEnabled: Bool) {
self.loggingEnabled = loggingEnabled
}
}
}

/// `AespaOption` extension related to file naming rules and file extensions.
public extension AespaOption {
/// `FileNamingRulePreset` provides pre-configured file naming rules.
enum FileNamingRulePreset {
struct Timestamp {
public struct Timestamp {
let formatter: DateFormatter
var rule: FileNamingRule {
public var rule: FileNamingRule {
return { formatter.string(from: Date()) }
}

/// Creates a `Timestamp` file naming rule.
init() {
public init() {
formatter = DateFormatter()
formatter.dateFormat = "yyyy_MM_dd_HH_mm_ss"
}
Expand Down
5 changes: 5 additions & 0 deletions Sources/Aespa/View/InteractivePreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public struct InteractivePreview: View {
.opacity(focusFrameOpacity)
.animation(.spring(), value: focusFrameOpacity)
}
.onChange(of: geometry.size) { newSize in
DispatchQueue.main.async {
layer.frame = CGRect(origin: .zero, size: newSize)
}
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions Sources/Aespa/View/Preview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ struct Preview: UIViewControllerRepresentable {

func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
previewLayer.videoGravity = gravity
uiViewController.view.layer.addSublayer(previewLayer)

previewLayer.frame = uiViewController.view.bounds
if previewLayer.superlayer == nil {
uiViewController.view.layer.addSublayer(previewLayer)
}
DispatchQueue.main.async {
self.previewLayer.frame = uiViewController.view.bounds
}
}

func dismantleUIViewController(_ uiViewController: UIViewController, coordinator: ()) {
Expand Down

0 comments on commit 66a9fac

Please sign in to comment.