Skip to content

Commit

Permalink
Merge pull request #276 from nathantannar4/swift_6
Browse files Browse the repository at this point in the history
Migrate to Swift 6, fully support async/await and Swift concurrency, drop iOS 13
  • Loading branch information
Kaspik authored Oct 30, 2024
2 parents c7acd5f + 8a53596 commit b810a8b
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_master_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
tests:
name: Build Framework
runs-on: macOS-latest
runs-on: macOS-15
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_pr_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: pull_request
jobs:
tests:
name: Build Example app
runs-on: macOS-latest
runs-on: macOS-15
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_pr_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: pull_request
jobs:
tests:
name: Build Framework
runs-on: macOS-latest
runs-on: macOS-15
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
- Master:
- Nothing yet
- 7.0.0
- [#274](https://github.com/nathantannar4/InputBarAccessoryView/pull/276) Migrate to Swift 6 with full async/Await Swift 6 concurrency support
- Drop iOS 13 support
- 6.5.0
- Bump Swift version to 5.10
- [#274](https://github.com/nathantannar4/InputBarAccessoryView/pull/274) Perform layout changes on main thread
Expand Down
11 changes: 7 additions & 4 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -226,8 +226,9 @@
383B83911F47897800027965 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1230;
LastUpgradeCheck = 1600;
ORGANIZATIONNAME = "Nathan Tannar";
TargetAttributes = {
383B83981F47897800027965 = {
Expand Down Expand Up @@ -355,7 +356,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -410,7 +411,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -422,6 +423,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = JH5XJ55XGZ;
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -438,6 +440,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = JH5XJ55XGZ;
INFOPLIST_FILE = Resources/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class AdditionalBottomSpaceExampleViewController: CommonTableViewControlle

keyboardManager.additionalInputViewBottomConstraintConstant = {
var safeBottomInset: CGFloat = self.view.safeAreaInsets.bottom
if let windowBottomInset = UIApplication.shared.windows.first?.safeAreaInsets.bottom,
if let windowBottomInset = UIWindowScene.activeScene?.windows.first?.safeAreaInsets.bottom,
safeBottomInset != windowBottomInset {
safeBottomInset = windowBottomInset
}
Expand All @@ -65,3 +65,14 @@ final class AdditionalBottomSpaceExampleViewController: CommonTableViewControlle
self.inputBar.inputTextView.becomeFirstResponder()
}
}

private extension UIWindowScene {
static var activeScene: UIWindowScene? {
let connectedScenes = UIApplication.shared.connectedScenes
if connectedScenes.count > 1 {
return connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene
} else {
return connectedScenes.first as? UIWindowScene
}
}
}
4 changes: 2 additions & 2 deletions GitHubActions/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ MODE="$1"

if [ "$MODE" = "framework" -o "$MODE" = "all" ]; then
echo "Building InputBarAccessoryView Framework."
set -o pipefail && xcodebuild build -scheme InputBarAccessoryView -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 14" | xcpretty -c
set -o pipefail && xcodebuild build -scheme InputBarAccessoryView -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 16" | xcpretty -c
success="1"
fi

if [ "$MODE" = "example" -o "$MODE" = "all" ]; then
echo "Building InputBarAccessoryView Example app."
set -o pipefail && xcodebuild build -project Example/Example.xcodeproj -scheme Example -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 14 Pro" | xcpretty -c
set -o pipefail && xcodebuild build -project Example/Example.xcodeproj -scheme Example -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 16 Pro" | xcpretty -c
success="1"
fi

Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version:5.10
// swift-tools-version:6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "InputBarAccessoryView",
platforms: [.iOS(.v13)],
platforms: [.iOS(.v14)],
products: [
.library(name: "InputBarAccessoryView", targets: ["InputBarAccessoryView"]),
],
Expand All @@ -16,5 +16,5 @@ let package = Package(
exclude: ["Supporting/Info.plist"]
)
],
swiftLanguageVersions: [.v5]
swiftLanguageModes: [.v6]
)
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ https://github.com/nathantannar4/InputBarAccessoryView.git

### Requirements

iOS 13.0+
Swift 5.5
iOS 14.0+
Swift 6

> The latest iOS 13 release is v6.5.0
> The latest iOS 12 release is v5.5.0
Expand Down Expand Up @@ -74,6 +76,21 @@ Add your app to the list of apps using this library and make a pull request.
iMessage style [TypingIndicator](https://github.com/nathantannar4/TypingIndicator) for chat apps

## Latest Releases
7.0.0
- **Breaking change**: Drop iOS 13 support
- **Breaking change**: Move to Swift 6, fully support Swift concurrency

6.5.0
- Bump Swift version to 5.10
- Perform layout changes on main thread

6.4.0
- Fixed bottom gap calculations for embedded controllers

6.3.0
- Fixed the gap between keyboard and input bar when used on pagesheet/formsheet on iPad
- Fixed crash after adding image attachment

6.2.0
- Remove `canBecomeFirstResponder` on `InputTextView` to fix `UITextViewDelegate` methods not being called

Expand All @@ -88,16 +105,6 @@ iMessage style [TypingIndicator](https://github.com/nathantannar4/TypingIndicato
- **Breaking change**: Drop CocoaPods support & RxSwift extension (it was available only via CocoaPods)
- KeyboardManager will not update position of inputAccessoryView from interactive dismiss panGesture when the keyboard is floating
- Update docs

5.5.0
- Update SPM tools to Swift 5.5
- Added new optional delegate method for custom attachments size
- Added new animations for left/right stack view constraints

5.4.0
- Make sure framework is ready for Xcode 13
- Fix availability in AppExtensions
- Fix Package.swift to support iOS 12+ only

See [CHANGELOG](./CHANGELOG.md) for more details and older releases.

Expand Down
2 changes: 1 addition & 1 deletion Sources/Models/HorizontalEdgePadding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import CoreGraphics

public struct HorizontalEdgePadding {
public struct HorizontalEdgePadding: Sendable {
public let left: CGFloat
public let right: CGFloat

Expand Down
1 change: 1 addition & 0 deletions Sources/Models/NSConstraintLayoutSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import Foundation
import UIKit

@MainActor
class NSLayoutConstraintSet {

var top: NSLayoutConstraint?
Expand Down
1 change: 1 addition & 0 deletions Sources/Plugins/AttachmentManager/AttachmentManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import UIKit

@MainActor
open class AttachmentManager: NSObject, InputPlugin {

public enum Attachment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import UIKit

/// AutocompleteManagerDataSource is a protocol that passes data to the AutocompleteManager
@MainActor
public protocol AutocompleteManagerDataSource: AnyObject {

/// The autocomplete options for the registered prefix.
Expand Down
1 change: 1 addition & 0 deletions Sources/Protocols/InputBarAccessoryViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Foundation
import UIKit

/// InputBarAccessoryViewDelegate is a protocol that can recieve notifications from the InputBarAccessoryView
@MainActor
public protocol InputBarAccessoryViewDelegate: AnyObject {

/// Called when the default send button has been selected
Expand Down
1 change: 1 addition & 0 deletions Sources/Protocols/InputItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import UIKit

/// InputItem is a protocol that links elements to the InputBarAccessoryView to make them reactive
@MainActor
public protocol InputItem: AnyObject {

/// A weak reference to the InputBarAccessoryView. Set when inserted into an InputStackView
Expand Down
1 change: 1 addition & 0 deletions Sources/Protocols/InputPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import UIKit

/// `InputPlugin` is a protocol that makes integrating plugins to the `InputBarAccessoryView` easy.
@MainActor
public protocol InputPlugin: AnyObject {

/// Should reload the state if the `InputPlugin`
Expand Down

0 comments on commit b810a8b

Please sign in to comment.