diff --git a/Former.xcodeproj/project.pbxproj b/Former.xcodeproj/project.pbxproj index d00ad5d..cb567f7 100644 --- a/Former.xcodeproj/project.pbxproj +++ b/Former.xcodeproj/project.pbxproj @@ -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, @@ -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; @@ -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; @@ -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; }; @@ -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; }; diff --git a/Former.xcodeproj/xcshareddata/xcschemes/Former.xcscheme b/Former.xcodeproj/xcshareddata/xcschemes/Former.xcscheme index 8f91c2a..2188023 100644 --- a/Former.xcodeproj/xcshareddata/xcschemes/Former.xcscheme +++ b/Former.xcodeproj/xcshareddata/xcschemes/Former.xcscheme @@ -1,6 +1,6 @@ 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) } } @@ -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) } @@ -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) } } diff --git a/Former/Commons/FormerProtocol.swift b/Former/Commons/FormerProtocol.swift index fe27547..0ab0370 100644 --- a/Former/Commons/FormerProtocol.swift +++ b/Former/Commons/FormerProtocol.swift @@ -17,7 +17,7 @@ public protocol InlineForm: class { func editingDidEnd() } -public protocol ConfigurableInlineForm: class, InlineForm { +public protocol ConfigurableInlineForm: InlineForm { associatedtype InlineCellType: UITableViewCell } @@ -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 } @@ -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 {} diff --git a/Former/ViewFormers/LabelViewFormer.swift b/Former/ViewFormers/LabelViewFormer.swift index 8f8f69d..bd540cb 100644 --- a/Former/ViewFormers/LabelViewFormer.swift +++ b/Former/ViewFormers/LabelViewFormer.swift @@ -17,7 +17,7 @@ public final class LabelViewFormer: 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) @@ -28,7 +28,7 @@ public final class LabelViewFormer: BaseViewForm viewHeight = 30 } - open override func update() { + public override func update() { super.update() view.formTitleLabel().text = text }