Skip to content

Commit 62364eb

Browse files
committed
Update the minimum deployment target to 11.0
1 parent ce5469a commit 62364eb

20 files changed

Lines changed: 116 additions & 294 deletions

Examples/Maps/Maps/MainViewController.swift

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,10 @@ class SearchPanelLandscapeLayout: FloatingPanelLayout {
215215
.tip: FloatingPanelLayoutAnchor(absoluteInset: 69.0, edge: .bottom, referenceGuide: .safeArea),
216216
]
217217
func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
218-
if #available(iOS 11.0, *) {
219-
return [
220-
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 8.0),
221-
surfaceView.widthAnchor.constraint(equalToConstant: 291),
222-
]
223-
} else {
224-
return [
225-
surfaceView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 8.0),
226-
surfaceView.widthAnchor.constraint(equalToConstant: 291),
227-
]
228-
}
218+
return [
219+
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 8.0),
220+
surfaceView.widthAnchor.constraint(equalToConstant: 291),
221+
]
229222
}
230223
func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
231224
return 0.0

Examples/Maps/Maps/SearchViewController.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ class SearchViewController: UIViewController, UITableViewDataSource {
8181

8282
var items: [LocationItem] = []
8383

84-
// For iOS 10 only
85-
private lazy var shadowLayer: CAShapeLayer = CAShapeLayer()
86-
8784
override func viewDidLoad() {
8885
super.viewDidLoad()
8986
tableView.dataSource = self
@@ -92,29 +89,6 @@ class SearchViewController: UIViewController, UITableViewDataSource {
9289
hideHeader(animated: false)
9390
}
9491

95-
override func viewDidLayoutSubviews() {
96-
super.viewDidLayoutSubviews()
97-
if #available(iOS 11, *) {
98-
} else {
99-
// Exmaple: Add rounding corners on iOS 10
100-
visualEffectView.layer.cornerRadius = 9.0
101-
visualEffectView.clipsToBounds = true
102-
103-
// Exmaple: Add shadow manually on iOS 10
104-
view.layer.insertSublayer(shadowLayer, at: 0)
105-
let rect = visualEffectView.frame
106-
let path = UIBezierPath(roundedRect: rect,
107-
byRoundingCorners: [.topLeft, .topRight],
108-
cornerRadii: CGSize(width: 9.0, height: 9.0))
109-
shadowLayer.frame = visualEffectView.frame
110-
shadowLayer.shadowPath = path.cgPath
111-
shadowLayer.shadowColor = UIColor.black.cgColor
112-
shadowLayer.shadowOffset = CGSize(width: 0.0, height: 1.0)
113-
shadowLayer.shadowOpacity = 0.2
114-
shadowLayer.shadowRadius = 3.0
115-
}
116-
}
117-
11892
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
11993
return items.count
12094
}

Examples/Samples/Sources/ContentViewControllers/DebugTextViewController.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ final class DebugTextViewController: UIViewController, UITextViewDelegate {
1111
textView.delegate = self
1212
print("viewDidLoad: TextView --- ", textView.contentOffset, textView.contentInset)
1313

14-
if #available(iOS 11.0, *) {
15-
textView.contentInsetAdjustmentBehavior = .never
16-
}
14+
textView.contentInsetAdjustmentBehavior = .never
1715
}
1816

1917
override func viewWillLayoutSubviews() {
@@ -32,9 +30,7 @@ final class DebugTextViewController: UIViewController, UITextViewDelegate {
3230

3331
func scrollViewDidScroll(_ scrollView: UIScrollView) {
3432
print("TextView --- ", scrollView.contentOffset, scrollView.contentInset)
35-
if #available(iOS 11.0, *) {
36-
print("TextView --- ", scrollView.adjustedContentInset)
37-
}
33+
print("TextView --- ", scrollView.adjustedContentInset)
3834
}
3935

4036
@IBAction func toggleTopMargin(_ sender: UISwitch) {

Examples/Samples/Sources/ContentViewControllers/ImageViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ final class ImageViewController: UIViewController {
3737
case withHeaderFooter
3838
}
3939

40-
@available(iOS 11.0, *)
4140
func layoutGuideFor(mode: Mode) -> UILayoutGuide {
4241
switch mode {
4342
case .onlyImage:

Examples/Samples/Sources/ContentViewControllers/SettingsViewController.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@ final class SettingsViewController: InspectableViewController {
1414

1515
override func viewDidLayoutSubviews() {
1616
super.viewDidLayoutSubviews()
17-
if #available(iOS 11.0, *) {
18-
let prefersLargeTitles = navigationController!.navigationBar.prefersLargeTitles
19-
largeTitlesSwitch.setOn(prefersLargeTitles, animated: false)
20-
} else {
21-
largeTitlesSwitch.isEnabled = false
22-
}
17+
let prefersLargeTitles = navigationController!.navigationBar.prefersLargeTitles
18+
largeTitlesSwitch.setOn(prefersLargeTitles, animated: false)
19+
2320
let isTranslucent = navigationController!.navigationBar.isTranslucent
2421
translucentSwitch.setOn(isTranslucent, animated: false)
2522
}
2623

2724
@IBAction func toggleLargeTitle(_ sender: UISwitch) {
28-
if #available(iOS 11.0, *) {
29-
navigationController?.navigationBar.prefersLargeTitles = sender.isOn
30-
}
25+
navigationController?.navigationBar.prefersLargeTitles = sender.isOn
3126
}
27+
3228
@IBAction func toggleTranslucent(_ sender: UISwitch) {
3329
// White non-translucent navigation bar, supports dark appearance
3430
if #available(iOS 15, *) {

Examples/Samples/Sources/ContentViewControllers/TabBarViewController.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,8 @@ class ThreeTabBarPanelLayout: FloatingPanelLayout {
238238
}
239239

240240
func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
241-
if #available(iOS 11.0, *) {
242-
leftConstraint = surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0)
243-
rightConstraint = surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0)
244-
} else {
245-
leftConstraint = surfaceView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0.0)
246-
rightConstraint = surfaceView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0)
247-
}
241+
leftConstraint = surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0)
242+
rightConstraint = surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0)
248243
return [ leftConstraint, rightConstraint ]
249244
}
250245
}

Examples/Samples/Sources/Extensions.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,10 @@ class CustomLayoutGuide: LayoutGuideProvider {
3333

3434
extension UIViewController {
3535
var layoutInsets: UIEdgeInsets {
36-
if #available(iOS 11.0, *) {
37-
return view.safeAreaInsets
38-
} else {
39-
return UIEdgeInsets(top: topLayoutGuide.length,
40-
left: 0.0,
41-
bottom: bottomLayoutGuide.length,
42-
right: 0.0)
43-
}
36+
return view.safeAreaInsets
4437
}
4538

4639
var layoutGuide: LayoutGuideProvider {
47-
if #available(iOS 11.0, *) {
48-
return view!.safeAreaLayoutGuide
49-
} else {
50-
return CustomLayoutGuide(topAnchor: topLayoutGuide.bottomAnchor,
51-
bottomAnchor: bottomLayoutGuide.topAnchor)
52-
}
40+
return view.safeAreaLayoutGuide
5341
}
5442
}

Examples/Samples/Sources/MainViewController.swift

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ extension MainViewController {
1515
tableView.dataSource = self
1616
tableView.delegate = self
1717
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
18-
automaticallyAdjustsScrollViewInsets = false
1918

2019
let searchController = UISearchController(searchResultsController: nil)
21-
if #available(iOS 11.0, *) {
22-
navigationItem.searchController = searchController
23-
navigationItem.hidesSearchBarWhenScrolling = false
24-
navigationItem.largeTitleDisplayMode = .automatic
25-
}
20+
navigationItem.searchController = searchController
21+
navigationItem.hidesSearchBarWhenScrolling = false
22+
navigationItem.largeTitleDisplayMode = .automatic
2623
var insets = UIEdgeInsets.zero
2724
insets.bottom += 69.0
2825
tableView.contentInset = insets
@@ -33,12 +30,10 @@ extension MainViewController {
3330

3431
override func viewDidAppear(_ animated: Bool) {
3532
super.viewDidAppear(animated)
36-
if #available(iOS 11.0, *) {
37-
if let observation = navigationController?.navigationBar.observe(\.prefersLargeTitles, changeHandler: { (bar, _) in
38-
self.tableView.reloadData()
39-
}) {
40-
observations.append(observation)
41-
}
33+
if let observation = navigationController?.navigationBar.observe(\.prefersLargeTitles, changeHandler: { (bar, _) in
34+
self.tableView.reloadData()
35+
}) {
36+
observations.append(observation)
4237
}
4338
}
4439

@@ -56,12 +51,8 @@ extension MainViewController {
5651

5752
extension MainViewController: UITableViewDataSource {
5853
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
59-
if #available(iOS 11.0, *) {
60-
if navigationController?.navigationBar.prefersLargeTitles == true {
61-
return UseCase.allCases.count + 30
62-
} else {
63-
return UseCase.allCases.count
64-
}
54+
if navigationController?.navigationBar.prefersLargeTitles == true {
55+
return UseCase.allCases.count + 30
6556
} else {
6657
return UseCase.allCases.count
6758
}

Examples/Samples/Sources/UseCases/UseCaseController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ extension UseCaseController {
323323

324324
extension UseCaseController: FloatingPanelControllerDelegate {
325325
func floatingPanel(_ vc: FloatingPanelController, contentOffsetForPinning trackingScrollView: UIScrollView) -> CGPoint {
326-
if useCase == .showNavigationController, #available(iOS 11.0, *) {
326+
if useCase == .showNavigationController {
327327
// 148.0 is the SafeArea's top value for a navigation bar with a large title.
328328
return CGPoint(x: 0.0, y: 0.0 - trackingScrollView.contentInset.top - 148.0)
329329
}

FloatingPanel.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ Pod::Spec.new do |s|
77
FloatingPanel is a clean and easy-to-use UI component for a new interface introduced in Apple Maps, Shortcuts and Stocks app.
88
The new interface displays the related contents and utilities in parallel as a user wants.
99
DESC
10-
s.homepage = "https://github.com/SCENEE/FloatingPanel"
10+
s.homepage = "https://github.com/scenee/FloatingPanel"
1111
s.author = "Shin Yamamoto"
1212
s.social_media_url = "https://twitter.com/scenee"
1313

14-
s.platform = :ios, "10.0"
15-
s.source = { :git => "https://github.com/SCENEE/FloatingPanel.git", :tag => s.version.to_s }
14+
s.platform = :ios, "11.0"
15+
s.source = { :git => "https://github.com/scenee/FloatingPanel.git", :tag => s.version.to_s }
1616
s.source_files = "Sources/*.swift"
1717
s.swift_version = '5.0'
1818

0 commit comments

Comments
 (0)