-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MacPaw' into MacPaw.streamable_symmetry
- Loading branch information
Showing
35 changed files
with
1,660 additions
and
622 deletions.
There are no files selected for viewing
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
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,65 @@ | ||
// | ||
// View.swift | ||
// | ||
// | ||
// Created by James J Kalafus on 2024-02-03. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension View { | ||
|
||
@inlinable public func navigationTitle(_ titleKey: LocalizedStringKey, selectedModel: Binding<String>) -> some View { | ||
self | ||
.navigationTitle(titleKey) | ||
.safeAreaInset(edge: .top) { | ||
HStack { | ||
Text( | ||
"Model: \(selectedModel.wrappedValue)" | ||
) | ||
.font(.caption) | ||
.foregroundColor(.secondary) | ||
Spacer() | ||
} | ||
.padding(.horizontal, 16) | ||
.padding(.vertical, 8) | ||
} | ||
} | ||
|
||
@inlinable public func modelSelect(selectedModel: Binding<String>, models: [String], showsModelSelectionSheet: Binding<Bool>, help: String) -> some View { | ||
self | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarTrailing) { | ||
Button(action: { | ||
showsModelSelectionSheet.wrappedValue.toggle() | ||
}) { | ||
Image(systemName: "cpu") | ||
} | ||
} | ||
} | ||
.confirmationDialog( | ||
"Select model", | ||
isPresented: showsModelSelectionSheet, | ||
titleVisibility: .visible, | ||
actions: { | ||
ForEach(models, id: \.self) { (model: String) in | ||
Button { | ||
selectedModel.wrappedValue = model | ||
} label: { | ||
Text(model) | ||
} | ||
} | ||
|
||
Button("Cancel", role: .cancel) { | ||
showsModelSelectionSheet.wrappedValue = false | ||
} | ||
}, | ||
message: { | ||
Text( | ||
"View \(help) for details" | ||
) | ||
.font(.caption) | ||
} | ||
) | ||
} | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.