Skip to content

Commit

Permalink
Swift 5 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrommcarrasco committed Mar 28, 2019
1 parent 9d12742 commit f67d3fb
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Sucrose.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.swift_version = "4.2"
s.swift_version = "5.0"
s.name = "Sucrose"
s.version = "2.3.1"
s.version = "3.0.0"
s.summary = "🍬 Everyday sugar"
s.description = "Collection of handy methods & objects"

Expand Down
7 changes: 2 additions & 5 deletions Sucrose.xcodeproj/project.pbxproj
Expand Up @@ -255,7 +255,6 @@
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 20D4D22C21E67CEF00A3F80A;
productRefGroup = 20D4D23721E67CEF00A3F80A /* Products */;
Expand Down Expand Up @@ -393,6 +392,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -450,6 +450,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -478,7 +479,6 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -504,7 +504,6 @@
PRODUCT_BUNDLE_IDENTIFIER = pedrommcarrasco.Sucrose;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -525,7 +524,6 @@
PRODUCT_BUNDLE_IDENTIFIER = pedrommcarrasco.SucroseTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -545,7 +543,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = pedrommcarrasco.SucroseTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions Sucrose/Extensions/Collection+SafeIndex.swift
Expand Up @@ -8,9 +8,9 @@

import Foundation

extension Collection {
public extension Collection {

public subscript(safe index: Index) -> Element? {
subscript(safe index: Index) -> Element? {
return indices.contains(index) ? self[index] : nil
}
}
4 changes: 2 additions & 2 deletions Sucrose/Extensions/NSObject+Create.swift
Expand Up @@ -8,9 +8,9 @@

import Foundation

extension NSObject {
public extension NSObject {

public static func create<T>(_ setup: (T) -> Void) -> T where T: NSObject {
static func create<T>(_ setup: (T) -> Void) -> T where T: NSObject {
let object = T()
setup(object)
return object
Expand Down
2 changes: 1 addition & 1 deletion Sucrose/Extensions/Optional+String.swift
Expand Up @@ -12,7 +12,7 @@ public protocol OptionalString {}
extension String: OptionalString {}
public extension Optional where Wrapped: OptionalString {

public var isNilOrEmpty: Bool {
var isNilOrEmpty: Bool {
return ((self as? String) ?? "").isEmpty
}
}
4 changes: 2 additions & 2 deletions Sucrose/Extensions/String+Localizable.swift
Expand Up @@ -8,7 +8,7 @@

import Foundation

extension String {
public extension String {

public var localized: String { return NSLocalizedString(self, comment: "") }
var localized: String { return NSLocalizedString(self, comment: "") }
}
4 changes: 2 additions & 2 deletions Sucrose/Extensions/UIButton+Init.swift
Expand Up @@ -8,9 +8,9 @@

import UIKit

extension UIButton {
public extension UIButton {

public convenience init(image: UIImage?) {
convenience init(image: UIImage?) {
self.init(frame: .zero)
setImage(image, for: .normal)
}
Expand Down
6 changes: 3 additions & 3 deletions Sucrose/Extensions/UIStackView+Hierarchy.swift
Expand Up @@ -8,13 +8,13 @@

import UIKit

extension UIStackView {
public extension UIStackView {

public func addArrangedSubviews(_ views: UIView ...) {
func addArrangedSubviews(_ views: UIView ...) {
views.forEach { self.addArrangedSubview($0) }
}

public func addArrangedSubviews(_ views: [UIView]) {
func addArrangedSubviews(_ views: [UIView]) {
views.forEach { self.addArrangedSubview($0) }
}
}
6 changes: 3 additions & 3 deletions Sucrose/Extensions/UIView+Hierarchy.swift
Expand Up @@ -8,13 +8,13 @@

import UIKit

extension UIView {
public extension UIView {

public func addSubviews(_ views: UIView ...) {
func addSubviews(_ views: UIView ...) {
views.forEach { self.addSubview($0) }
}

public func addSubviews(_ views: [UIView]) {
func addSubviews(_ views: [UIView]) {
views.forEach { self.addSubview($0) }
}
}
4 changes: 2 additions & 2 deletions Sucrose/Extensions/UIView+Optimize.swift
Expand Up @@ -8,9 +8,9 @@

import UIKit

extension UIView {
public extension UIView {

public func optimize() {
func optimize() {
clipsToBounds = true
isOpaque = true
}
Expand Down
8 changes: 4 additions & 4 deletions Sucrose/Extensions/UIViewController+Hierarchy.swift
Expand Up @@ -8,25 +8,25 @@

import UIKit

extension UIViewController {
public extension UIViewController {

public func addChilds(_ viewControllers: UIViewController ...) {
func addChilds(_ viewControllers: UIViewController ...) {
viewControllers.forEach {
self.addChild($0)
view.addSubview($0.view)
$0.didMove(toParent: self)
}
}

public func addChilds(_ viewControllers: [UIViewController]) {
func addChilds(_ viewControllers: [UIViewController]) {
viewControllers.forEach {
self.addChild($0)
view.addSubview($0.view)
$0.didMove(toParent: self)
}
}

public func remove() {
func remove() {
willMove(toParent: nil)
removeFromParent()
view.removeFromSuperview()
Expand Down

0 comments on commit f67d3fb

Please sign in to comment.