Skip to content

Commit

Permalink
compatible with swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
MohannadBakbouk committed Jan 5, 2021
1 parent ee70799 commit f1b54ba
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

28 changes: 28 additions & 0 deletions Sources/Extentions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Extentions.swift
// WWCalendarTimeSelector
//
// Created by Mohannad on 12/31/20.
// Copyright © 2020 Wonder. All rights reserved.
//

import Foundation
import UIKit



extension UIApplication {

var orientation: UIInterfaceOrientation? {

if #available(iOS 13.0, *) {
return UIApplication.shared.windows
.first?.windowScene?
.interfaceOrientation

}
else {
return UIApplication.shared.statusBarOrientation
}
}
}
7 changes: 4 additions & 3 deletions Sources/WWCalendarTimeSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,10 @@ open class WWCalendarTimeSelector: UIViewController, UITableViewDelegate, UITabl
fileprivate var flashDate: Date?
fileprivate let defaultTopPanelTitleForMultipleDates = "Select Multiple Dates"
fileprivate var viewBoundsHeight: CGFloat {
return view.bounds.height - topLayoutGuide.length - bottomLayoutGuide.length
return view.safeAreaLayoutGuide.layoutFrame.height
}
fileprivate var viewBoundsWidth: CGFloat {
return view.bounds.width
return view.safeAreaLayoutGuide.layoutFrame.width
}
fileprivate var portraitHeight: CGFloat {
return max(viewBoundsHeight, viewBoundsWidth)
Expand Down Expand Up @@ -900,7 +900,8 @@ open class WWCalendarTimeSelector: UIViewController, UITableViewDelegate, UITabl
}

@objc internal func didRotateOrNot(animated: Bool = true) {
let orientation = UIApplication.shared.statusBarOrientation

let orientation = UIApplication.shared.orientation
if orientation == .landscapeLeft || orientation == .landscapeRight || orientation == .portrait || orientation == .portraitUpsideDown {
let isPortrait = orientation == .portrait || orientation == .portraitUpsideDown
let size = CGSize(width: viewBoundsWidth, height: viewBoundsHeight)
Expand Down
4 changes: 3 additions & 1 deletion WWCalendarTimeSelector.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ Pod::Spec.new do |s|

s.ios.deployment_target = "14.0"


s.source = { :git => "https://github.com/weilsonwonder/WWCalendarTimeSelector.git", :tag => s.version }
s.source_files = "Classes", "Sources/*.swift"
s.resource_bundles = {
'WWCalendarTimeSelectorStoryboardBundle' => ['Sources/*.storyboard']
}

s.swift_version = '5.3'
s.swift_versions = "5.3"

end
4 changes: 4 additions & 0 deletions WWCalendarTimeSelectorDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
00FBEF831CC8849D0046C872 /* String+Timepiece.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00FBEF7B1CC8849D0046C872 /* String+Timepiece.swift */; };
00FBEF841CC8849D0046C872 /* WWCalendarTimeSelector.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 00FBEF7C1CC8849D0046C872 /* WWCalendarTimeSelector.storyboard */; };
00FBEF851CC8849D0046C872 /* WWCalendarTimeSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00FBEF7D1CC8849D0046C872 /* WWCalendarTimeSelector.swift */; };
0321B3C3259E9971002D5328 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0321B3C2259E9971002D5328 /* Extentions.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -38,6 +39,7 @@
00FBEF7B1CC8849D0046C872 /* String+Timepiece.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Timepiece.swift"; sourceTree = "<group>"; };
00FBEF7C1CC8849D0046C872 /* WWCalendarTimeSelector.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = WWCalendarTimeSelector.storyboard; sourceTree = "<group>"; };
00FBEF7D1CC8849D0046C872 /* WWCalendarTimeSelector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WWCalendarTimeSelector.swift; sourceTree = "<group>"; };
0321B3C2259E9971002D5328 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -100,6 +102,7 @@
00FBEF791CC8849D0046C872 /* NSDate+Timepiece.swift */,
00FBEF7A1CC8849D0046C872 /* NSDateComponents+Timepiece.swift */,
00FBEF7B1CC8849D0046C872 /* String+Timepiece.swift */,
0321B3C2259E9971002D5328 /* Extentions.swift */,
);
name = Helper;
sourceTree = "<group>";
Expand Down Expand Up @@ -180,6 +183,7 @@
files = (
00FBEF851CC8849D0046C872 /* WWCalendarTimeSelector.swift in Sources */,
00FBEF831CC8849D0046C872 /* String+Timepiece.swift in Sources */,
0321B3C3259E9971002D5328 /* Extentions.swift in Sources */,
00FBEF821CC8849D0046C872 /* NSDateComponents+Timepiece.swift in Sources */,
00FBEF7E1CC8849D0046C872 /* Duration.swift in Sources */,
00FBEF7F1CC8849D0046C872 /* Int+Timepiece.swift in Sources */,
Expand Down
Binary file added WWCalendarTimeSelectorDemo/.DS_Store
Binary file not shown.
Binary file not shown.

0 comments on commit f1b54ba

Please sign in to comment.