Skip to content

Commit 095caaa

Browse files
authored
[V5] Use Swift 6 with complete concurrency checking (#902)
1 parent 8871a7e commit 095caaa

File tree

267 files changed

+3387
-4620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+3387
-4620
lines changed

.github/workflows/smoke-checks.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ jobs:
6565

6666
build-xcode15:
6767
name: Build SDKs (Xcode 15)
68-
runs-on: macos-14
69-
if: ${{ github.event.inputs.record_snapshots != 'true' }}
68+
runs-on: macos-15
69+
#if: ${{ github.event.inputs.record_snapshots != 'true' }}
70+
if: false
7071
env:
7172
XCODE_VERSION: "15.4"
7273
steps:

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stream rules
22
--header "\nCopyright © {year} Stream.io Inc. All rights reserved.\n"
3-
--swiftversion 5.9
3+
--swiftversion 6.0
44

55
--ifdef no-indent
66
--disable redundantType

.swiftlint.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ only_rules:
4343
- trailing_comma
4444
- trailing_newline
4545
- trailing_semicolon
46-
- trailing_whitespace
4746
- unneeded_break_in_switch
4847
- unneeded_override
4948
- unused_closure_parameter
5049
- unused_control_flow_label
5150
- unused_import
5251
- vertical_whitespace
5352
- void_return
54-
55-
trailing_whitespace:
56-
ignores_empty_lines: true

DemoAppSwiftUI/AppConfiguration/AppConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import StreamChat
77
import StreamChatSwiftUI
88

99
final class AppConfiguration {
10-
static let `default` = AppConfiguration()
10+
@MainActor static let `default` = AppConfiguration()
1111

1212
/// The translation language to set on connect.
1313
var translationLanguage: TranslationLanguage?

DemoAppSwiftUI/AppConfiguration/AppConfigurationTranslationView.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@ import SwiftUI
88
struct AppConfigurationTranslationView: View {
99
@Environment(\.dismiss) var dismiss
1010

11-
var selection: Binding<TranslationLanguage?> = Binding {
12-
AppConfiguration.default.translationLanguage
13-
} set: { newValue in
14-
AppConfiguration.default.translationLanguage = newValue
15-
}
16-
1711
var body: some View {
1812
List {
1913
ForEach(TranslationLanguage.all, id: \.languageCode) { language in
2014
Button(action: {
21-
selection.wrappedValue = language
15+
AppConfiguration.default.translationLanguage = language
2216
dismiss()
2317
}) {
2418
HStack {
2519
Text(language.languageCode)
2620
Spacer()
27-
if selection.wrappedValue == language {
21+
if AppConfiguration.default.translationLanguage == language {
2822
Image(systemName: "checkmark")
2923
}
3024
}

DemoAppSwiftUI/AppConfiguration/AppConfigurationView.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import Combine
66
import SwiftUI
77

88
struct AppConfigurationView: View {
9-
var channelPinningEnabled: Binding<Bool> = Binding {
10-
AppConfiguration.default.isChannelPinningFeatureEnabled
11-
} set: { newValue in
12-
AppConfiguration.default.isChannelPinningFeatureEnabled = newValue
13-
}
9+
@State private var channelPinningEnabled = AppConfiguration.default.isChannelPinningFeatureEnabled
1410

1511
var body: some View {
1612
NavigationView {
@@ -19,12 +15,13 @@ struct AppConfigurationView: View {
1915
NavigationLink("Translation") {
2016
AppConfigurationTranslationView()
2117
}
22-
Toggle("Channel Pinning", isOn: channelPinningEnabled)
18+
Toggle("Channel Pinning", isOn: $channelPinningEnabled)
2319
}
2420
}
2521
.navigationBarTitleDisplayMode(.inline)
2622
.navigationTitle("App Configuration")
2723
}
24+
.onChange(of: channelPinningEnabled, perform: { AppConfiguration.default.isChannelPinningFeatureEnabled = $0 })
2825
}
2926
}
3027

DemoAppSwiftUI/AppleMessageComposerView.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ struct AppleMessageComposerView<Factory: ViewFactory>: View, KeyboardReadable {
125125
}
126126
)
127127
.onPreferenceChange(HeightPreferenceKey.self) { value in
128-
if let value = value, value != composerHeight {
129-
self.composerHeight = value
128+
Task { @MainActor in
129+
if let value = value, value != composerHeight {
130+
self.composerHeight = value
131+
}
130132
}
131133
}
132134
.onReceive(keyboardWillChangePublisher) { visible in
@@ -159,7 +161,7 @@ struct AppleMessageComposerView<Factory: ViewFactory>: View, KeyboardReadable {
159161
}
160162
)
161163
.offset(y: -composerHeight)
162-
.animation(nil) : nil,
164+
.animation(.none, value: viewModel.showCommandsOverlay) : nil,
163165
alignment: .bottom
164166
)
165167
.modifier(factory.makeComposerViewModifier())
@@ -213,7 +215,7 @@ struct BlurredBackground: View {
213215
}
214216

215217
struct HeightPreferenceKey: PreferenceKey {
216-
static var defaultValue: CGFloat?
218+
static var defaultValue: CGFloat? { nil }
217219

218220
static func reduce(value: inout CGFloat?, nextValue: () -> CGFloat?) {
219221
value = value ?? nextValue()

DemoAppSwiftUI/ChannelHeader/BlockedUsersViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import StreamChat
66
import StreamChatSwiftUI
77
import SwiftUI
88

9-
class BlockedUsersViewModel: ObservableObject {
9+
@MainActor class BlockedUsersViewModel: ObservableObject {
1010
@Injected(\.chatClient) var chatClient
1111

1212
@Published var blockedUsers = [ChatUser]()

DemoAppSwiftUI/ChannelHeader/ChooseChannelQueryView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import StreamChatSwiftUI
77
import SwiftUI
88

99
struct ChooseChannelQueryView: View {
10-
static let queryIdentifiers = ChannelListQueryIdentifier.allCases.sorted(using: KeyPathComparator(\.title))
10+
static var queryIdentifiers: [ChannelListQueryIdentifier] {
11+
ChannelListQueryIdentifier.allCases.sorted(by: { $0.title < $1.title })
12+
}
1113

1214
var body: some View {
1315
ForEach(Self.queryIdentifiers) { queryIdentifier in

DemoAppSwiftUI/ChannelHeader/NewChatViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import StreamChat
66
import StreamChatSwiftUI
77
import SwiftUI
88

9-
class NewChatViewModel: ObservableObject, ChatUserSearchControllerDelegate {
9+
@MainActor class NewChatViewModel: ObservableObject, ChatUserSearchControllerDelegate {
1010
@Injected(\.chatClient) var chatClient
1111

1212
@Published var searchText: String = "" {

0 commit comments

Comments
 (0)