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

Remove swift version checks and set the required tools version to 5.7 #3547

Merged
merged 3 commits into from
Jan 3, 2025
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: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.7

import Foundation
import PackageDescription
Expand Down Expand Up @@ -56,8 +56,6 @@ let package = Package(
]
)

#if swift(>=5.6)
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.0.0")
)
#endif
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</p>
<p align="center">
<a href="https://getstream.io/chat/docs/sdk/ios/"><img src="https://img.shields.io/badge/iOS-13%2B-lightblue" /></a>
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-5.6%2B-orange.svg" /></a>
<a href="https://swift.org"><img src="https://img.shields.io/badge/Swift-5.7%2B-orange.svg" /></a>
<a href="https://github.com/GetStream/stream-chat-swift/actions"><img src="https://github.com/GetStream/stream-chat-swift/actions/workflows/cron-checks.yml/badge.svg" /></a>
<a href="https://sonarcloud.io/summary/new_code?id=GetStream_stream-chat-swift"><img src="https://sonarcloud.io/api/project_badges/measure?project=GetStream_stream-chat-swift&metric=coverage" /></a>
</p>
Expand Down Expand Up @@ -39,7 +39,7 @@ The **StreamChatSwiftUI SDK** is our UI SDK for SwiftUI components. If your appl
- **Familiar behavior**: The UI elements are good platform citizens and behave like native elements; they respect `tintColor`, `layoutMargins`, light/dark mode, dynamic font sizes, etc.
- **Swift native API:** Uses Swift's powerful language features to make the SDK usage easy and type-safe.
- `UIKit` and `SwiftUI` SDKs use native patterns and paradigms from respective UI frameworks: The API follows the design of native system SDKs. It makes integration with your existing code easy and familiar.
- `UIKit` SDK is part of this repository whereas `SwiftUI` SDK is available [here](https://github.com/GetStream/stream-chat-swiftui).
- `UIKit` SDK is part of this repository whereas `SwiftUI` SDK is available [here](https://github.com/GetStream/stream-chat-swiftui).
- **First-class support for `Combine` and `Structured Concurrency`**: Refer to our getting started guides for [Combine](https://getstream.io/chat/docs/sdk/ios/combine/) and [Structured Concurrency](https://getstream.io/chat/docs/sdk/ios/client/state-layer/state-layer-overview/).
- **Fully open-source implementation:** You have access to the complete source code of the SDK here on GitHub.
- **Supports iOS 13+:** We proudly support older versions of iOS, so your app can stay available to almost everyone.
Expand Down
2 changes: 1 addition & 1 deletion StreamChat-XCFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.author = { "getstream.io" => "[email protected]" }
spec.social_media_url = "https://getstream.io"

spec.swift_version = '5.6'
spec.swift_version = '5.7'
spec.ios.deployment_target = '13.0'
spec.requires_arc = true

Expand Down
2 changes: 1 addition & 1 deletion StreamChat.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.author = { "getstream.io" => "[email protected]" }
spec.social_media_url = "https://getstream.io"

spec.swift_version = '5.6'
spec.swift_version = '5.7'
spec.ios.deployment_target = '13.0'
spec.osx.deployment_target = '11.0'
spec.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion StreamChatUI-XCFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.author = { "getstream.io" => "[email protected]" }
spec.social_media_url = "https://getstream.io"

spec.swift_version = '5.6'
spec.swift_version = '5.7'
spec.platform = :ios, "13.0"
spec.requires_arc = true

Expand Down
2 changes: 1 addition & 1 deletion StreamChatUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.author = { "getstream.io" => "[email protected]" }
spec.social_media_url = "https://getstream.io"

spec.swift_version = '5.6'
spec.swift_version = '5.7'
spec.platform = :ios, "13.0"
spec.requires_arc = true

Expand Down
27 changes: 6 additions & 21 deletions Tests/StreamChatTests/StateLayer/ChannelList_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ final class ChannelList_Tests: XCTestCase {
try await env.client.mockDatabaseContainer.write { session in
session.saveChannelList(payload: incomingChannelListPayload, query: self.channelList.query)
}
await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)
cancellable.cancel()
}

Expand Down Expand Up @@ -266,7 +266,7 @@ final class ChannelList_Tests: XCTestCase {
try await env.client.mockDatabaseContainer.write { session in
session.saveChannelList(payload: incomingChannelListPayload, query: self.channelList.query)
}
await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)
cancellable.cancel()
}

Expand Down Expand Up @@ -303,7 +303,7 @@ final class ChannelList_Tests: XCTestCase {
try await env.client.mockDatabaseContainer.write { session in
session.saveChannelList(payload: incomingChannelListPayload, query: self.channelList.query)
}
await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)
cancellable.cancel()
}

Expand Down Expand Up @@ -339,7 +339,7 @@ final class ChannelList_Tests: XCTestCase {
try await env.client.mockDatabaseContainer.write { session in
session.saveChannelList(payload: incomingChannelListPayload, query: self.channelList.query)
}
await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)
cancellable.cancel()
}

Expand Down Expand Up @@ -381,7 +381,7 @@ final class ChannelList_Tests: XCTestCase {
let eventExpectation = XCTestExpectation(description: "Event processed")
env.client.eventNotificationCenter.process([event], completion: { eventExpectation.fulfill() })

await fulfillmentCompatibility(of: [eventExpectation, stateExpectation], timeout: defaultTimeout, enforceOrder: true)
await fulfillment(of: [eventExpectation, stateExpectation], timeout: defaultTimeout, enforceOrder: true)
cancellable.cancel()
}

Expand Down Expand Up @@ -414,7 +414,7 @@ final class ChannelList_Tests: XCTestCase {
)
let eventExpectation = XCTestExpectation(description: "Event processed")
env.client.eventNotificationCenter.process([event], completion: { eventExpectation.fulfill() })
await fulfillmentCompatibility(of: [eventExpectation], timeout: defaultTimeout, enforceOrder: true)
await fulfillment(of: [eventExpectation], timeout: defaultTimeout, enforceOrder: true)
cancellable.cancel()
}

Expand Down Expand Up @@ -539,18 +539,3 @@ extension ChannelList_Tests {
}
}
}

extension XCTestCase {
func fulfillmentCompatibility(of expectations: [XCTestExpectation], timeout seconds: TimeInterval, enforceOrder enforceOrderOfFulfillment: Bool = false) async {
#if swift(>=5.8)
await fulfillment(of: expectations, timeout: seconds, enforceOrder: enforceOrderOfFulfillment)
#else
await withCheckedContinuation { continuation in
Thread.detachNewThread { [self] in
wait(for: expectations, timeout: seconds, enforceOrder: enforceOrderOfFulfillment)
continuation.resume()
}
}
#endif
}
}
4 changes: 2 additions & 2 deletions Tests/StreamChatTests/StateLayer/Chat_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ final class Chat_Tests: XCTestCase {
messageId: apiResponse.message.id
)

await fulfillmentCompatibility(of: [notificationExpectation], timeout: defaultTimeout)
await fulfillment(of: [notificationExpectation], timeout: defaultTimeout)

XCTAssertEqual(text, message.text)
await XCTAssertEqual(1, chat.state.messages.count)
Expand Down Expand Up @@ -1304,7 +1304,7 @@ final class Chat_Tests: XCTestCase {
)
XCTAssertEqual(apiResponse.message.id, replyMessage.id)

await fulfillmentCompatibility(of: [notificationExpectation], timeout: defaultTimeout)
await fulfillment(of: [notificationExpectation], timeout: defaultTimeout)

let messageState = try await chat.messageState(for: lastMessageId)
await XCTAssertEqual(lastMessageId, messageState.message.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual("first", observer.item?.name)
XCTAssertEqual(1, changeCount)
Expand Down Expand Up @@ -70,7 +70,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual("second", observer.item?.name)
XCTAssertEqual(1, changeCount)
Expand Down Expand Up @@ -98,7 +98,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual("second", observer.item?.name)
XCTAssertEqual("team2", observer.item?.team)
Expand Down Expand Up @@ -128,7 +128,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual(8, observer.items.count)
let expectedIds = (firstPayload.messages + secondPayload.messages).map(\.id)
Expand Down Expand Up @@ -161,7 +161,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual(3, observer.items.count)
XCTAssertEqual(secondPayload.messages.map(\.id), observer.items.map(\.id))
Expand Down Expand Up @@ -195,7 +195,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {

try await waitForDuplicateCallbacks()

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

XCTAssertEqual(11, observer.items.count)
let expectedIds = (firstPayload.messages + secondPayload.messages + thirdPayload.messages).map(\.id)
Expand Down Expand Up @@ -254,7 +254,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {
try session.saveChannel(payload: channelPayload, query: query, cache: nil)
}

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

// 4 are reused, 1 is created
XCTAssertEqual(6, itemCreatorCounter)
Expand All @@ -279,7 +279,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {
try session.saveChannel(payload: secondPayload)
}

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

// 5 are reused, 5 are created
XCTAssertEqual(15, messageItemCreatorCounter)
Expand Down Expand Up @@ -329,7 +329,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {
try session.saveReaction(payload: makePayload(1).reactions[0], query: query, cache: nil)
}

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

// 4 are reused, 1 is created
XCTAssertEqual(6, itemCreatorCounter)
Expand Down Expand Up @@ -365,7 +365,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {
try session.saveThread(payload: makePayload(1).threads[0], cache: nil)
}

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

// 4 are reused, 1 is created
XCTAssertEqual(6, itemCreatorCounter)
Expand Down Expand Up @@ -405,7 +405,7 @@ final class StateLayerDatabaseObserver_Tests: XCTestCase {
try session.saveUser(payload: makePayload(1).users[0])
}

await fulfillmentCompatibility(of: [expectation], timeout: defaultTimeout)
await fulfillment(of: [expectation], timeout: defaultTimeout)

// 4 are reused, 1 is created
XCTAssertEqual(6, itemCreatorCounter)
Expand Down
4 changes: 2 additions & 2 deletions Tests/StreamChatTests/StateLayer/UserSearch_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class UserSearch_Tests: XCTestCase {
expectation1.fulfill()
}

await fulfillmentCompatibility(of: [expectation1], timeout: defaultTimeout)
await fulfillment(of: [expectation1], timeout: defaultTimeout)

// Search for "name"
async let result2 = try await userSearch.search(term: "name")
Expand All @@ -84,7 +84,7 @@ final class UserSearch_Tests: XCTestCase {
expectation2.fulfill()
}

await fulfillmentCompatibility(of: [expectation2], timeout: defaultTimeout)
await fulfillment(of: [expectation2], timeout: defaultTimeout)

XCTAssertEqual(2, env.userListUpdaterMock.fetch_completions.count)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@testable import StreamChatTestTools
import XCTest

#if swift(>=5.7)
@available(iOS 16.0, *)
final class ChatMessage_Equatable_Tests: XCTestCase {
var database: DatabaseContainer!
Expand Down Expand Up @@ -245,4 +244,3 @@ extension Collection {
}
}
}
#endif
Loading