Skip to content

Commit

Permalink
Migrates to swift4 & xcode9 (4.0.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Sep 29, 2017
1 parent 5b24741 commit 1683932
Show file tree
Hide file tree
Showing 21 changed files with 386 additions and 362 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# Stevia

[![Language: Swift2 and 3](https://img.shields.io/badge/language-swift2|swift3-f48041.svg?style=flat)](https://developer.apple.com/swift)
[![Language: Swift 2, 3 and 4](https://img.shields.io/badge/language-swift2|swift3|swift4-f48041.svg?style=flat)](https://developer.apple.com/swift)
![Platform: iOS 8+](https://img.shields.io/badge/platform-iOS%20|%20tvOS-blue.svg?style=flat)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods compatible](https://img.shields.io/badge/Cocoapods-compatible-4BC51D.svg?style=flat)](https://cocoapods.org)
[![Build Status](https://www.bitrise.io/app/4478e29045c5f12e.svg?token=pti6g-HVKBUPv9mIR3baIw&branch=master)](https://www.bitrise.io/app/4478e29045c5f12e)
[![Join the chat at https://gitter.im/s4cha/Stevia](https://badges.gitter.im/s4cha/Stevia.svg)](https://gitter.im/s4cha/Stevia?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License: MIT](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/s4cha/Stevia/blob/master/LICENSE) [![Release version](https://img.shields.io/badge/release-3.2-blue.svg)]()
[![License: MIT](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/s4cha/Stevia/blob/master/LICENSE) [![Release version](https://img.shields.io/badge/release-4.0-blue.svg)]()


[Reason](#reason) - [Example](#login-view-example) - [Live Reload](#live-reload) - [Installation](#installation) - [Documentation](#documentation)
Expand Down Expand Up @@ -407,4 +407,5 @@ That's why we created Stevia.

## Swift Version
Swift 2 -> version **2.3.0**
Swift 3 -> version **3.2.0**
Swift 3 -> version **3.2.0**
Swift 4 -> version **4.0.0**
2 changes: 1 addition & 1 deletion Source/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>3.2.0</string>
<string>4.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
26 changes: 11 additions & 15 deletions Source/Stevia+Alignment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ public func alignVertically(_ v1: UIView, with v2: UIView, offset: CGFloat = 0)
}

private func align(_ axis: UILayoutConstraintAxis, views: [UIView]) {
for (i, v) in views.enumerated() {
if views.count > i+1 {
let v2 = views[i+1]
if axis == .horizontal {
alignHorizontally(v, with: v2)
} else {
alignVertically(v, with: v2)
}
for (i, v) in views.enumerated() where views.count > i+1 {
let v2 = views[i+1]
if axis == .horizontal {
alignHorizontally(v, with: v2)
} else {
alignVertically(v, with: v2)
}
}
}
Expand Down Expand Up @@ -282,13 +280,11 @@ public func alignRights(_ views: [UIView]) -> [UIView] {

@discardableResult
public func align(_ attribute: NSLayoutAttribute, views: [UIView]) -> [UIView] {
for (i, v) in views.enumerated() {
if views.count > i+1 {
let v2 = views[i+1]
if let spv = v.superview {
let c = constraint(item: v, attribute: attribute, toItem: v2)
spv.addConstraint(c)
}
for (i, v) in views.enumerated() where views.count > i+1 {
let v2 = views[i+1]
if let spv = v.superview {
let c = constraint(item: v, attribute: attribute, toItem: v2)
spv.addConstraint(c)
}
}
return views
Expand Down
2 changes: 1 addition & 1 deletion Source/Stevia+Constraints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public func constraint(item view1: AnyObject,
relatedBy: relatedBy,
toItem: view2, attribute: ((attr2 == nil) ? attr1 : attr2! ),
multiplier: multiplier, constant: constant)
c.priority = UILayoutPriorityDefaultHigh + 1
c.priority = UILayoutPriority(rawValue: UILayoutPriority.defaultHigh.rawValue + 1)
return c
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Stevia+Hierarchy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public extension UIView {
- Returns: Itself to enable nested layouts.
*/
@discardableResult
@objc @discardableResult
public func sv(_ subViews: [UIView]) -> UIView {
for sv in subViews {
addSubview(sv)
Expand Down
2 changes: 1 addition & 1 deletion Source/Stevia+Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
public extension NSObject {

public func on(_ event: String, _ callback:@escaping () -> Void) {
NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: event),
_ = NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: event),
object: nil,
queue: nil) { _ in
callback()
Expand Down
2 changes: 1 addition & 1 deletion Source/Stevia+Tap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public extension UIButton {
}

/** */
func tapped() {
@objc func tapped() {
testButtonBlock?()
}
}
42 changes: 33 additions & 9 deletions Stevia.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Sacha Durand Saint Omer";
TargetAttributes = {
9934B7881EF126D10065EA50 = {
Expand All @@ -314,11 +314,11 @@
};
9991C8541BDB6C8B007D9B75 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
99B621771BF75D0E00A54B05 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -467,6 +467,7 @@
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_CODE_COVERAGE = NO;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
Expand All @@ -482,7 +483,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
Expand All @@ -493,6 +494,7 @@
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_CODE_COVERAGE = NO;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
Expand All @@ -507,7 +509,7 @@
PRODUCT_NAME = Stevia;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
Expand All @@ -519,16 +521,23 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_CODE_COVERAGE = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -569,16 +578,23 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_CODE_COVERAGE = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -610,6 +626,7 @@
9991C85E1BDB6C8B007D9B75 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_CODE_COVERAGE = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -622,13 +639,15 @@
PRODUCT_BUNDLE_IDENTIFIER = com.freshOS.Stevia;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
9991C85F1BDB6C8B007D9B75 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_CODE_COVERAGE = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -641,31 +660,36 @@
PRODUCT_BUNDLE_IDENTIFIER = com.freshOS.Stevia;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
99B621801BF75D0E00A54B05 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_CODE_COVERAGE = NO;
INFOPLIST_FILE = SteviaTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.s4cha.webApp.SteviaTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
99B621811BF75D0E00A54B05 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_CODE_COVERAGE = NO;
INFOPLIST_FILE = SteviaTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.s4cha.webApp.SteviaTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
7 changes: 4 additions & 3 deletions Stevia.xcodeproj/xcshareddata/xcschemes/Stevia.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -56,6 +56,7 @@
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 3 additions & 1 deletion Stevia.xcodeproj/xcshareddata/xcschemes/SteviaTV.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion SteviaLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SteviaLayout'
s.version = "3.2.0"
s.version = "4.0.0"
s.summary = "Elegant view layout for iOS"
s.homepage = "https://github.com/s4cha/Stevia"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
2 changes: 1 addition & 1 deletion SteviaTV/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>3.2.0</string>
<string>4.0.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
Loading

0 comments on commit 1683932

Please sign in to comment.