Skip to content

Commit

Permalink
Merge pull request #1978 from Skyscanner/ios-15-deprecation
Browse files Browse the repository at this point in the history
Update iOS deployment targets to 16.0
  • Loading branch information
frugoman authored Jun 3, 2024
2 parents bb7c3cf + df0d6e8 commit 1a701ad
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 612 deletions.
2 changes: 1 addition & 1 deletion Backpack-Common.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.ios.resource_bundle = {
'Icons' => 'Backpack-Common/Icons/Assets/*'
}
s.ios.deployment_target = '15.1'
s.ios.deployment_target = '16.0'
s.source_files = 'Backpack-Common/**/*.swift'
s.exclude_files = 'Backpack-Common/Tests/**/*.swift'
s.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion Backpack-Fonts/Backpack-Fonts.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Pod::Spec.new do |spec|
spec.author = {
'Backpack Design System' => '[email protected]'
}
spec.ios.deployment_target = '15.1'
spec.ios.deployment_target = '16.0'
spec.source = {
git: 'https://github.com/Skyscanner/backpack-ios.git', tag: spec.version.to_s
}
Expand Down
2 changes: 1 addition & 1 deletion Backpack-SwiftUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Pod::Spec.new do |s|
s.source = {
git: 'https://github.com/Skyscanner/backpack-ios.git', tag: s.version.to_s
}
s.ios.deployment_target = '15.1'
s.ios.deployment_target = '16.0'
s.source_files = 'Backpack-SwiftUI/*/Classes/**/*.swift'

s.dependency 'Backpack-Common'
Expand Down
118 changes: 33 additions & 85 deletions Backpack-SwiftUI/BottomSheet/Classes/BPKBottomSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,47 +41,25 @@ public extension View {
closeButtonAccessibilityLabel: String? = nil,
title: String? = nil,
action: BPKBottomSheetAction? = nil,
presentingController: UIViewController,
@ViewBuilder bottomSheetContent: @escaping () -> BottomSheetContent
) -> some View {
if #available(iOS 16.0, *) {
modifier(
BottomSheetContainerViewModifier(
isPresented: isPresented,
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { isPresented.wrappedValue.toggle() }
),
title: title,
action: action
)
},
bottomSheetContent: bottomSheetContent
)
modifier(
BottomSheetContainerViewModifier(
isPresented: isPresented,
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { isPresented.wrappedValue.toggle() }
),
title: title,
action: action
)
},
bottomSheetContent: bottomSheetContent
)
} else {
modifier(
LegacyBottomSheetContainerViewModifier(
isPresented: isPresented,
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { isPresented.wrappedValue.toggle() }
),
title: title,
action: action
)
},
bottomSheetContent: bottomSheetContent,
presentingController: presentingController
)
)
}
)
}

@ViewBuilder
Expand All @@ -91,54 +69,25 @@ public extension View {
closeButtonAccessibilityLabel: String? = nil,
title: String? = nil,
action: BPKBottomSheetAction? = nil,
presentingController: UIViewController,
@ViewBuilder bottomSheetContent: @escaping (Item) -> BottomSheetContent
) -> some View {
if #available(iOS 16.0, *) {
modifier(
ItemBottomSheetContainerViewModifier(
item: item,
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { item.wrappedValue = nil }
),
title: title,
action: action
)
},
bottomSheetContent: bottomSheetContent
)
modifier(
ItemBottomSheetContainerViewModifier(
item: item,
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { item.wrappedValue = nil }
),
title: title,
action: action
)
},
bottomSheetContent: bottomSheetContent
)
} else {
modifier(
LegacyBottomSheetContainerViewModifier(
isPresented: Binding(
get: { item.wrappedValue != nil },
set: { _ in item.wrappedValue = nil }
),
contentMode: contentMode,
header: {
header(
closeAction: closeAction(
closeButtonAccessibilityLabel: closeButtonAccessibilityLabel,
closeAction: { item.wrappedValue = nil }
),
title: title,
action: action
)
},
bottomSheetContent: {
if let itemValue = item.wrappedValue {
bottomSheetContent(itemValue)
}
},
presentingController: presentingController
)
)
}
)
}

private func closeAction(
Expand Down Expand Up @@ -174,8 +123,7 @@ struct BPKBottomSheet_Previews: PreviewProvider {
contentMode: .fitContent, closeButtonAccessibilityLabel: "asd", title: "Hello",
action: BPKBottomSheetAction(
title: "Action",
action: {}),
presentingController: UIViewController()) {
action: {})) {
BPKText("Bottom sheet content")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import SwiftUI

@available(iOS 16.0, *)
struct BottomSheetContainerViewModifier<Header: View, BottomSheetContent: View>: ViewModifier {
@Binding var isPresented: Bool
@ViewBuilder let header: () -> Header
Expand Down Expand Up @@ -68,7 +67,6 @@ struct BottomSheetContainerViewModifier<Header: View, BottomSheetContent: View>:
}
}

@available(iOS 16.0, *)
extension PresentationDetent {
static func initialDetent(for contentMode: BPKBottomSheetContentMode) -> PresentationDetent {
switch contentMode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import SwiftUI

@available(iOS 16.0, *)
struct ContentFitBottomSheet<Content: View, Header: View>: View {
let header: () -> Header
let bottomSheetContent: () -> Content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import SwiftUI

@available(iOS 16.0, *)
struct ItemBottomSheetContainerViewModifier<
Header: View,
BottomSheetContent: View,
Expand Down

This file was deleted.

Loading

0 comments on commit 1a701ad

Please sign in to comment.