diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb9c5d1a..fef520eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,8 +12,8 @@ jobs: strategy: matrix: xcode: - - '13.2.1' # Swift 5.5 (lowest) - - '14.0.1' # Swift 5.7 (highest) + - '14.3.1' # Swift 5.8 (lowest) + - '15.4' # Swift 5.10 (highest) steps: - uses: actions/checkout@v2 - uses: ./.github/actions/setup @@ -27,7 +27,7 @@ jobs: strategy: matrix: xcode: - - '14.0.1' # Swift 5.7 (highest) + - '15.4' # Swift 5.10 (highest) steps: - uses: actions/checkout@v2 - uses: ./.github/actions/setup @@ -41,8 +41,8 @@ jobs: strategy: matrix: xcode: - - '13.2.1' # Swift 5.5 (lowest) - - '14.0.1' # Swift 5.7 (highest) + - '14.3.1' # Swift 5.8 (lowest) + - '15.4' # Swift 5.10 (highest) steps: - uses: actions/checkout@v2 - uses: ./.github/actions/setup @@ -56,8 +56,8 @@ jobs: strategy: matrix: xcode: - - '13.2.1' # Swift 5.5 (lowest) - - '14.0.1' # Swift 5.7 (highest) + - '14.3.1' # Swift 5.8 (lowest) + - '15.4' # Swift 5.10 (highest) steps: - uses: actions/checkout@v2 - uses: ./.github/actions/setup diff --git a/CHANGELOG.md b/CHANGELOG.md index 4915a528..dca721f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Made new layout-based SwiftUI cell rendering option the default. - Fixed interaction of SwiftUI bars on visionOS - Added flag for forcing layout on a hosted SwiftUI view after layout margins change +- Updated `EpoxySwiftUIHostingController` with a flag to disable its keyboard avoidance behavior ## [0.10.0](https://github.com/airbnb/epoxy-ios/compare/0.9.0...0.10.0) - 2023-06-29 diff --git a/Rakefile b/Rakefile index c0631351..e7abcc56 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,7 @@ namespace :build do desc 'Builds the EpoxyExample app' task :example do - xcodebuild 'build -scheme EpoxyExample -destination "platform=iOS Simulator,name=iPhone 12"' + xcodebuild 'build -scheme EpoxyExample -destination "platform=iOS Simulator,name=iPhone 14"' end end @@ -23,12 +23,12 @@ namespace :test do desc 'Runs unit tests' task :unit do - xcodebuild 'test -scheme EpoxyTests -destination "platform=iOS Simulator,name=iPhone 12"' + xcodebuild 'test -scheme EpoxyTests -destination "platform=iOS Simulator,name=iPhone 14"' end desc 'Runs performance tests' task :performance do - xcodebuild 'test -scheme PerformanceTests -destination "platform=iOS Simulator,name=iPhone 12"' + xcodebuild 'test -scheme PerformanceTests -destination "platform=iOS Simulator,name=iPhone 14"' end end diff --git a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift index 3203775a..fa690b31 100644 --- a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift +++ b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift @@ -19,7 +19,7 @@ open class EpoxySwiftUIHostingController: UIHostingController: UIHostingController: UIHostingController Void = { _, _ in } + let implementation = imp_implementationWithBlock(keyboardWillShowOverride) + let typeEncoding = method_getTypeEncoding(method) + class_addMethod(viewSubclass, selector, implementation, typeEncoding) + + objc_registerClassPair(viewSubclass) + object_setClass(view, viewSubclass) + } } #endif diff --git a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift index 63efb847..d69a2a8a 100644 --- a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +++ b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift @@ -67,7 +67,8 @@ public final class EpoxySwiftUIHostingView: UIView, EpoxyableVie epoxyContent = EpoxyHostingContent(rootView: style.initialContent.rootView) viewController = EpoxySwiftUIHostingController( rootView: .init(content: epoxyContent, environment: epoxyEnvironment), - ignoreSafeArea: true) + ignoresSafeArea: true, + ignoresKeyboardAvoidance: true) dataID = style.initialContent.dataID ?? DefaultDataID.noneProvided as AnyHashable forceLayoutOnLayoutMarginsChange = style.forceLayoutOnLayoutMarginsChange