Skip to content

Commit

Permalink
Swift 4.2 and Xcode 10 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Zhang committed Sep 17, 2018
1 parent f70e304 commit 4f170c2
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 19 deletions.
5 changes: 3 additions & 2 deletions Example/JZCalendarWeekViewExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
TargetAttributes = {
8E5BB3CD2072F4A000FA853F = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -523,7 +524,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.zjfjack.JZCalendarWeekViewExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -540,7 +541,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.zjfjack.JZCalendarWeekViewExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Example/JZCalendarWeekViewExample/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ extension ExampleOptionsViewController: UITableViewDelegate, UITableViewDataSour
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return viewModel.optionsData[indexPath.section].isExpanded ? UITableViewAutomaticDimension : 0
return viewModel.optionsData[indexPath.section].isExpanded ? UITableView.automaticDimension : 0
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
Expand Down
4 changes: 2 additions & 2 deletions Example/JZCalendarWeekViewExample/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>CFBundleVersion</key>
<string>18091401</string>
<string>18091701</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion JZCalendarWeekView.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "JZCalendarWeekView"
s.version = "0.5.1"
s.version = "0.5.2"
s.summary = "Calendar Week & Day View in iOS Swift"
s.homepage = "https://github.com/zjfjack/JZCalendarWeekView"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
6 changes: 3 additions & 3 deletions JZCalendarWeekView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
};
8E1BA949206B4329007BE13C = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 0920;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -491,7 +491,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -514,7 +514,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.zjfjack.JZCalendarWeekView;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion JZCalendarWeekView/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1</string>
<string>0.5.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
5 changes: 2 additions & 3 deletions JZCalendarWeekView/JZWeekViewHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ open class JZWeekViewHelper {
return resultEvents
}

// Will modify this if more notch screens coming in the future
private static let isiPhoneX = (UIScreen.main.nativeBounds.height / UIScreen.main.nativeScale) == 812 && UIDevice.current.userInterfaceIdiom == .phone
private static let hasNotch = UINavigationController().navigationBar.frame.height > 20

/// Handle the viewWillTransition in UIViewController, only need call this function in ViewController owning JZWeekView.
///
Expand All @@ -113,7 +112,7 @@ open class JZWeekViewHelper {
/// - size: viewWillTransition to size
/// - weekView: the JZWeekView
open class func viewTransitionHandler(to size: CGSize, weekView: JZBaseWeekView) {
if isiPhoneX {
if hasNotch {
let flowLayout = weekView.flowLayout!
// Not differentiate the left and right because of willTransition cannot get the following UIDeviceOrientation
let isLandscape = size.width > size.height
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/zjfjack/JZCalendarWeekView.svg?branch=master)](https://travis-ci.org/zjfjack/JZCalendarWeekView)
[![CocoaPods](https://img.shields.io/cocoapods/v/JZCalendarWeekView.svg)](https://cocoapods.org/pods/JZCalendarWeekView)
[![Platform](https://img.shields.io/cocoapods/p/JZCalendarWeekView.svg?style=flat)](https://github.com/zjfjack/JZCalendarWeekView)
[![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Swift 4.2](https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![license MIT](https://img.shields.io/cocoapods/l/JZCalendarWeekView.svg)](http://opensource.org/licenses/MIT)

iOS Calendar Week/Day View in Swift
Expand Down Expand Up @@ -146,21 +146,24 @@ For futher usage, you can also check the example project, some comments in code
## Requirements

- iOS 9.0+
- Xcode 9.3+
- Swift 4.1+
- Xcode 10+
- Swift 4.2

## Installation

### Cocoapods
JZCalendarWeekView can be added to your project by adding the following line to your `Podfile`:

```ruby
pod 'JZCalendarWeekView', '~> 0.5'
# Latest release in CocoaPods
pod 'JZCalendarWeekView'

# If you have NOT upgraded to Swift 4.2, use the last non-swift 4.2 compatible release
pod 'JZCalendarWeekView', '0.5.1'
```

## Todo

- [ ] iOS 12, XCode and Swift 4.2 Support
- [ ] Limited date range: First Date and Last Date in CalendarView
- [ ] DecorationView for different background views (refer to #12)
- [ ] Theme implementation
Expand Down

0 comments on commit 4f170c2

Please sign in to comment.