From 8e321347fc520ea04d1fa6e49a0bd5765cc4f49b Mon Sep 17 00:00:00 2001 From: Praveen P Date: Mon, 17 Jun 2024 16:11:15 -0400 Subject: [PATCH] Code cleanup (#22) Co-authored-by: PraveenP --- .gitignore | 1 + ExampleApp/ExampleApp/ContentView.swift | 8 ++++---- ExampleApp/ExampleApp/Views/ExTextView.swift | 12 +++++------- Sources/Theme/ViewModifiers/ColorModifier.swift | 12 +++++------- Sources/Theme/ViewModifiers/FontModifier.swift | 8 +++----- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index b134254..9993512 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ fastlane/report.xml *.xcuserstate *.resolved reports/** +build/* diff --git a/ExampleApp/ExampleApp/ContentView.swift b/ExampleApp/ExampleApp/ContentView.swift index f269ea4..09e57b0 100644 --- a/ExampleApp/ExampleApp/ContentView.swift +++ b/ExampleApp/ExampleApp/ContentView.swift @@ -19,8 +19,8 @@ struct ContentView: View { } } -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } +// MARK: Preview + +#Preview { + ContentView() } diff --git a/ExampleApp/ExampleApp/Views/ExTextView.swift b/ExampleApp/ExampleApp/Views/ExTextView.swift index f4ba5de..c15bcfd 100644 --- a/ExampleApp/ExampleApp/Views/ExTextView.swift +++ b/ExampleApp/ExampleApp/Views/ExTextView.swift @@ -39,11 +39,9 @@ struct ExTextView: View { // MARK: Preview -struct ExTextView_Previews: PreviewProvider { - static var previews: some View { - ExTextView() - .task { - await ThemeLoader.setupApplicationTheme() - } - } +#Preview { + ExTextView() + .task { + await ThemeLoader.setupApplicationTheme() + } } diff --git a/Sources/Theme/ViewModifiers/ColorModifier.swift b/Sources/Theme/ViewModifiers/ColorModifier.swift index a451d44..829b0ba 100644 --- a/Sources/Theme/ViewModifiers/ColorModifier.swift +++ b/Sources/Theme/ViewModifiers/ColorModifier.swift @@ -58,16 +58,14 @@ public extension View { } } - // MARK: Preview +// MARK: Preview -struct ColorModifier_Previews: PreviewProvider { - static var previews: some View { - Text(""" +#Preview { + Text(""" Sample Color: blue foreground Color green background Color """) - .theme(.foreground(color: .init(.blue))) - .theme(.background(color: .init(.green), ignoreSafeArea: false)) - } + .theme(.foreground(color: .init(.blue))) + .theme(.background(color: .init(.green), ignoreSafeArea: false)) } diff --git a/Sources/Theme/ViewModifiers/FontModifier.swift b/Sources/Theme/ViewModifiers/FontModifier.swift index d6698d8..bfe9df7 100644 --- a/Sources/Theme/ViewModifiers/FontModifier.swift +++ b/Sources/Theme/ViewModifiers/FontModifier.swift @@ -38,13 +38,11 @@ public extension View { // MARK: Preview -struct FontModifier_Previews: PreviewProvider { - static var previews: some View { - Text(""" +#Preview { + Text(""" Sample Text Font: headline in Light-Mode caption in Dark-Mode """) - .theme(.init(Font.headline, dark: Font.caption)) - } + .theme(.init(Font.headline, dark: Font.caption)) }