Skip to content

Commit

Permalink
update to swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fdzsergio committed Sep 29, 2018
1 parent f9cadde commit c057e7c
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.2
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: objective-c
os: osx
osx_image: xcode8.3
osx_image: xcode10

script:
- set -o pipefail
- xcodebuild clean test -workspace SFFocusViewLayout.xcworkspace -scheme SFFocusViewLayout -destination "platform=iOS Simulator,name=iPhone 7" -enableCodeCoverage YES | xcpretty
- xcodebuild -workspace SFFocusViewLayout.xcworkspace -scheme SFFocusViewLayout -configuration Test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7' -enableCodeCoverage YES clean build-for-testing test-without-building | xcpretty
- pod lib lint --quick

after_success:
Expand Down
19 changes: 10 additions & 9 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# CHANGELOG

## 3.2.0
- Swift 4.2 version.

## 3.1.0
Swift 3.0 version.
- Swift 3.0 version.

## 3.0.0
Swift 2.1 version.
- Swift 2.1 version.

## 2.0.0
Carthage support.
Swift compatible.
- Carthage support.
- Swift compatible.

## 1.1.0
Added Xcode 6.4 support.
- Added Xcode 6.4 support.

## 1.0.1

Change pod structure.
- Change pod structure.

## 1.0.0

Initial release.
- Initial release.
13 changes: 13 additions & 0 deletions Configuration/Common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ CLANG_ENABLE_MODULES = YES
// Enable ARC
CLANG_ENABLE_OBJC_ARC = YES

CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES

// Warn about implicit conversions to boolean values that are suspicious.
// For example, writing 'if (foo)' with 'foo' being the name a function will trigger a warning.
CLANG_WARN_BOOL_CONVERSION = YES

CLANG_WARN_COMMA = YES

// Warn about implicit conversions of constant values that cause the constant value to change,
// either through a loss of precision, or entirely in its meaning.
CLANG_WARN_CONSTANT_CONVERSION = YES

CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES

// Whether to warn when overriding deprecated methods
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES

Expand All @@ -58,9 +64,16 @@ CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO
// For example, this can catch issues when one incorrectly intermixes using NSNumbers and raw integers.
CLANG_WARN_INT_CONVERSION = YES

CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES

// Warn about implicit capture of self (e.g. direct ivar access)
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES

CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
CLANG_WARN_STRICT_PROTOTYPES = YES

// Don't warn about repeatedly using a weak reference without assigning the weak reference to a strong reference. Too many false positives.
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = NO

Expand Down
4 changes: 4 additions & 0 deletions Configuration/Environments/Debug.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG
// final installation location
STRIP_INSTALLED_PRODUCT = NO

SWIFT_COMPILATION_MODE = singlefile

// The optimization level (-Onone, -O, -Ofast) for the produced Swift binary
SWIFT_OPTIMIZATION_LEVEL = -Onone

Expand All @@ -52,3 +54,5 @@ OTHER_CODE_SIGN_FLAGS = --timestamp=none

// Allow @testable imports
ENABLE_TESTABILITY = YES

DEBUG_INFORMATION_FORMAT = dwarf
10 changes: 9 additions & 1 deletion Configuration/Framework.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ SKIP_INSTALL = YES
APPLICATION_EXTENSION_API_ONLY = NO

// Configuration swift version
SWIFT_VERSION = 3.0
SWIFT_VERSION = 4.2

SWIFT_COMPILATION_MODE = wholemodule

// Always embed Swift std libs
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES

SDKROOT = iphoneos

// Universal framework
SUPPORTED_PLATFORMS = iphonesimulator iphoneos appletvos appletvsimulator
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
Expand Down Expand Up @@ -70,3 +74,7 @@ ENABLE_BITCODE[sdk=appletv*] = YES

// iOS-specific deployment target
IPHONEOS_DEPLOYMENT_TARGET = 8.0

// Product Configuration
PRODUCT_BUNDLE_IDENTIFIER = com.fdzsergio.SFFocusViewLayout
PRODUCT_NAME = SFFocusViewLayout
22 changes: 19 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = fdzsergio;
TargetAttributes = {
E766BCA81C5BEFE20036C384 = {
Expand Down Expand Up @@ -329,14 +329,22 @@
CLANG_CXX_LIBRARY = "libc++";
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_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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 All @@ -363,7 +371,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0.1;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -376,14 +384,22 @@
CLANG_CXX_LIBRARY = "libc++";
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_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = 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 All @@ -403,7 +419,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0.1;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down
26 changes: 2 additions & 24 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,13 @@ final 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 {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()

return true
}

func applicationWillResignActive(_ application: UIApplication) {

}

func applicationDidEnterBackground(_ application: UIApplication) {

}

func applicationWillEnterForeground(_ application: UIApplication) {

}

func applicationDidBecomeActive(_ application: UIApplication) {

}

func applicationWillTerminate(_ application: UIApplication) {

}


}
2 changes: 1 addition & 1 deletion Example/Example/CollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ private extension CollectionViewCell {
}
}

extension CollectionViewCell : NibLoadableView { }
extension CollectionViewCell: NibLoadableView {}
6 changes: 3 additions & 3 deletions Example/Example/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Repository: DataSource {
}

private extension Repository {

static var resources: [Resource] {
guard
let fileURL = Bundle.main
Expand All @@ -23,8 +23,8 @@ private extension Repository {
else {
fatalError("resource file not found")
}
return resources.flatMap(Parser.map)

return resources.compactMap(Parser.map)
}

private struct Constant {
Expand Down
6 changes: 3 additions & 3 deletions Example/Example/ReusableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ extension UICollectionViewCell: ReusableView { }

extension UICollectionView {

func register<T: UICollectionViewCell>(_: T.Type) where T: ReusableView {
func register<T: UICollectionViewCell>(_: T.Type) {
self.register(T.self, forCellWithReuseIdentifier: T.defaultReuseIdentifier)
}

func register<T: UICollectionViewCell>(_: T.Type) where T: ReusableView, T: NibLoadableView {
func register<T: UICollectionViewCell>(_: T.Type) where T: NibLoadableView {
let bundle = Bundle(for: T.self)
let nib = UINib(nibName: T.nibName, bundle: bundle)

self.register(nib, forCellWithReuseIdentifier: T.defaultReuseIdentifier)
}

func dequeueReusableCell<T: UICollectionViewCell>(forIndexPath indexPath: IndexPath) -> T where T: ReusableView {
func dequeueReusableCell<T: UICollectionViewCell>(forIndexPath indexPath: IndexPath) -> T {
let reuseIdentifier = T.defaultReuseIdentifier
guard
let cell = self.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as? T
Expand Down
12 changes: 7 additions & 5 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ final class ViewController: UIViewController {

collectionView.register(CollectionViewCell.self)

collectionView.decelerationRate = UIScrollViewDecelerationRateFast
collectionView.decelerationRate = .fast
collectionView.backgroundColor = UIColor(red: 51/255, green: 55/255, blue: 61/255, alpha: 1)
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}

override var preferredStatusBarStyle : UIStatusBarStyle {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
Expand All @@ -43,12 +43,14 @@ extension ViewController: UICollectionViewDataSource {
return repository.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
func collectionView(_ collectionView: UICollectionView,
cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCell(forIndexPath: indexPath) as CollectionViewCell
}

func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {

func collectionView(_ collectionView: UICollectionView,
willDisplay cell: UICollectionViewCell,
forItemAt indexPath: IndexPath) {
guard
let cell = cell as? CollectionViewCellInterface
else {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Travis CI](https://travis-ci.org/fdzsergio/SFFocusViewLayout.svg?branch=master)](https://travis-ci.org/fdzsergio/SFFocusViewLayout)
[![codecov.io](https://codecov.io/github/fdzsergio/SFFocusViewLayout/coverage.svg?branch=master)](https://codecov.io/github/fdzsergio/SFFocusViewLayout?branch=master)
[![Swift Version](https://img.shields.io/badge/Swift-3.1.x-orange.svg)]()
[![Swift Version](https://img.shields.io/badge/Swift-4.2.x-orange.svg)]()
[![Version](https://img.shields.io/cocoapods/v/SFFocusViewLayout.svg?style=flat)](http://cocoapods.org/pods/SFFocusViewLayout)
[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
Expand Down
22 changes: 12 additions & 10 deletions SFFocusViewLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
Pod::Spec.new do |s|
s.name = "SFFocusViewLayout"
s.version = "3.1.0"
s.summary = "UICollectionViewLayout subclass with focused content."
s.name = 'SFFocusViewLayout'
s.version = '3.2.0'
s.summary = 'UICollectionViewLayout subclass with focused content.'

s.description = <<-DESC
SFFocusViewLayout is a UICollectionViewLayout subclass
for displaying focused content on UICollectionView which
is the largest cell of all.
DESC

s.homepage = "https://github.com/fdzsergio/SFFocusViewLayout"
s.screenshots = "https://raw.githubusercontent.com/fdzsergio/SFFocusViewLayout/master/Screenshots/SFFocusViewLayout.gif"
s.homepage = 'https://github.com/fdzsergio/SFFocusViewLayout'
s.screenshots = 'https://raw.githubusercontent.com/fdzsergio/SFFocusViewLayout/master/Screenshots/SFFocusViewLayout.gif'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Sergio Fernández" => "fdz.sergio@gmail.com" }
s.source = { :git => "https://github.com/fdzsergio/SFFocusViewLayout.git", :tag => s.version.to_s }
s.author = { 'Sergio Fernández' => 'fdz.sergio@gmail.com' }
s.source = { :git => 'https://github.com/fdzsergio/SFFocusViewLayout.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/fdzsergio'

s.platform = :ios, '8.0'
s.requires_arc = true
s.ios.deployment_target = '8.0'

s.source_files = 'Source/*.swift'
s.frameworks = 'UIKit'
s.requires_arc = true

s.swift_version = '4.2'
s.source_files = 'Source/*.swift'

s.ios.deployment_target = '8.0'
end
Loading

0 comments on commit c057e7c

Please sign in to comment.