Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactoring] Swift 5.9のenable upcoming feature flagを追加 #286

Merged
merged 3 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions AzooKeyCore/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("ForwardTrailingClosures"),
.enableUpcomingFeature("ImplicitOpenExistentials"),
.enableUpcomingFeature("StrictConcurrency"),
.enableUpcomingFeature("DisableOutwardActorInference"),
.enableUpcomingFeature("ImportObjcForwardDeclarations"),
.unsafeFlags(["-strict-concurrency=complete"])
]
let package = Package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import SwiftUI

@MainActor
struct ExpandedResultView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@EnvironmentObject private var variableStates: VariableStates
@Binding private var isResultViewExpanded: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum KeyLabelType {
case selectable(String, String)
}

@MainActor
public struct KeyLabel<Extension: ApplicationSpecificKeyboardViewExtension>: View {
private let labelType: KeyLabelType
private let width: CGFloat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import SwiftUI
import SwiftUIUtils

@MainActor
struct LargeTextView: View {
private let text: String
@Binding private var isViewOpen: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI

@MainActor
struct MessageView<ID: MessageIdentifierProtocol>: View {
private let data: MessageData<ID>
@Binding private var manager: MessageManager<ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import SwiftUI

@MainActor
struct ResizingRect<Extension: ApplicationSpecificKeyboardViewExtension>: View {
typealias Position = (current: CGPoint, initial: CGPoint)
@State private var top_left_edge: Position
Expand Down Expand Up @@ -279,6 +280,7 @@ struct ResizingRect<Extension: ApplicationSpecificKeyboardViewExtension>: View {
}
}

@MainActor
struct ResizingBindingFrame<Extension: ApplicationSpecificKeyboardViewExtension>: ViewModifier {
private let initialSize: CGSize
@Binding private var position: CGPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ extension CustardInterfaceKey {
}
}

@MainActor
struct CustomKeyboardView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
private let custard: Custard
private var tabDesign: TabDependentDesign {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import SwiftUI
import SwiftUIUtils

@MainActor
struct SimpleKeyView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
private let model: any SimpleKeyModelProtocol
@EnvironmentObject private var variableStates: VariableStates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum KeyPressState {
}
}

@MainActor
public struct FlickKeyView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
private let model: any FlickKeyModelProtocol

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CustardKit
import Foundation
import SwiftUI

@MainActor
struct FlickSuggestView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@EnvironmentObject private var variableStates: VariableStates
@Environment(Extension.Theme.self) private var theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SwiftUI
import SwiftUIUtils

@MainActor
struct EmojiTabResultBar<Extension: ApplicationSpecificKeyboardViewExtension>: View {
init() {}
@Environment(Extension.Theme.self) private var theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import SwiftUI
import SwiftUIUtils

@MainActor
struct KeyboardBarView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@EnvironmentObject private var variableStates: VariableStates
@Binding private var isResultViewExpanded: Bool
Expand Down Expand Up @@ -37,6 +38,7 @@ struct KeyboardBarView<Extension: ApplicationSpecificKeyboardViewExtension>: Vie
}
}

@MainActor
struct KeyboardBarButton<Extension: ApplicationSpecificKeyboardViewExtension>: View {
enum LabelType {
case azooKeyIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct BetaMoveCursorBarState {
}
}

@MainActor
struct MoveCursorBarBeta<Extension: ApplicationSpecificKeyboardViewExtension>: View {
init() {}

Expand Down Expand Up @@ -283,6 +284,7 @@ private enum MoveCursorBarGestureState {
case moving(CGPoint, Int) // 右だったら+1、左だったら-1
}

@MainActor
struct MoveCursorBar<Extension: ApplicationSpecificKeyboardViewExtension>: View {
init() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private extension Equatable {
}
}

@MainActor
struct ResultBar<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@Namespace private var namespace
@Environment(Extension.Theme.self) private var theme
Expand Down
1 change: 1 addition & 0 deletions AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import SwiftUI

@MainActor
public struct KeyboardView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@State private var messageManager = MessageManager(necessaryMessages: Extension.MessageProvider.messages, userDefaults: Extension.MessageProvider.userDefaults)
@State private var isResultViewExpanded = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct QwertyKeyDoublePressState {
}
}

@MainActor
struct QwertyKeyView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
private let model: any QwertyKeyModelProtocol
@EnvironmentObject private var variableStates: VariableStates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private final class ClipboardHistory: ObservableObject {
}
}

@MainActor
struct ClipboardHistoryTab<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@EnvironmentObject private var variableStates: VariableStates
@StateObject private var target = ClipboardHistory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import KeyboardThemes
import SwiftUI
import SwiftUtils

@MainActor
struct EmojiTab<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@EnvironmentObject private var variableStates: VariableStates
@Environment(Extension.Theme.self) private var theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import SwiftUI
import enum KanaKanjiConverterModule.ConverterBehaviorSemantics

@MainActor
struct UpsideSearchView<Extension: ApplicationSpecificKeyboardViewExtension>: View {
@Environment(\.userActionManager) private var action
@Environment(Extension.Theme.self) private var theme
Expand Down
1 change: 1 addition & 0 deletions MainApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AzooKeyUtils
import KeyboardViews
import SwiftUI

@MainActor
struct ContentView: View {
private enum TabSelection {
case tips, theme, customize, settings
Expand Down
1 change: 1 addition & 0 deletions MainApp/Customize/EditingTenkeyCustardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions MainApp/Customize/ManageCustardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ struct WebCustardList: Codable {
var custards: [Item]
}

@MainActor
struct ManageCustardView: View {
@ObservedObject private var data = ImportedCustardData()
@State private var urlString: String = ""
Expand Down Expand Up @@ -369,6 +370,7 @@ struct ManageCustardView: View {
}

// FIXME: ファイルを保存もキャンセルもしない状態で2つ目のファイルを読み込むとエラーになる
@MainActor
struct URLImportCustardView: View {
@ObservedObject private var data = ImportedCustardData()
@State private var showAlert = false
Expand Down
1 change: 1 addition & 0 deletions MainApp/EnableAzooKeyView/EnableAzooKeyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ private enum EnableAzooKeyViewStep {
case setting
}

@MainActor
struct EnableAzooKeyView: View {
@EnvironmentObject private var appStates: MainAppStates
@State private var step: EnableAzooKeyViewStep = .menu
Expand Down
1 change: 1 addition & 0 deletions MainApp/General/KeyboardPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private struct CandidateMock: ResultViewItemData {
#endif
}

@MainActor
struct KeyboardPreview: View {
private let theme: AzooKeyTheme

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ final class AdditionalDictManager: ObservableObject {

}

@MainActor
struct AdditionalDictManageViewMain: View {
enum Style {
case simple
Expand Down
2 changes: 2 additions & 0 deletions MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct AzooKeyUserDictionaryView: View {
}
}

@MainActor
private struct UserDictionaryDataListView: View {
private let exceptionKey = "その他"

Expand Down Expand Up @@ -142,6 +143,7 @@ private struct UserDictionaryDataListView: View {
}
}

@MainActor
private struct UserDictionaryDataEditor: CancelableEditor {
@ObservedObject private var item: EditableUserDictionaryData
@ObservedObject private var variables: UserDictManagerVariables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ private struct Selection: Hashable {
var longpressEnabled = false
}

@MainActor
struct QwertyCustomKeysSettingView<SettingKey: QwertyCustomKeyKeyboardSetting>: View {
@StateObject private var editState = EditState()
@State private var setting = SettingUpdater<SettingKey>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct FontSizeSettingView<SettingKey: DoubleKeyboardSettingKey>: View {
}
}

@MainActor
private struct KeyView: View {
@EnvironmentObject private var appStates: MainAppStates
private let fontSize: CGFloat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extension LanguageLayout {
}
}

@MainActor
struct LanguageLayoutSettingView<SettingKey: LanguageLayoutKeyboardSetting>: View {
@EnvironmentObject private var appStates: MainAppStates
@State private var selection: LanguageLayout = .flick
Expand Down
1 change: 1 addition & 0 deletions MainApp/Setting/Template/TemplateListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions MainApp/Theme/ThemeTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SwiftUI
import SwiftUIUtils
import SwiftUtils

@MainActor
struct ThemeTabView: View {
@Namespace private var namespace
@EnvironmentObject private var appStates: MainAppStates
Expand Down
4 changes: 2 additions & 2 deletions azooKey.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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 = "";
Expand Down