diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9326c578..0681eb13 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -15,9 +15,9 @@ jobs: runs-on: macos-latest steps: - - uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf + - uses: swift-actions/setup-swift@150267bf6ba01f9d942a4bd55aa2f35ba586767d with: - swift-version: "5.8" + swift-version: "5.9" - uses: actions/checkout@v3 - name: Build # TODO: add KeyboardViews diff --git a/AzooKeyCore/Package.swift b/AzooKeyCore/Package.swift index d5b40629..84ebd32a 100644 --- a/AzooKeyCore/Package.swift +++ b/AzooKeyCore/Package.swift @@ -10,6 +10,8 @@ let swiftSettings: [SwiftSetting] = [ .enableUpcomingFeature("ForwardTrailingClosures"), .enableUpcomingFeature("ImplicitOpenExistentials"), .enableUpcomingFeature("StrictConcurrency"), + .enableUpcomingFeature("DisableOutwardActorInference"), + .enableUpcomingFeature("ImportObjcForwardDeclarations"), .unsafeFlags(["-strict-concurrency=complete"]) ] let package = Package( diff --git a/AzooKeyCore/Sources/KeyboardViews/View/Components/ExpandedResultView.swift b/AzooKeyCore/Sources/KeyboardViews/View/Components/ExpandedResultView.swift index 3df281cf..bb2a2004 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/Components/ExpandedResultView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/Components/ExpandedResultView.swift @@ -9,6 +9,7 @@ import Foundation import SwiftUI +@MainActor struct ExpandedResultView: View { @EnvironmentObject private var variableStates: VariableStates @Binding private var isResultViewExpanded: Bool diff --git a/AzooKeyCore/Sources/KeyboardViews/View/Components/KeyLabel.swift b/AzooKeyCore/Sources/KeyboardViews/View/Components/KeyLabel.swift index e048a5c1..156b5c32 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/Components/KeyLabel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/Components/KeyLabel.swift @@ -18,6 +18,7 @@ public enum KeyLabelType { case selectable(String, String) } +@MainActor public struct KeyLabel: View { private let labelType: KeyLabelType private let width: CGFloat diff --git a/AzooKeyCore/Sources/KeyboardViews/View/Components/LargeTextView.swift b/AzooKeyCore/Sources/KeyboardViews/View/Components/LargeTextView.swift index 2c69c2ea..08196c9f 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/Components/LargeTextView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/Components/LargeTextView.swift @@ -10,6 +10,7 @@ import Foundation import SwiftUI import SwiftUIUtils +@MainActor struct LargeTextView: View { private let text: String @Binding private var isViewOpen: Bool diff --git a/AzooKeyCore/Sources/KeyboardViews/View/Components/MessageView.swift b/AzooKeyCore/Sources/KeyboardViews/View/Components/MessageView.swift index 58aec81e..a7ebb13e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/Components/MessageView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/Components/MessageView.swift @@ -8,6 +8,7 @@ import SwiftUI +@MainActor struct MessageView: View { private let data: MessageData @Binding private var manager: MessageManager diff --git a/AzooKeyCore/Sources/KeyboardViews/View/Components/ResizingRect.swift b/AzooKeyCore/Sources/KeyboardViews/View/Components/ResizingRect.swift index a73378b5..bf533379 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/Components/ResizingRect.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/Components/ResizingRect.swift @@ -8,6 +8,7 @@ import Foundation import SwiftUI +@MainActor struct ResizingRect: View { typealias Position = (current: CGPoint, initial: CGPoint) @State private var top_left_edge: Position @@ -279,6 +280,7 @@ struct ResizingRect: View { } } +@MainActor struct ResizingBindingFrame: ViewModifier { private let initialSize: CGSize @Binding private var position: CGPoint diff --git a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift index 9fdc9982..02f5c45f 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift @@ -253,6 +253,7 @@ extension CustardInterfaceKey { } } +@MainActor struct CustomKeyboardView: View { private let custard: Custard private var tabDesign: TabDependentDesign { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift index 8f8cda55..a0f70421 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift @@ -10,6 +10,7 @@ import Foundation import SwiftUI import SwiftUIUtils +@MainActor struct SimpleKeyView: View { private let model: any SimpleKeyModelProtocol @EnvironmentObject private var variableStates: VariableStates diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift index eeee76d3..559828e3 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift @@ -26,6 +26,7 @@ enum KeyPressState { } } +@MainActor public struct FlickKeyView: View { private let model: any FlickKeyModelProtocol diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift index 38505950..8cb23cd4 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift @@ -10,6 +10,7 @@ import CustardKit import Foundation import SwiftUI +@MainActor struct FlickSuggestView: View { @EnvironmentObject private var variableStates: VariableStates @Environment(Extension.Theme.self) private var theme diff --git a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/EmojiTabResultBar.swift b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/EmojiTabResultBar.swift index ced5b41f..91a63514 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/EmojiTabResultBar.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/EmojiTabResultBar.swift @@ -9,6 +9,7 @@ import SwiftUI import SwiftUIUtils +@MainActor struct EmojiTabResultBar: View { init() {} @Environment(Extension.Theme.self) private var theme diff --git a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/KeyboardBarView.swift b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/KeyboardBarView.swift index bd6b4b21..788f3d8d 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/KeyboardBarView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/KeyboardBarView.swift @@ -10,6 +10,7 @@ import Foundation import SwiftUI import SwiftUIUtils +@MainActor struct KeyboardBarView: View { @EnvironmentObject private var variableStates: VariableStates @Binding private var isResultViewExpanded: Bool @@ -37,6 +38,7 @@ struct KeyboardBarView: Vie } } +@MainActor struct KeyboardBarButton: View { enum LabelType { case azooKeyIcon diff --git a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/MoveCursorBar.swift b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/MoveCursorBar.swift index 14ec6ee2..8ea44e5d 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/MoveCursorBar.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/MoveCursorBar.swift @@ -68,6 +68,7 @@ struct BetaMoveCursorBarState { } } +@MainActor struct MoveCursorBarBeta: View { init() {} @@ -283,6 +284,7 @@ private enum MoveCursorBarGestureState { case moving(CGPoint, Int) // 右だったら+1、左だったら-1 } +@MainActor struct MoveCursorBar: View { init() {} diff --git a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/ResultBar.swift b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/ResultBar.swift index 340e905d..22584804 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/ResultBar.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardBar/ResultBar.swift @@ -21,6 +21,7 @@ private extension Equatable { } } +@MainActor struct ResultBar: View { @Namespace private var namespace @Environment(Extension.Theme.self) private var theme diff --git a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift index 90d725c9..246d5d7f 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift @@ -9,6 +9,7 @@ import Foundation import SwiftUI +@MainActor public struct KeyboardView: View { @State private var messageManager = MessageManager(necessaryMessages: Extension.MessageProvider.messages, userDefaults: Extension.MessageProvider.userDefaults) @State private var isResultViewExpanded = false diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift index dca86da0..ae6400f0 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift @@ -96,6 +96,7 @@ struct QwertyKeyDoublePressState { } } +@MainActor struct QwertyKeyView: View { private let model: any QwertyKeyModelProtocol @EnvironmentObject private var variableStates: VariableStates diff --git a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift index 940c5d3b..be77d381 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift @@ -47,6 +47,7 @@ private final class ClipboardHistory: ObservableObject { } } +@MainActor struct ClipboardHistoryTab: View { @EnvironmentObject private var variableStates: VariableStates @StateObject private var target = ClipboardHistory() diff --git a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift index 14baa953..d0af3089 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift @@ -10,6 +10,7 @@ import KeyboardThemes import SwiftUI import SwiftUtils +@MainActor struct EmojiTab: View { @EnvironmentObject private var variableStates: VariableStates @Environment(Extension.Theme.self) private var theme diff --git a/AzooKeyCore/Sources/KeyboardViews/View/UpsideComponents/UpsideSearchView.swift b/AzooKeyCore/Sources/KeyboardViews/View/UpsideComponents/UpsideSearchView.swift index c7e0e7a6..4c359c16 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/UpsideComponents/UpsideSearchView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/UpsideComponents/UpsideSearchView.swift @@ -9,6 +9,7 @@ import SwiftUI import enum KanaKanjiConverterModule.ConverterBehaviorSemantics +@MainActor struct UpsideSearchView: View { @Environment(\.userActionManager) private var action @Environment(Extension.Theme.self) private var theme diff --git a/MainApp/ContentView.swift b/MainApp/ContentView.swift index af20769e..956fd2fe 100644 --- a/MainApp/ContentView.swift +++ b/MainApp/ContentView.swift @@ -10,6 +10,7 @@ import AzooKeyUtils import KeyboardViews import SwiftUI +@MainActor struct ContentView: View { private enum TabSelection { case tips, theme, customize, settings diff --git a/MainApp/Customize/EditingTenkeyCustardView.swift b/MainApp/Customize/EditingTenkeyCustardView.swift index 46f2e80f..9cc65e9c 100644 --- a/MainApp/Customize/EditingTenkeyCustardView.swift +++ b/MainApp/Customize/EditingTenkeyCustardView.swift @@ -29,6 +29,7 @@ fileprivate extension Dictionary where Key == KeyPosition, Value == UserMadeTenK } } +@MainActor struct EditingTenkeyCustardView: CancelableEditor { private static let emptyKey: UserMadeTenKeyCustard.KeyData = .init(model: .custom(.empty), width: 1, height: 1) private static let emptyKeys: [KeyPosition: UserMadeTenKeyCustard.KeyData] = (0..<5).reduce(into: [:]) {dict, x in diff --git a/MainApp/Customize/ManageCustardView.swift b/MainApp/Customize/ManageCustardView.swift index feb21452..e23fb87d 100644 --- a/MainApp/Customize/ManageCustardView.swift +++ b/MainApp/Customize/ManageCustardView.swift @@ -142,6 +142,7 @@ struct WebCustardList: Codable { var custards: [Item] } +@MainActor struct ManageCustardView: View { @ObservedObject private var data = ImportedCustardData() @State private var urlString: String = "" @@ -369,6 +370,7 @@ struct ManageCustardView: View { } // FIXME: ファイルを保存もキャンセルもしない状態で2つ目のファイルを読み込むとエラーになる +@MainActor struct URLImportCustardView: View { @ObservedObject private var data = ImportedCustardData() @State private var showAlert = false diff --git a/MainApp/EnableAzooKeyView/EnableAzooKeyView.swift b/MainApp/EnableAzooKeyView/EnableAzooKeyView.swift index 17468360..5455c0f0 100644 --- a/MainApp/EnableAzooKeyView/EnableAzooKeyView.swift +++ b/MainApp/EnableAzooKeyView/EnableAzooKeyView.swift @@ -18,6 +18,7 @@ private enum EnableAzooKeyViewStep { case setting } +@MainActor struct EnableAzooKeyView: View { @EnvironmentObject private var appStates: MainAppStates @State private var step: EnableAzooKeyViewStep = .menu diff --git a/MainApp/General/KeyboardPreview.swift b/MainApp/General/KeyboardPreview.swift index 2615e979..8b00bef4 100644 --- a/MainApp/General/KeyboardPreview.swift +++ b/MainApp/General/KeyboardPreview.swift @@ -21,6 +21,7 @@ private struct CandidateMock: ResultViewItemData { #endif } +@MainActor struct KeyboardPreview: View { private let theme: AzooKeyTheme diff --git a/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift b/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift index 44274c78..362fa58f 100644 --- a/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift +++ b/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift @@ -126,6 +126,7 @@ final class AdditionalDictManager: ObservableObject { } +@MainActor struct AdditionalDictManageViewMain: View { enum Style { case simple diff --git a/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift b/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift index 97f0d817..f42180d5 100644 --- a/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift +++ b/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift @@ -63,6 +63,7 @@ struct AzooKeyUserDictionaryView: View { } } +@MainActor private struct UserDictionaryDataListView: View { private let exceptionKey = "その他" @@ -142,6 +143,7 @@ private struct UserDictionaryDataListView: View { } } +@MainActor private struct UserDictionaryDataEditor: CancelableEditor { @ObservedObject private var item: EditableUserDictionaryData @ObservedObject private var variables: UserDictManagerVariables diff --git a/MainApp/Setting/CustomKeys/QwertyCustomKeys/QwertyCustomKeysItemView.swift b/MainApp/Setting/CustomKeys/QwertyCustomKeys/QwertyCustomKeysItemView.swift index 35df07b8..3b65800c 100644 --- a/MainApp/Setting/CustomKeys/QwertyCustomKeys/QwertyCustomKeysItemView.swift +++ b/MainApp/Setting/CustomKeys/QwertyCustomKeys/QwertyCustomKeysItemView.swift @@ -101,6 +101,7 @@ private struct Selection: Hashable { var longpressEnabled = false } +@MainActor struct QwertyCustomKeysSettingView: View { @StateObject private var editState = EditState() @State private var setting = SettingUpdater() diff --git a/MainApp/Setting/FontSizeSetting/FontSizeSettingItemView.swift b/MainApp/Setting/FontSizeSetting/FontSizeSettingItemView.swift index 3f7a9212..bdc92ce5 100644 --- a/MainApp/Setting/FontSizeSetting/FontSizeSettingItemView.swift +++ b/MainApp/Setting/FontSizeSetting/FontSizeSettingItemView.swift @@ -73,6 +73,7 @@ struct FontSizeSettingView: View { } } +@MainActor private struct KeyView: View { @EnvironmentObject private var appStates: MainAppStates private let fontSize: CGFloat diff --git a/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift b/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift index b9f2baff..d57cfd28 100644 --- a/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift +++ b/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift @@ -25,6 +25,7 @@ extension LanguageLayout { } } +@MainActor struct LanguageLayoutSettingView: View { @EnvironmentObject private var appStates: MainAppStates @State private var selection: LanguageLayout = .flick diff --git a/MainApp/Setting/Template/TemplateListView.swift b/MainApp/Setting/Template/TemplateListView.swift index c6dc943f..7b3fe490 100644 --- a/MainApp/Setting/Template/TemplateListView.swift +++ b/MainApp/Setting/Template/TemplateListView.swift @@ -26,6 +26,7 @@ private final class NavigationModel: ObservableObject { } // Listが大元のtemplatesを持ち、各EditingViewにBindingで渡して編集させる。 +@MainActor struct TemplateListView: View { private static let dataFileName = "user_templates.json" @ObservedObject private var data = TemplateDataList() diff --git a/MainApp/Theme/ThemeTab.swift b/MainApp/Theme/ThemeTab.swift index b6c45f92..1db67ef7 100644 --- a/MainApp/Theme/ThemeTab.swift +++ b/MainApp/Theme/ThemeTab.swift @@ -12,6 +12,7 @@ import SwiftUI import SwiftUIUtils import SwiftUtils +@MainActor struct ThemeTabView: View { @Namespace private var namespace @EnvironmentObject private var appStates: MainAppStates diff --git a/azooKey.xcodeproj/project.pbxproj b/azooKey.xcodeproj/project.pbxproj index 90cdb8b9..dc6ed723 100644 --- a/azooKey.xcodeproj/project.pbxproj +++ b/azooKey.xcodeproj/project.pbxproj @@ -1634,7 +1634,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 2.2; - OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature ImplicitOpenExistentials"; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature ImplicitOpenExistentials -enable-upcoming-feature DisableOutwardActorInference -enable-upcoming-feature ImportObjcForwardDeclarations"; PRODUCT_BUNDLE_IDENTIFIER = DevEn3.azooKey; PRODUCT_NAME = azooKey; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1802,7 +1802,7 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = 2.2; - OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -enable-upcoming-feature ExistentialAny -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature ImplicitOpenExistentials"; + OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -enable-upcoming-feature ExistentialAny -enable-upcoming-feature ForwardTrailingClosures -enable-upcoming-feature BareSlashRegexLiterals -enable-upcoming-feature ConciseMagicFile -enable-upcoming-feature ImplicitOpenExistentials -enable-upcoming-feature ImportObjcForwardDeclarations -enable-upcoming-feature DisableOutwardActorInference"; PRODUCT_BUNDLE_IDENTIFIER = DevEn3.azooKey.keyboard; PRODUCT_NAME = Keyboard; PROVISIONING_PROFILE_SPECIFIER = "";