Skip to content

Commit

Permalink
clean up for Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyKhan committed Jun 18, 2019
1 parent 9bf140d commit 7990ee1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
28 changes: 23 additions & 5 deletions Former.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,18 @@
2A6565521BA43E9100C78E81 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Ryo Aoyama";
TargetAttributes = {
2A65655A1BA43E9100C78E81 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 2A6565551BA43E9100C78E81 /* Build configuration list for PBXProject "Former" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -369,18 +369,27 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
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 Down Expand Up @@ -420,18 +429,27 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
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 Down Expand Up @@ -475,7 +493,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -494,7 +512,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ryo.Former;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Former.xcodeproj/xcshareddata/xcschemes/Former.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 = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Former/Commons/Former.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public final class Former: NSObject {
@discardableResult
public func select(rowFormer: RowFormer, animated: Bool, scrollPosition:UITableView.ScrollPosition = .none) -> Self {
for (section, sectionFormer) in sectionFormers.enumerated() {
if let row = sectionFormer.rowFormers.index(where: { $0 === rowFormer }) {
if let row = sectionFormer.rowFormers.firstIndex(where: { $0 === rowFormer }) {
return select(indexPath: IndexPath(row: row, section: section), animated: animated, scrollPosition: scrollPosition)
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ public final class Former: NSObject {
/// Reload sections from instance of SectionFormer.
@discardableResult
public func reload(sectionFormer: SectionFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self {
guard let section = sectionFormers.index(where: { $0 === sectionFormer }) else { return self }
guard let section = sectionFormers.firstIndex(where: { $0 === sectionFormer }) else { return self }
return reload(sections: IndexSet(integer: section), rowAnimation: rowAnimation)
}

Expand All @@ -344,7 +344,7 @@ public final class Former: NSObject {
@discardableResult
public func reload(rowFormer: RowFormer, rowAnimation: UITableView.RowAnimation = .none) -> Self {
for (section, sectionFormer) in sectionFormers.enumerated() {
if let row = sectionFormer.rowFormers.index(where: { $0 === rowFormer}) {
if let row = sectionFormer.rowFormers.firstIndex(where: { $0 === rowFormer}) {
return reload(indexPaths: [IndexPath(row: row, section: section)], rowAnimation: rowAnimation)
}
}
Expand Down
6 changes: 3 additions & 3 deletions Former/Commons/FormerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public protocol InlineForm: class {
func editingDidEnd()
}

public protocol ConfigurableInlineForm: class, InlineForm {
public protocol ConfigurableInlineForm: InlineForm {

associatedtype InlineCellType: UITableViewCell
}
Expand Down Expand Up @@ -45,7 +45,7 @@ public protocol SelectorForm: class {
func editingDidEnd()
}

public protocol UpdatableSelectorForm: class, SelectorForm {
public protocol UpdatableSelectorForm: SelectorForm {

associatedtype SelectorViewType: UIView
var selectorView: SelectorViewType { get }
Expand All @@ -62,7 +62,7 @@ extension UpdatableSelectorForm where Self: RowFormer {

// MARK: RowFormer

public protocol Formable: class, SelectableForm, UpdatableForm, ConfigurableForm {}
public protocol Formable: SelectableForm, UpdatableForm, ConfigurableForm {}

public protocol SelectableForm: class {}

Expand Down
4 changes: 2 additions & 2 deletions Former/ViewFormers/LabelViewFormer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class LabelViewFormer<T: UITableViewHeaderFooterView>: BaseViewForm

// MARK: Public

open var text: String?
public var text: String?

required public init(instantiateType: Former.InstantiateType = .Class, viewSetup: ((T) -> Void)? = nil) {
super.init(instantiateType: instantiateType, viewSetup: viewSetup)
Expand All @@ -28,7 +28,7 @@ public final class LabelViewFormer<T: UITableViewHeaderFooterView>: BaseViewForm
viewHeight = 30
}

open override func update() {
public override func update() {
super.update()
view.formTitleLabel().text = text
}
Expand Down

0 comments on commit 7990ee1

Please sign in to comment.