Update demo to use SwiftUIKit 2.2
This commit is contained in:
parent
bdd9c0544c
commit
96b7b3de6a
|
@ -877,7 +877,7 @@
|
|||
repositoryURL = "https://github.com/danielsaidi/SwiftUIKit.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.0.0;
|
||||
minimumVersion = 2.2.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"repositoryURL": "https://github.com/danielsaidi/SwiftUIKit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ad509355ba9bc87f8375a297c3df93acd42e6c01",
|
||||
"version": "2.0.0"
|
||||
"revision": "7b38050373c6aafdaefe32a6fcfb8843b443a6d8",
|
||||
"version": "2.2.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Binary file not shown.
|
@ -13,18 +13,20 @@ import SwiftUIKit
|
|||
struct AuthenticationScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Authentication") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has auth services that simplifies using biometric authentication.")
|
||||
ListText("SwiftKit has auth services that simplifies using biometric authentication.")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .authentication, title: "Biometric Authentication")
|
||||
.navigationLink(to: BiometricAuthenticationServiceScreen())
|
||||
MenuListItem(icon: .data, title: "Cached Authentication")
|
||||
.navigationLink(to: CachedAuthenticationServiceProxyScreen())
|
||||
ListNavigationLink(destination: BiometricAuthenticationServiceScreen()) {
|
||||
Label("Biometric Authentication", image: .authentication)
|
||||
}
|
||||
ListNavigationLink(destination: CachedAuthenticationServiceProxyScreen()) {
|
||||
Label("Cached Authentication", image: .data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Authentication")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@ struct BiometricAuthenticationServiceScreen: View {
|
|||
@StateObject private var alertContext = AlertContext()
|
||||
|
||||
var body: some View {
|
||||
MenuList {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("BiometricAuthenticationService can be used to identify the user with FaceID or TouchID.")
|
||||
ListText("BiometricAuthenticationService can be used to identify the user with FaceID or TouchID.")
|
||||
}
|
||||
|
||||
Section(header: Text("Actions")) {
|
||||
MenuListItem(icon: .authentication, title: "Perform authentication")
|
||||
.button(action: performAuthentication)
|
||||
ListButton(action: performAuthentication) {
|
||||
Label("Perform authentication", image: .authentication)
|
||||
}
|
||||
}
|
||||
}.alert(context: alertContext)
|
||||
}
|
||||
|
|
|
@ -19,18 +19,22 @@ struct CachedAuthenticationServiceProxyScreen: View {
|
|||
@StateObject private var alertContext = AlertContext()
|
||||
|
||||
var body: some View {
|
||||
MenuList("Cached Auth") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("CachedAuthenticationServiceProxy wraps another service and stores its latest result.")
|
||||
ListText("CachedAuthenticationServiceProxy wraps another service and stores its latest result.")
|
||||
}
|
||||
|
||||
Section(header: Text("Actions")) {
|
||||
MenuListItem(icon: .authentication, title: "Perform authentication")
|
||||
.button(action: performAuthentication)
|
||||
MenuListItem(icon: .clear, title: "Clear authentication")
|
||||
.button(action: resetAuthentication)
|
||||
ListButton(action: performAuthentication) {
|
||||
Label("Perform authentication", image: .authentication)
|
||||
}
|
||||
ListButton(action: resetAuthentication) {
|
||||
Label("Clear authentication", image: .clear)
|
||||
}
|
||||
}
|
||||
}.alert(context: alertContext)
|
||||
}
|
||||
.alert(context: alertContext)
|
||||
.navigationTitle("Cached Authentication")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ struct Base64StringCoderScreen: View {
|
|||
private var decoded: String { service.decode(encoded) ?? "-" }
|
||||
|
||||
var body: some View {
|
||||
MenuList("Base64StringCoder") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("Base64StringCoder can encode and decode base64. Type text below to encode it.")
|
||||
ListText("Base64StringCoder can encode and decode base64. Type text below to encode it.")
|
||||
}
|
||||
|
||||
Section(header: Text("Text")) {
|
||||
|
@ -33,7 +33,7 @@ struct Base64StringCoderScreen: View {
|
|||
Text("Encoded: \(encoded)")
|
||||
Text("Decoded: \(decoded)")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Base64StringCoder")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,20 +10,22 @@ import SwiftUI
|
|||
import SwiftUIKit
|
||||
|
||||
struct DataScreen: View {
|
||||
|
||||
|
||||
var body: some View {
|
||||
MenuList("Data") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has data utils for encoding and decoding strings, parse csv files etc.")
|
||||
ListText("SwiftKit has data utils for encoding and decoding strings, parse csv files etc.")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .base64, title: "Base64 String Coder")
|
||||
.navigationLink(to: Base64StringCoderScreen())
|
||||
MenuListItem(icon: .file, title: "CSV Parser")
|
||||
.navigationLink(to: StandardCsvParserScreen())
|
||||
ListNavigationLink(destination: Base64StringCoderScreen()) {
|
||||
Label("Base64 String Coder", image: .base64)
|
||||
}
|
||||
ListNavigationLink(destination: StandardCsvParserScreen()) {
|
||||
Label("CSV Parser", image: .file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Data")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ struct StandardCsvParserScreen: View {
|
|||
@State private var result = [[String]]()
|
||||
|
||||
var body: some View {
|
||||
MenuList("StandardCsvParser") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("A CsvParser can parse CSV strings. This demo uses StandardCsvParser to parse a demo file.")
|
||||
ListText("A CsvParser can parse CSV strings. This demo uses StandardCsvParser to parse a demo file.")
|
||||
}
|
||||
|
||||
ConditionalView(result.hasContent) {
|
||||
|
@ -31,10 +31,11 @@ struct StandardCsvParserScreen: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Result")) {
|
||||
MenuListItem(icon: .file, title: "Parse CSV file")
|
||||
.button(action: parseFile)
|
||||
ListButton(action: parseFile) {
|
||||
Label("Parse CSV file", image: .file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("StandardCsvParser")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ struct DateScreen: View {
|
|||
private let formatter: DateFormatter
|
||||
|
||||
var body: some View {
|
||||
MenuList("Date") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit contains Date utils and extensions. For now, they're all in this one, single screen.")
|
||||
ListText("SwiftKit contains Date utils and extensions. For now, they're all in this one, single screen.")
|
||||
}
|
||||
|
||||
Section(header: Text("Date")) {
|
||||
|
@ -33,26 +33,26 @@ struct DateScreen: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Difference")) {
|
||||
MenuListText("Date is \(date.months(from: Date())) months from now")
|
||||
MenuListText("Date is \(date.weeks(from: Date())) weeks from now")
|
||||
MenuListText("Date is \(date.days(from: Date())) days from now")
|
||||
MenuListText("Date is \(date.hours(from: Date())) hours from now")
|
||||
ListText("Date is \(date.months(from: Date())) months from now")
|
||||
ListText("Date is \(date.weeks(from: Date())) weeks from now")
|
||||
ListText("Date is \(date.days(from: Date())) days from now")
|
||||
ListText("Date is \(date.hours(from: Date())) hours from now")
|
||||
}
|
||||
|
||||
Section(header: Text("Adding to selected date")) {
|
||||
MenuListText("1000 seconds: \(formatter.string(from: date.adding(seconds: 1000)))")
|
||||
MenuListText("2000 minutes: \(formatter.string(from: date.adding(minutes: 2000)))")
|
||||
MenuListText("3000 hours: \(formatter.string(from: date.adding(hours: 3000)))")
|
||||
MenuListText("4000 days: \(formatter.string(from: date.adding(days: 4000)))")
|
||||
ListText("1000 seconds: \(formatter.string(from: date.adding(seconds: 1000)))")
|
||||
ListText("2000 minutes: \(formatter.string(from: date.adding(minutes: 2000)))")
|
||||
ListText("3000 hours: \(formatter.string(from: date.adding(hours: 3000)))")
|
||||
ListText("4000 days: \(formatter.string(from: date.adding(days: 4000)))")
|
||||
}
|
||||
|
||||
Section(header: Text("Removing from selected date")) {
|
||||
MenuListText("1000 seconds: \(formatter.string(from: date.removing(seconds: 1000)))")
|
||||
MenuListText("2000 minutes: \(formatter.string(from: date.removing(minutes: 2000)))")
|
||||
MenuListText("3000 hours: \(formatter.string(from: date.removing(hours: 3000)))")
|
||||
MenuListText("4000 days: \(formatter.string(from: date.removing(days: 4000)))")
|
||||
ListText("1000 seconds: \(formatter.string(from: date.removing(seconds: 1000)))")
|
||||
ListText("2000 minutes: \(formatter.string(from: date.removing(minutes: 2000)))")
|
||||
ListText("3000 hours: \(formatter.string(from: date.removing(hours: 3000)))")
|
||||
ListText("4000 days: \(formatter.string(from: date.removing(days: 4000)))")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Date")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,17 @@ import SwiftUI
|
|||
import SwiftUIKit
|
||||
|
||||
struct ContentView: View {
|
||||
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
MenuList("SwiftKit") {
|
||||
List {
|
||||
Section {
|
||||
list1
|
||||
list2
|
||||
}
|
||||
}.withPlatformSpecificNavigationMode()
|
||||
}
|
||||
.navigationTitle("SwiftKit")
|
||||
.withPlatformSpecificNavigationMode()
|
||||
}.withPlatformSpecificNavigationStyle()
|
||||
}
|
||||
}
|
||||
|
@ -28,36 +30,48 @@ private extension ContentView {
|
|||
var list1: some View {
|
||||
Group {
|
||||
#if os(iOS) || os(macOS)
|
||||
MenuListItem(icon: .authentication, title: "Authentication")
|
||||
.navigationLink(to: AuthenticationScreen())
|
||||
ListNavigationLink(destination: AuthenticationScreen()) {
|
||||
Label("Authentication", image: .authentication)
|
||||
}
|
||||
#endif
|
||||
MenuListItem(icon: .data, title: "Data")
|
||||
.navigationLink(to: DataScreen())
|
||||
MenuListItem(icon: .date, title: "Date")
|
||||
.navigationLink(to: DateScreen())
|
||||
MenuListItem(icon: .device, title: "Device")
|
||||
.navigationLink(to: DeviceScreen())
|
||||
MenuListItem(icon: .extensions, title: "Extensions")
|
||||
.navigationLink(to: ExtensionsScreen())
|
||||
MenuListItem(icon: .files, title: "Files")
|
||||
.navigationLink(to: FilesScreen())
|
||||
MenuListItem(icon: .globe, title: "Geo")
|
||||
.navigationLink(to: GeoScreen())
|
||||
MenuListItem(icon: .ioc, title: "IoC")
|
||||
.navigationLink(to: IoCScreen())
|
||||
MenuListItem(icon: .key, title: "Keychain")
|
||||
.navigationLink(to: KeychainScreen())
|
||||
MenuListItem(icon: .flag, title: "Localization")
|
||||
.navigationLink(to: LocalizationScreen())
|
||||
ListNavigationLink(destination: DataScreen()) {
|
||||
Label("Data", image: .data)
|
||||
}
|
||||
ListNavigationLink(destination: DateScreen()) {
|
||||
Label("Date", image: .date)
|
||||
}
|
||||
ListNavigationLink(destination: DeviceScreen()) {
|
||||
Label("Device", image: .device)
|
||||
}
|
||||
ListNavigationLink(destination: ExtensionsScreen()) {
|
||||
Label("Extensions", image: .extensions)
|
||||
}
|
||||
ListNavigationLink(destination: FilesScreen()) {
|
||||
Label("Files", image: .files)
|
||||
}
|
||||
ListNavigationLink(destination: GeoScreen()) {
|
||||
Label("Geo", image: .globe)
|
||||
}
|
||||
ListNavigationLink(destination: IoCScreen()) {
|
||||
Label("IoC", image: .ioc)
|
||||
}
|
||||
ListNavigationLink(destination: KeychainScreen()) {
|
||||
Label("Keychain", image: .key)
|
||||
}
|
||||
ListNavigationLink(destination: LocalizationScreen()) {
|
||||
Label("Localization", image: .flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var list2: some View {
|
||||
Group {
|
||||
MenuListItem(icon: .cloud, title: "Network")
|
||||
.navigationLink(to: NetworkScreen())
|
||||
MenuListItem(icon: .service, title: "Services")
|
||||
.navigationLink(to: ServicesScreen())
|
||||
ListNavigationLink(destination: NetworkScreen()) {
|
||||
Label("Network", image: .cloud)
|
||||
}
|
||||
ListNavigationLink(destination: ServicesScreen()) {
|
||||
Label("Services", image: .service)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,20 +79,20 @@ private extension ContentView {
|
|||
private extension View {
|
||||
|
||||
func withPlatformSpecificNavigationMode() -> some View {
|
||||
#if os(iOS)
|
||||
#if os(iOS)
|
||||
return self
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#else
|
||||
#else
|
||||
return self
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
func withPlatformSpecificNavigationStyle() -> some View {
|
||||
#if os(iOS)
|
||||
#if os(iOS)
|
||||
return self.navigationViewStyle(StackNavigationViewStyle())
|
||||
#else
|
||||
#else
|
||||
return self
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,7 @@ final class DemoAppearance {
|
|||
private init() {}
|
||||
|
||||
static func apply() {
|
||||
|
||||
MenuListStyle.defaultStyle = .groupedWithInsets
|
||||
|
||||
|
||||
#if os(iOS)
|
||||
if #available(iOS 13.0, *) {
|
||||
let navbar = UINavigationBar.appearance()
|
||||
|
|
|
@ -30,9 +30,9 @@ struct DeviceIdentifierScreen: View {
|
|||
@State private var identifierType = IdentifierType.keychain
|
||||
|
||||
var body: some View {
|
||||
MenuList("DeviceIdentifier") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit contains device identifiers. The keychain-based one remembers the unique id even if you delete the app, while the user defaults-based one does not. Here, the two identifiers are kept in sync.")
|
||||
ListText("SwiftKit contains device identifiers. The keychain-based one remembers the unique id even if you delete the app, while the user defaults-based one does not. Here, the two identifiers are kept in sync.")
|
||||
}
|
||||
|
||||
Section(header: Text("identifier")) {
|
||||
|
@ -43,9 +43,9 @@ struct DeviceIdentifierScreen: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Device identifier")) {
|
||||
MenuListText(identifier.getDeviceIdentifier())
|
||||
ListText(identifier.getDeviceIdentifier())
|
||||
}
|
||||
}
|
||||
}.navigationTitle("DeviceIdentifier")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,17 @@ import SwiftUIKit
|
|||
struct DeviceScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Device") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has device utils for e.g. generating a unique id for the current device.")
|
||||
ListText("SwiftKit has device utils for e.g. generating a unique id for the current device.")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .device, title: "Device Identifier")
|
||||
.navigationLink(to: DeviceIdentifierScreen())
|
||||
ListNavigationLink(destination: DeviceIdentifierScreen()) {
|
||||
Label("Device Identifier", image: .device)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Device")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@ import SwiftUIKit
|
|||
struct ExtensionsScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Extensions") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("""
|
||||
ListText("""
|
||||
SwiftKit contains a bunch of extensions that aim at making it easier to work with SwiftUI.
|
||||
|
||||
Since this namespace contains a lot will grow over time, extensions are not demonstrated. Instead, checkout the source code.
|
||||
""")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Extension")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,32 +23,37 @@ struct DirectoryServiceScreen: View {
|
|||
@State private var isFilterEnabled = false
|
||||
|
||||
var body: some View {
|
||||
MenuList("Directory Service") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has services that lets you handle files within local directoriers. This demo uses a StandardDirectoryService that targets the local cache directory.")
|
||||
ListText("SwiftKit has services that lets you handle files within local directoriers. This demo uses a StandardDirectoryService that targets the local cache directory.")
|
||||
}
|
||||
|
||||
if files.hasContent {
|
||||
Section(header: Text("Files")) {
|
||||
ForEach(files, id: \.self) {
|
||||
MenuListText("\($0) (\(service.getSizeOfFile(named: $0) ?? 0) bytes)")
|
||||
ListText("\($0) (\(service.getSizeOfFile(named: $0) ?? 0) bytes)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: Text("Total")) {
|
||||
MenuListText("\(files.count) files (\(service.getSizeOfAllFiles()) bytes)")
|
||||
ListText("\(files.count) files (\(service.getSizeOfAllFiles()) bytes)")
|
||||
}
|
||||
|
||||
Section(header: Text("Actions")) {
|
||||
MenuListItem(icon: .fileAdd, title: "Create file with random name")
|
||||
.button(action: createRandomFile)
|
||||
MenuListItem(icon: .trash, title: "Delete random file")
|
||||
.button(action: deleteRandomFile)
|
||||
MenuListItem(icon: isFilterEnabled ? .circleFilled : .circle, title: "Show only files that start with \"1\"")
|
||||
.button(action: toggleFileFilter)
|
||||
ListButton(action: createRandomFile) {
|
||||
Label("Create file with random name", image: .fileAdd)
|
||||
}
|
||||
ListButton(action: deleteRandomFile) {
|
||||
Label("Delete random file", image: .trash)
|
||||
}
|
||||
ListButton(action: toggleFileFilter) {
|
||||
Label("Show only files that start with \"1\"", image: isFilterEnabled ? .circleFilled : .circle)
|
||||
}
|
||||
}
|
||||
}.onAppear(perform: refreshFiles)
|
||||
}
|
||||
.onAppear(perform: refreshFiles)
|
||||
.navigationTitle("Directory Service")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,31 +23,31 @@ struct FileFinderScreen: View {
|
|||
|
||||
|
||||
var body: some View {
|
||||
MenuList("File Finder") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has file finders that let you get files in various ways. This demo uses a BundleFileFinder that looks for files in a certain bundle.")
|
||||
ListText("SwiftKit has file finders that let you get files in various ways. This demo uses a BundleFileFinder that looks for files in a certain bundle.")
|
||||
}
|
||||
|
||||
Section(header: Text("Files that start with \"File\"")) {
|
||||
if fileFiles.hasContent {
|
||||
ForEach(fileFiles, id: \.self) {
|
||||
MenuListText("\($0)")
|
||||
ListText("\($0)")
|
||||
}
|
||||
} else {
|
||||
MenuListText("No files")
|
||||
ListText("No files")
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: Text("Files that end with \".txt\"")) {
|
||||
if textFiles.hasContent {
|
||||
ForEach(textFiles, id: \.self) {
|
||||
MenuListText("\($0)")
|
||||
ListText("\($0)")
|
||||
}
|
||||
} else {
|
||||
MenuListText("No files")
|
||||
ListText("No files")
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("File Finder")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,22 +10,24 @@ import SwiftUI
|
|||
import SwiftUIKit
|
||||
|
||||
struct FilesScreen: View {
|
||||
|
||||
|
||||
var body: some View {
|
||||
MenuList("Files") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("""
|
||||
ListText("""
|
||||
SwiftKit contains services that aim at making it easier to work with files.
|
||||
""")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .folder, title: "Directory Service")
|
||||
.navigationLink(to: DirectoryServiceScreen())
|
||||
MenuListItem(icon: .fileSearch, title: "File Finder")
|
||||
.navigationLink(to: FileFinderScreen())
|
||||
ListNavigationLink(destination: DirectoryServiceScreen()) {
|
||||
Label("Directory Service", image: .folder)
|
||||
}
|
||||
ListNavigationLink(destination: FileFinderScreen()) {
|
||||
Label("File Finder", image: .fileSearch)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Files")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ struct ExternalMapServicesScreen: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
MenuList("External Maps") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has external maps services that let you show a coordinate or trigger a navigation in an external map app.")
|
||||
ListText("SwiftKit has external maps services that let you show a coordinate or trigger a navigation in an external map app.")
|
||||
}
|
||||
|
||||
Section(header: Text("Coordinate")) {
|
||||
|
@ -36,12 +36,14 @@ struct ExternalMapServicesScreen: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Actions")) {
|
||||
MenuListItem(icon: .pin, title: "Open in Apple Maps")
|
||||
.button(action: showInAppleMaps)
|
||||
MenuListItem(icon: .pin, title: "Open in Google Maps")
|
||||
.button(action: showInGoogleMaps)
|
||||
ListButton(action: showInAppleMaps) {
|
||||
Label("Open in Apple Maps", image: .pin)
|
||||
}
|
||||
ListButton(action: showInGoogleMaps) {
|
||||
Label("Open in Google Maps", image: .pin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("External Maps")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,20 +10,22 @@ import SwiftUI
|
|||
import SwiftUIKit
|
||||
|
||||
struct GeoScreen: View {
|
||||
|
||||
|
||||
var body: some View {
|
||||
MenuList("Geo") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has geo utils that simplifies working with maps and coordinates.")
|
||||
ListText("SwiftKit has geo utils that simplifies working with maps and coordinates.")
|
||||
}
|
||||
|
||||
Section(header: Text("Utils")) {
|
||||
MenuListItem(icon: .map, title: "External Map Services")
|
||||
.navigationLink(to: ExternalMapServicesScreen())
|
||||
MenuListItem(icon: .pin, title: "World Coordinates")
|
||||
.navigationLink(to: WorldCoordinateScreen())
|
||||
ListNavigationLink(destination: ExternalMapServicesScreen()) {
|
||||
Label("External Map Services", image: .map)
|
||||
}
|
||||
ListNavigationLink(destination: WorldCoordinateScreen()) {
|
||||
Label("World Coordinates", image: .pin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Geo")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ struct WorldCoordinateScreen: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
MenuList("World Coordinates") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has a world coordinate struct with static coordinate properties.")
|
||||
ListText("SwiftKit has a world coordinate struct with static coordinate properties.")
|
||||
}
|
||||
|
||||
Section(header: Text("Coordinate")) {
|
||||
|
@ -41,7 +41,7 @@ struct WorldCoordinateScreen: View {
|
|||
Map(coordinateRegion: .constant(mapRegion))
|
||||
.frame(height: 250)
|
||||
}
|
||||
}
|
||||
}.navigationTitle("World Coordinate")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@ import SwiftUIKit
|
|||
struct IoCScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("IoC") {
|
||||
List {
|
||||
Section(header: Text("About")) {
|
||||
MenuListText("""
|
||||
ListText("""
|
||||
SwiftKit has utils that simplifies implementing IoC (inversion of control) and DI (dependency injection) in your apps.
|
||||
|
||||
These utils are not in the demo, though, so have a look att the source code.
|
||||
""")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("IoC")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,17 @@ import SwiftUIKit
|
|||
struct KeychainScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Keychain") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has utils that simplify working with the device keychain.")
|
||||
ListText("SwiftKit has utils that simplify working with the device keychain.")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .key, title: "Keychain Service")
|
||||
.navigationLink(to: KeychainServiceScreen())
|
||||
ListNavigationLink(destination: KeychainServiceScreen()) {
|
||||
Label("Keychain Service", image: .key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Keychain")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,31 +22,37 @@ struct KeychainServiceScreen: View {
|
|||
@State private var doubleText = ""
|
||||
@State private var intText = ""
|
||||
@State private var stringText = ""
|
||||
|
||||
|
||||
var body: some View {
|
||||
MenuList("Keychain Services") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has services that let you use the keychain like UserDefaults, but where the data is still around if the user deletes the app.")
|
||||
ListText("SwiftKit has services that let you use the keychain like UserDefaults, but where the data is still around if the user deletes the app.")
|
||||
}
|
||||
|
||||
Section(header: Text("Persisted Data")) {
|
||||
MenuListText("Bool: \(boolText)")
|
||||
MenuListText("Double: \(doubleText)")
|
||||
MenuListText("Int: \(intText)")
|
||||
MenuListText("String: \(stringText)")
|
||||
ListText("Bool: \(boolText)")
|
||||
ListText("Double: \(doubleText)")
|
||||
ListText("Int: \(intText)")
|
||||
ListText("String: \(stringText)")
|
||||
}
|
||||
|
||||
Section(header: Text("Actions")) {
|
||||
MenuListItem(icon: .data, title: "Store Random Bool")
|
||||
.button(action: storeRandomBool)
|
||||
MenuListItem(icon: .data, title: "Store Random Double")
|
||||
.button(action: storeRandomDouble)
|
||||
MenuListItem(icon: .data, title: "Store Random Int")
|
||||
.button(action: storeRandomInt)
|
||||
MenuListItem(icon: .data, title: "Store Random String")
|
||||
.button(action: storeRandomString)
|
||||
ListButton(action: storeRandomBool) {
|
||||
Label("Store Random Bool", image: .data)
|
||||
}
|
||||
ListButton(action: storeRandomDouble) {
|
||||
Label("Store Random Double", image: .data)
|
||||
}
|
||||
ListButton(action: storeRandomInt) {
|
||||
Label("Store Random Int", image: .data)
|
||||
}
|
||||
ListButton(action: storeRandomString) {
|
||||
Label("Store Random String", image: .data)
|
||||
}
|
||||
}
|
||||
}.onAppear(perform: refresh)
|
||||
}
|
||||
.onAppear(perform: refresh)
|
||||
.navigationTitle("Keychain Services")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,18 +12,20 @@ import SwiftUIKit
|
|||
struct LocalizationScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Keychain") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has utils for working with localized content.")
|
||||
ListText("SwiftKit has utils for working with localized content.")
|
||||
}
|
||||
|
||||
Section(header: Text("Services")) {
|
||||
MenuListItem(icon: .service, title: "Localization Service")
|
||||
.navigationLink(to: LocalizationServiceScreen())
|
||||
MenuListItem(icon: .flag, title: "Translator")
|
||||
.navigationLink(to: TranslatorScreen())
|
||||
ListNavigationLink(destination: LocalizationServiceScreen()) {
|
||||
Label("Localization Service", image: .service)
|
||||
}
|
||||
ListNavigationLink(destination: TranslatorScreen()) {
|
||||
Label("Translator", image: .flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Keychain")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ struct LocalizationServiceScreen: View {
|
|||
@StateObject private var state = ViewModel()
|
||||
|
||||
var body: some View {
|
||||
MenuList("Localization Service") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has services for working with localized content and changing locale without restarting the app. This demo uses a StandardLocalizationService.")
|
||||
ListText("SwiftKit has services for working with localized content and changing locale without restarting the app. This demo uses a StandardLocalizationService.")
|
||||
}
|
||||
|
||||
Section(header: Text("Locales")) {
|
||||
|
@ -43,12 +43,13 @@ struct LocalizationServiceScreen: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Translations")) {
|
||||
MenuListText(title).font(.headline)
|
||||
MenuListText(text)
|
||||
ListText(title).font(.headline)
|
||||
ListText(text)
|
||||
}
|
||||
}
|
||||
.onAppear(perform: refresh)
|
||||
.onReceive(state.$locale, perform: { _ in refreshAsync() })
|
||||
.navigationTitle("Localization Service")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,17 +22,18 @@ struct TranslatorScreen: View {
|
|||
@State private var text = ""
|
||||
|
||||
var body: some View {
|
||||
MenuList("Translator") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("SwiftKit has translators that can be used to abstract how localized strings are translated. This demo uses a StandardTranslator, which uses the latest locale set for this app.")
|
||||
ListText("SwiftKit has translators that can be used to abstract how localized strings are translated. This demo uses a StandardTranslator, which uses the latest locale set for this app.")
|
||||
}
|
||||
|
||||
Section(header: Text("Translations")) {
|
||||
MenuListText(title).font(.headline)
|
||||
MenuListText(text)
|
||||
ListText(title).font(.headline)
|
||||
ListText(text)
|
||||
}
|
||||
}
|
||||
.onAppear(perform: refresh)
|
||||
.navigationTitle("Translator")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@ import SwiftUIKit
|
|||
struct NetworkScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Network") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("""
|
||||
ListText("""
|
||||
SwiftKit contains a bunch of utils for working with network and api-related operations, like requesting and parsing data from an external api.
|
||||
|
||||
This namespace is currently not available as a demo. Instead, checkout the source code.
|
||||
""")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Network")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,15 +12,15 @@ import SwiftUIKit
|
|||
struct ServicesScreen: View {
|
||||
|
||||
var body: some View {
|
||||
MenuList("Services") {
|
||||
List {
|
||||
Section {
|
||||
MenuListText("""
|
||||
ListText("""
|
||||
SwiftKit contains a bunch of service base classes, which helps you implement service decorators, proxies etc.
|
||||
|
||||
This namespace is currently not available as a demo. Instead, checkout the source code.
|
||||
""")
|
||||
}
|
||||
}
|
||||
}.navigationTitle("Services")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue