Skip to content

Commit 0567894

Browse files
committed
SwiftFormat pass
1 parent ba8ed92 commit 0567894

200 files changed

Lines changed: 5465 additions & 5131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Examples/Movie Timecode/Movie Timecode/AddOrReplaceTimecodeTrackView.swift

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
//
22
// AddOrReplaceTimecodeTrackView.swift
33
// swift-timecode • https://github.com/orchetect/swift-timecode
4-
// © 2020-2025 Steffan Andrews • Licensed under MIT License
4+
// © 2026 Steffan Andrews • Licensed under MIT License
55
//
66

77
import Observation
8-
import SwiftUI
98
import SwiftTimecode
109
import SwiftTimecodeUI
10+
import SwiftUI
1111

1212
struct AddOrReplaceTimecodeTrackView: View {
1313
@Environment(Model.self) private var model
14-
14+
1515
@TimecodeState var newStartTimecode: Timecode
1616
@Binding var isExportProgressShown: Bool
17-
17+
1818
@State private var isFolderPickerShown: Bool = false
19-
19+
2020
var body: some View {
2121
VStack(spacing: 20) {
2222
Form {
2323
Text("Adds a new timecode track to the video, or replaces the existing timecode track if one is present.")
2424
Text("A copy of the video will be exported and the original file will remain unmodified.")
25-
25+
2626
Picker("Frame Rate", selection: $newStartTimecode.frameRate) {
2727
ForEach(TimecodeFrameRate.allCases) { frameRate in
2828
Text(frameRate.stringValueVerbose).tag(frameRate)
@@ -33,17 +33,17 @@ struct AddOrReplaceTimecodeTrackView: View {
3333
Text("\(subFramesBase.description)").tag(subFramesBase)
3434
}
3535
}
36-
36+
3737
HStack {
3838
Text("New Start Timecode")
3939
Spacer()
40-
40+
4141
TimecodeField(timecode: $newStartTimecode)
4242
.timecodeFormat([.showSubFrames])
4343
.timecodeSubFramesStyle(.secondary, scale: .secondary)
4444
.timecodeFieldValidationPolicy(.enforceValid)
4545
}
46-
46+
4747
LabeledContent("") {
4848
Button("Export") {
4949
isFolderPickerShown = true
@@ -55,11 +55,12 @@ struct AddOrReplaceTimecodeTrackView: View {
5555
.formStyle(.grouped)
5656
}
5757
.padding()
58-
58+
5959
#if os(macOS)
60-
// note that SwiftUI's .fileImporter does not produce a security-scoped URL suitable for writing to on macOS (but seems fine on iOS).
61-
// also, SwiftUI's .fileExporter insists on writing the data to disk for us with no way to write to the URL manually.
62-
// hence, our workaround is to use a custom NSOpenPanel wrapper.
60+
// note that SwiftUI's .fileImporter does not produce a security-scoped URL suitable for writing to
61+
// on macOS (but seems fine on iOS).
62+
// also, SwiftUI's .fileExporter insists on writing the data to disk for us with no way to write to
63+
// the URL manually. hence, our workaround is to use a custom NSOpenPanel wrapper.
6364
.fileOpenPanel(isPresented: $isFolderPickerShown) { openPanel in
6465
openPanel.canCreateDirectories = true
6566
openPanel.canChooseDirectories = true
@@ -82,14 +83,14 @@ struct AddOrReplaceTimecodeTrackView: View {
8283
.fileDialogConfirmationLabel("Export")
8384
#endif
8485
}
85-
86+
8687
private func handleResult(_ result: Result<URL, Error>) async {
8788
do {
8889
let folderURL = try result.get()
89-
90+
9091
isExportProgressShown = true
9192
defer { isExportProgressShown = false }
92-
93+
9394
await model.export(
9495
action: .replaceTimecodeTrack(startTimecode: newStartTimecode),
9596
toFolder: folderURL,

Examples/Movie Timecode/Movie Timecode/App/MovieTimecodeApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// MovieTimecodeApp.swift
33
// swift-timecode • https://github.com/orchetect/swift-timecode
4-
// © 2020-2025 Steffan Andrews • Licensed under MIT License
4+
// © 2026 Steffan Andrews • Licensed under MIT License
55
//
66

77
import SwiftUI

Examples/Movie Timecode/Movie Timecode/ContentView.swift

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
//
22
// ContentView.swift
33
// swift-timecode • https://github.com/orchetect/swift-timecode
4-
// © 2020-2025 Steffan Andrews • Licensed under MIT License
4+
// © 2026 Steffan Andrews • Licensed under MIT License
55
//
66

77
import SwiftUI
88

99
struct ContentView: View {
1010
@State private var model = Model()
11-
11+
1212
@State private var isFileImporterShown: Bool = false
1313
@State private var isExportProgressShown: Bool = false
1414
@State private var operationType: OperationType = .addOrReplaceTimecodeTrack
15-
15+
1616
var body: some View {
1717
NavigationStack {
1818
Form {
@@ -46,29 +46,27 @@ struct ContentView: View {
4646
}
4747
}
4848
}
49-
50-
@ViewBuilder
49+
5150
private var sourceSection: some View {
5251
Section("Source") {
5352
LabeledContent("Movie") {
5453
MultiplatformPathView(url: model.movieURL, isFileImporterShown: $isFileImporterShown)
5554
}
56-
55+
5756
LabeledContent("Detected Frame Rate") {
5857
Text(model.movieFrameRateString)
5958
}
60-
59+
6160
LabeledContent("Contains Timecode Track") {
6261
Text(model.containsTimecodeTrackString)
6362
}
64-
63+
6564
LabeledContent("Start Timecode") {
6665
Text(model.movieStartTimecodeString)
6766
}
6867
}
6968
}
70-
71-
@ViewBuilder
69+
7270
private var operationsSection: some View {
7371
Section("Timecode Track Operations") {
7472
if model.movie != nil {
@@ -83,7 +81,7 @@ struct ContentView: View {
8381
isExportProgressShown: $isExportProgressShown
8482
)
8583
}
86-
84+
8785
Tab(
8886
OperationType.removeTimecodeTrack.title,
8987
systemImage: OperationType.removeTimecodeTrack.systemImage,

Examples/Movie Timecode/Movie Timecode/Model/Model+Movie.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
2-
// Model.swift
2+
// Model+Movie.swift
33
// swift-timecode • https://github.com/orchetect/swift-timecode
4-
// © 2020-2025 Steffan Andrews • Licensed under MIT License
4+
// © 2026 Steffan Andrews • Licensed under MIT License
55
//
66

77
@preconcurrency import AVFoundation
@@ -12,12 +12,12 @@ extension Model {
1212
struct Movie: Equatable, Hashable, Sendable {
1313
let avMovie: AVMovie
1414
let url: URL?
15-
15+
1616
// cached metadata
1717
let frameRate: TimecodeFrameRate?
1818
let timecodeStart: Timecode?
1919
let containsTimecodeTrack: Bool
20-
20+
2121
init(
2222
url: URL,
2323
frameRate: TimecodeFrameRate?,
@@ -30,7 +30,7 @@ extension Model {
3030
self.timecodeStart = timecodeStart
3131
self.containsTimecodeTrack = containsTimecodeTrack
3232
}
33-
33+
3434
init(
3535
avMovie: AVMovie,
3636
frameRate: TimecodeFrameRate?,
@@ -51,7 +51,7 @@ extension Model.Movie {
5151
case removeTimecodeTrack
5252
case replaceTimecodeTrack(startTimecode: Timecode)
5353
}
54-
54+
5555
/// Creates a copy of the movie, performs the operation, exports to a new file,
5656
/// and optionally reveals the new file in the Finder (macOS only).
5757
func export(
@@ -61,14 +61,14 @@ extension Model.Movie {
6161
) async throws(ModelError) {
6262
do {
6363
let mutableMovie = try getMutableMovieCopy()
64-
64+
6565
switch action {
6666
case .removeTimecodeTrack:
6767
try await mutableMovie.removeTimecodeTracks()
68-
case .replaceTimecodeTrack(let startTimecode):
68+
case let .replaceTimecodeTrack(startTimecode):
6969
try await mutableMovie.replaceTimecodeTrack(startTimecode: startTimecode, fileType: .mov)
7070
}
71-
71+
7272
try await mutableMovie.export(to: url)
7373

7474
#if os(macOS)
@@ -82,7 +82,7 @@ extension Model.Movie {
8282
throw .exportError(err)
8383
}
8484
}
85-
85+
8686
/// Produces a mutable copy of the loaded movie.
8787
fileprivate func getMutableMovieCopy() throws(ModelError) -> AVMutableMovie {
8888
guard let mutableMovie = avMovie.mutableCopy() as? AVMutableMovie else {

0 commit comments

Comments
 (0)