From d5464186af3b75c935a850e677bdffacfcacf21d Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 2 Feb 2024 11:31:34 +0100 Subject: [PATCH] Use old Previews syntax --- Shared/Settings/ExportSettings.swift | 8 ++++--- .../Import/ImportSettingsAccountRow.swift | 24 ++++++++++--------- .../Import/ImportSettingsSheetView.swift | 6 +++-- .../ImportSettingsSheetViewModifier.swift | 16 +++++++------ 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Shared/Settings/ExportSettings.swift b/Shared/Settings/ExportSettings.swift index 8f31ad74..8024c297 100644 --- a/Shared/Settings/ExportSettings.swift +++ b/Shared/Settings/ExportSettings.swift @@ -158,8 +158,10 @@ struct ExportSettings: View { } } -#Preview { - NavigationView { - ExportSettings() +struct ExportSettings_Previews: PreviewProvider { + static var previews: some View { + NavigationView { + ExportSettings() + } } } diff --git a/Shared/Settings/Import/ImportSettingsAccountRow.swift b/Shared/Settings/Import/ImportSettingsAccountRow.swift index 8069973e..15c9db7b 100644 --- a/Shared/Settings/Import/ImportSettingsAccountRow.swift +++ b/Shared/Settings/Import/ImportSettingsAccountRow.swift @@ -171,17 +171,19 @@ struct ImportSettingsAccountRow: View { } } -#Preview { - let fileModel = ImportSettingsFileModel(url: URL(string: "https://gist.githubusercontent.com/arekf/578668969c9fdef1b3828bea864c3956/raw/f794a95a20261bcb1145e656c8dda00bea339e2a/yattee-recents.yatteesettings")!) +struct ImportSettingsAccountRow_Previews: PreviewProvider { + static var previews: some View { + let fileModel = ImportSettingsFileModel(url: URL(string: "https://gist.githubusercontent.com/arekf/578668969c9fdef1b3828bea864c3956/raw/f794a95a20261bcb1145e656c8dda00bea339e2a/yattee-recents.yatteesettings")!) - return List { - ImportSettingsAccountRow( - account: .init(name: "arekf", urlString: "https://instance.com", username: "arekf"), - fileModel: fileModel - ) - ImportSettingsAccountRow( - account: .init(name: "arekf", urlString: "https://instance.com", username: "arekf", password: "a"), - fileModel: fileModel - ) + return List { + ImportSettingsAccountRow( + account: .init(name: "arekf", urlString: "https://instance.com", username: "arekf"), + fileModel: fileModel + ) + ImportSettingsAccountRow( + account: .init(name: "arekf", urlString: "https://instance.com", username: "arekf", password: "a"), + fileModel: fileModel + ) + } } } diff --git a/Shared/Settings/Import/ImportSettingsSheetView.swift b/Shared/Settings/Import/ImportSettingsSheetView.swift index 5372e7fb..2eb3c069 100644 --- a/Shared/Settings/Import/ImportSettingsSheetView.swift +++ b/Shared/Settings/Import/ImportSettingsSheetView.swift @@ -255,6 +255,8 @@ struct ImportSettingsSheetView: View { } } -#Preview { - ImportSettingsSheetView(settingsFile: .constant(URL(string: "https://gist.githubusercontent.com/arekf/578668969c9fdef1b3828bea864c3956/raw/f794a95a20261bcb1145e656c8dda00bea339e2a/yattee-recents.yatteesettings")!)) +struct ImportSettingsSheetView_Previews: PreviewProvider { + static var previews: some View { + ImportSettingsSheetView(settingsFile: .constant(URL(string: "https://gist.githubusercontent.com/arekf/578668969c9fdef1b3828bea864c3956/raw/f794a95a20261bcb1145e656c8dda00bea339e2a/yattee-recents.yatteesettings")!)) + } } diff --git a/Shared/Settings/Import/ImportSettingsSheetViewModifier.swift b/Shared/Settings/Import/ImportSettingsSheetViewModifier.swift index 76eec764..5c4fe857 100644 --- a/Shared/Settings/Import/ImportSettingsSheetViewModifier.swift +++ b/Shared/Settings/Import/ImportSettingsSheetViewModifier.swift @@ -14,12 +14,14 @@ struct ImportSettingsSheetViewModifier: ViewModifier { } } -#Preview { - Text("") - .modifier( - ImportSettingsSheetViewModifier( - isPresented: .constant(true), - settingsFile: .constant(URL(string: "https://gist.githubusercontent.com/arekf/87b4d6702755b01139431dcb809f9fdc/raw/7bb5cdba3ffc0c479f5260430ddc43c4a79a7a72/yattee-177-iPhone.yatteesettings")!) +struct ImportSettingsSheetViewModifier_Previews: PreviewProvider { + static var previews: some View { + Text("") + .modifier( + ImportSettingsSheetViewModifier( + isPresented: .constant(true), + settingsFile: .constant(URL(string: "https://gist.githubusercontent.com/arekf/87b4d6702755b01139431dcb809f9fdc/raw/7bb5cdba3ffc0c479f5260430ddc43c4a79a7a72/yattee-177-iPhone.yatteesettings")!) + ) ) - ) + } }