From fb1c8fb2f672b80bab97fc42b129295dc8e47227 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:53:21 +0900 Subject: [PATCH 1/2] fix: fix Sendable warning --- Sources/DevToysApp.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/DevToysApp.swift b/Sources/DevToysApp.swift index 345bddd..5f5d504 100644 --- a/Sources/DevToysApp.swift +++ b/Sources/DevToysApp.swift @@ -7,7 +7,7 @@ let logger = Logger(label: "main") @main struct DevToysApp { init() { - LoggingSystem.bootstrap(PlaygroundHandler.init) + LoggingSystem.bootstrap { PlaygroundHandler(label: $0) } } } From 706f8b19f3c99cef50afbadb089ce6aa28e6b018 Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:25:44 +0900 Subject: [PATCH 2/2] fix: fix actor-related warnings --- Sources/Components/Layouts/ToySection.swift | 3 +++ Sources/Pages/Coders/JWTDecoderView.swift | 3 +++ Sources/Pages/Converters/JSONYAMLConverterView.swift | 2 ++ Sources/Pages/Converters/TimestampConverterView.swift | 1 + Sources/Pages/Converters/TimestampConverterViewState.swift | 1 + Sources/Pages/Formatters/JSONFormatterView.swift | 2 ++ Sources/Pages/Generators/HashGeneratorView.swift | 1 + Sources/Pages/Generators/UUIDGeneratorView.swift | 3 +++ Sources/Pages/Text/ListComparerView.swift | 2 ++ Sources/Pages/Text/MarkdownPreviewView.swift | 2 ++ 10 files changed, 20 insertions(+) diff --git a/Sources/Components/Layouts/ToySection.swift b/Sources/Components/Layouts/ToySection.swift index 5a2a305..e9729df 100644 --- a/Sources/Components/Layouts/ToySection.swift +++ b/Sources/Components/Layouts/ToySection.swift @@ -29,6 +29,7 @@ struct ToySection { self.content = content() } + @MainActor init( _ titleKey: LocalizedStringKey, @ViewBuilder toolbar: () -> Toolbar, @@ -43,6 +44,7 @@ struct ToySection { } @_disfavoredOverload + @MainActor init( _ title: S, @ViewBuilder toolbar: () -> Toolbar, @@ -56,6 +58,7 @@ struct ToySection { self.content = content() } + @MainActor init( @ViewBuilder _ title: () -> T, @ViewBuilder toolbar: () -> Toolbar, diff --git a/Sources/Pages/Coders/JWTDecoderView.swift b/Sources/Pages/Coders/JWTDecoderView.swift index 5485cc4..be16598 100644 --- a/Sources/Pages/Coders/JWTDecoderView.swift +++ b/Sources/Pages/Coders/JWTDecoderView.swift @@ -18,6 +18,7 @@ extension JWTDecoderView: View { .navigationTitle("JWT Decoder") } + @MainActor private var inputSection: some View { ToySection("JWT Token") { PasteButton(text: self.$state.input) @@ -29,6 +30,7 @@ extension JWTDecoderView: View { } } + @MainActor private var headerSection: some View { ToySection("Header") { CopyButton(text: self.state.header) @@ -38,6 +40,7 @@ extension JWTDecoderView: View { } } + @MainActor private var payloadSection: some View { ToySection("Payload") { CopyButton(text: self.state.payload) diff --git a/Sources/Pages/Converters/JSONYAMLConverterView.swift b/Sources/Pages/Converters/JSONYAMLConverterView.swift index 7b78484..65f9037 100644 --- a/Sources/Pages/Converters/JSONYAMLConverterView.swift +++ b/Sources/Pages/Converters/JSONYAMLConverterView.swift @@ -48,6 +48,7 @@ extension JSONYAMLConverterView: View { .navigationTitle(Tool.jsonYAMLConverter.strings.localizedLongTitle) } + @MainActor private var inputSection: some View { ToySection("Input") { PasteButton(text: self.$state.input) @@ -59,6 +60,7 @@ extension JSONYAMLConverterView: View { } } + @MainActor private var outputSection: some View { ToySection("Output") { CopyButton(text: self.state.output) diff --git a/Sources/Pages/Converters/TimestampConverterView.swift b/Sources/Pages/Converters/TimestampConverterView.swift index ff0e698..c583af6 100644 --- a/Sources/Pages/Converters/TimestampConverterView.swift +++ b/Sources/Pages/Converters/TimestampConverterView.swift @@ -41,6 +41,7 @@ extension TimestampConverterView: View { .navigationTitle(Tool.timestampConverter.strings.localizedLongTitle) } + @MainActor private var timestampSection: some View { ToySection("Timestamp") { PasteButton(text: self.$state.timestampString) diff --git a/Sources/Pages/Converters/TimestampConverterViewState.swift b/Sources/Pages/Converters/TimestampConverterViewState.swift index 534dfb8..761417b 100644 --- a/Sources/Pages/Converters/TimestampConverterViewState.swift +++ b/Sources/Pages/Converters/TimestampConverterViewState.swift @@ -17,6 +17,7 @@ final class TimestampConverterViewState { } private(set) var timestamp: Int? + @MainActor var date: Binding { .init( get: { diff --git a/Sources/Pages/Formatters/JSONFormatterView.swift b/Sources/Pages/Formatters/JSONFormatterView.swift index 5228412..b310ac6 100644 --- a/Sources/Pages/Formatters/JSONFormatterView.swift +++ b/Sources/Pages/Formatters/JSONFormatterView.swift @@ -37,6 +37,7 @@ extension JSONFormatterView: View { .navigationTitle(Tool.jsonFormatter.strings.localizedLongTitle) } + @MainActor private var inputSection: some View { ToySection("Input") { PasteButton(text: self.$state.input) @@ -48,6 +49,7 @@ extension JSONFormatterView: View { } } + @MainActor private var outputSection: some View { ToySection("Output") { CopyButton(text: self.state.output) diff --git a/Sources/Pages/Generators/HashGeneratorView.swift b/Sources/Pages/Generators/HashGeneratorView.swift index 06b0b7c..f09144c 100644 --- a/Sources/Pages/Generators/HashGeneratorView.swift +++ b/Sources/Pages/Generators/HashGeneratorView.swift @@ -42,6 +42,7 @@ extension HashGeneratorView: View { .navigationTitle(Tool.hashGenerator.strings.localizedLongTitle) } + @MainActor private var inputSection: some View { ToySection("Input") { PasteButton(text: self.$state.input) diff --git a/Sources/Pages/Generators/UUIDGeneratorView.swift b/Sources/Pages/Generators/UUIDGeneratorView.swift index c5b9bf5..12c80bd 100644 --- a/Sources/Pages/Generators/UUIDGeneratorView.swift +++ b/Sources/Pages/Generators/UUIDGeneratorView.swift @@ -19,6 +19,7 @@ extension UUIDGeneratorView: View { .navigationTitle(Tool.uuidGenerator.strings.localizedLongTitle) } + @MainActor private var configurationSection: some View { ToySection("Configuration") { ConfigurationRow("Hyphens", systemImage: "minus") { @@ -47,6 +48,7 @@ extension UUIDGeneratorView: View { } } + @MainActor private var generateSection: some View { ToySection("Generate") { HStack { @@ -80,6 +82,7 @@ extension UUIDGeneratorView: View { } } + @MainActor private var outputSection: some View { ToySection( self.state.numberOfUUIDs > 1 ? "UUIDs" : "UUID" diff --git a/Sources/Pages/Text/ListComparerView.swift b/Sources/Pages/Text/ListComparerView.swift index e8734f2..23e7d50 100644 --- a/Sources/Pages/Text/ListComparerView.swift +++ b/Sources/Pages/Text/ListComparerView.swift @@ -46,6 +46,7 @@ extension ListComparerView: View { .navigationTitle(Tool.listComparer.strings.localizedLongTitle) } + @MainActor private var sectionA: some View { ToySection("A") { PasteButton(text: self.$state.a) @@ -56,6 +57,7 @@ extension ListComparerView: View { } } + @MainActor private var sectionB: some View { ToySection("B") { PasteButton(text: self.$state.b) diff --git a/Sources/Pages/Text/MarkdownPreviewView.swift b/Sources/Pages/Text/MarkdownPreviewView.swift index ec1069b..346b7af 100644 --- a/Sources/Pages/Text/MarkdownPreviewView.swift +++ b/Sources/Pages/Text/MarkdownPreviewView.swift @@ -26,6 +26,7 @@ extension MarkdownPreviewView: View { .navigationTitle(Tool.markdownPreview.strings.localizedLongTitle) } + @MainActor private var markdownSection: some View { ToySection("Markdown") { PasteButton(text: self.$state.input) @@ -37,6 +38,7 @@ extension MarkdownPreviewView: View { } } + @MainActor private var previewSection: some View { ToySection("Preview") { CopyButton(text: self.state.output)