-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TimecodeField
: Refactored separators to their own view, resovled so…
…me view layout issues
- Loading branch information
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
Sources/TimecodeKitUI/SwiftUI/TimecodeField/TimecodeField SeparatorView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// TimecodeField SeparatorView.swift | ||
// TimecodeKit • https://github.com/orchetect/TimecodeKit | ||
// © 2020-2024 Steffan Andrews • Licensed under MIT License | ||
// | ||
|
||
#if canImport(SwiftUI) | ||
|
||
import SwiftUI | ||
import TimecodeKitCore | ||
|
||
@available(macOS 14, iOS 17, *) | ||
@available(watchOS, unavailable) | ||
@available(tvOS, unavailable) | ||
extension TimecodeField { | ||
/// Timecode separator view. | ||
struct SeparatorView: View { | ||
// MARK: - Properties settable through view initializers | ||
|
||
let text: String | ||
|
||
// MARK: - Properties settable through custom view modifiers | ||
|
||
@Environment(\.timecodeSeparatorStyle) private var timecodeSeparatorStyle: Color? | ||
|
||
// MARK: - Body | ||
|
||
var body: some View { | ||
ZStack { | ||
Text(text) | ||
.lineLimit(1) | ||
.fixedSize() | ||
.allowsTightening(false) | ||
.conditionalForegroundStyle(timecodeSeparatorStyle) | ||
} | ||
} | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters