From 7b6dd69140ea4def8145713ce537dda60b9a3a2f Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 21 Sep 2016 21:26:43 -0700 Subject: [PATCH 1/6] convert to Swift 3 --- Cartfile.resolved | 4 +- Graphs.xcodeproj/project.pbxproj | 28 +++++- .../xcshareddata/xcschemes/Graphs.xcscheme | 2 +- Graphs/BarGraphView.swift | 44 +++++---- Graphs/Graph.swift | 96 +++++++++---------- Graphs/GraphView.swift | 28 +++--- Graphs/GraphsExtensions.swift | 88 ++++++++--------- Graphs/LineGraphView.swift | 58 +++++------ Graphs/MultiBarGraphView.swift | 12 ++- Graphs/PieGraphView.swift | 58 ++++++----- .../GraphsExample.xcodeproj/project.pbxproj | 21 +++- GraphsExample/GraphsExample/AppDelegate.swift | 14 ++- .../GraphsExample/MainViewController.swift | 58 ++++++----- GraphsExample/Podfile.lock | 6 +- 14 files changed, 286 insertions(+), 231 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index e629cf5..5836577 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "Quick/Nimble" "v4.0.1" -github "Quick/Quick" "v0.9.2" +github "Quick/Nimble" "v5.0.0" +github "Quick/Quick" "v0.9.3" diff --git a/Graphs.xcodeproj/project.pbxproj b/Graphs.xcodeproj/project.pbxproj index 38c7245..274b053 100644 --- a/Graphs.xcodeproj/project.pbxproj +++ b/Graphs.xcodeproj/project.pbxproj @@ -194,14 +194,20 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Recruit Holdings Co., Ltd."; TargetAttributes = { E92069811CFC20840025DBC8 = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = RT4NRJPHW3; + LastSwiftMigration = 0800; + ProvisioningStyle = Manual; }; E920698B1CFC20840025DBC8 = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = RT4NRJPHW3; + LastSwiftMigration = 0800; + ProvisioningStyle = Manual; }; }; }; @@ -288,8 +294,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -337,8 +345,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -358,6 +368,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -369,18 +380,21 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = RT4NRJPHW3; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Graphs/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.Graphs; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -388,23 +402,27 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_MODULES = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = RT4NRJPHW3; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Graphs/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.Graphs; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; }; name = Release; }; E920699A1CFC20840025DBC8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = RT4NRJPHW3; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -413,12 +431,15 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; E920699B1CFC20840025DBC8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + DEVELOPMENT_TEAM = RT4NRJPHW3; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -427,6 +448,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme b/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme index b4d2bb9..c976214 100644 --- a/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme +++ b/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme @@ -1,6 +1,6 @@ GraphColorType { - return .Mat(self) + return .mat(self) } } @@ -40,13 +40,13 @@ public struct BarGraphViewConfig { textVisible: Bool? = nil, contentInsets: UIEdgeInsets? = nil ) { - self.barColor = (barColor ?? DefaultColorType.Bar.color()).matColor() - self.textColor = textColor ?? DefaultColorType.BarText.color() - self.textFont = textFont ?? UIFont.systemFontOfSize(10.0) + self.barColor = (barColor ?? DefaultColorType.bar.color()).matColor() + self.textColor = textColor ?? DefaultColorType.barText.color() + self.textFont = textFont ?? UIFont.systemFont(ofSize: 10.0) self.barWidthScale = barWidthScale ?? 0.8 self.zeroLineVisible = zeroLineVisible ?? true self.textVisible = textVisible ?? true - self.contentInsets = contentInsets ?? UIEdgeInsetsZero + self.contentInsets = contentInsets ?? UIEdgeInsets.zero } } @@ -56,24 +56,28 @@ internal class BarGraphView: UIView { internal var graph: BarGraph? - private var config = BarGraphViewConfig() + fileprivate var config = BarGraphViewConfig() init(frame: CGRect, graph: BarGraph?) { self.graph = graph super.init(frame: frame) - self.backgroundColor = UIColor.clearColor() + self.backgroundColor = UIColor.clear self.setNeedsDisplay() } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - func setBarGraphViewConfig(config: BarGraphViewConfig?) { + func setBarGraphViewConfig(_ config: BarGraphViewConfig?) { self.config = config ?? BarGraphViewConfig() self.setNeedsDisplay() } - private func graphFrame() -> CGRect { + fileprivate func graphFrame() -> CGRect { return CGRect( x: self.config.contentInsets.left, y: self.config.contentInsets.top, @@ -82,8 +86,8 @@ internal class BarGraphView: UIView { ) } - override func drawRect(rect: CGRect) { - super.drawRect(rect) + override func draw(_ rect: CGRect) { + super.draw(rect) guard let graph = self.graph else { return } @@ -97,11 +101,11 @@ internal class BarGraphView: UIView { let zero = rect.size.height / CGFloat((max - min).floatValue()) * CGFloat(min.floatValue()) - graph.units.enumerate().forEach({ (index, u) in + graph.units.enumerated().forEach({ (index, u) in switch self.config.barColor { - case let .Mat(color): color.setFill() - case .Gradation(_, _): break + case let .mat(color): color.setFill() + case .gradation(_, _): break } let height = { () -> CGFloat in @@ -129,14 +133,14 @@ internal class BarGraphView: UIView { ) path.fill() - if let str = self.graph?.graphTextDisplay()(unit: u, totalValue: total) { + if let str = self.graph?.graphTextDisplay()(u, total) { let attrStr = NSAttributedString.graphAttributedString(str, color: self.config.textColor, font: self.config.textFont) let size = attrStr.size() - attrStr.drawInRect( - CGRect( + attrStr.draw( + in: CGRect( origin: CGPoint( x: sectionWidth * CGFloat(index) + rect.origin.x, y: u.value >= U(0) @@ -152,4 +156,4 @@ internal class BarGraphView: UIView { } }) } -} \ No newline at end of file +} diff --git a/Graphs/Graph.swift b/Graphs/Graph.swift index a43cee0..54b45a2 100644 --- a/Graphs/Graph.swift +++ b/Graphs/Graph.swift @@ -10,34 +10,34 @@ import UIKit public enum GraphType { case - Bar, - Line, - Pie + bar, + line, + pie } -public class Graph { +open class Graph { - public typealias GraphTextDisplayHandler = (unit: GraphUnit, totalValue: U) -> String? + public typealias GraphTextDisplayHandler = (_ unit: GraphUnit, _ totalValue: U) -> String? let kind: GraphKind init(barGraph: BarGraph) { - self.kind = GraphKind.Bar(barGraph) + self.kind = GraphKind.bar(barGraph) } init(lineGraph: LineGraph) { - self.kind = GraphKind.Line(lineGraph) + self.kind = GraphKind.line(lineGraph) } init(pieGraph: PieGraph) { - self.kind = GraphKind.Pie(pieGraph) + self.kind = GraphKind.pie(pieGraph) } } public extension Graph { - public convenience init(type: GraphType, data: [S], min minOrNil: U? = nil, max maxOrNil: U? = nil, textDisplayHandler: GraphTextDisplayHandler? = nil) { + public convenience init(type: GraphType, data: [S], min minOrNil: U? = nil, max maxOrNil: U? = nil, textDisplayHandler: GraphTextDisplayHandler? = nil) where S.GraphDataKey == T, S.GraphDataValue == U { let range = {() -> GraphRange? in if let min = minOrNil, let max = maxOrNil { @@ -49,11 +49,11 @@ public extension Graph { self.init(type: type, data: data, range: range(), textDisplayHandler: textDisplayHandler) } - public convenience init(type: GraphType, data: [S], range rangeOrNil: GraphRange? = nil, textDisplayHandler: GraphTextDisplayHandler? = nil) { + public convenience init(type: GraphType, data: [S], range rangeOrNil: GraphRange? = nil, textDisplayHandler: GraphTextDisplayHandler? = nil) where S.GraphDataKey == T, S.GraphDataValue == U { let r = {() -> GraphRange in if let r = rangeOrNil { return r } - let sorted = data.sort{ $0.value < $1.value } + let sorted = data.sorted{ $0.value < $1.value } return GraphRange( min: sorted.first?.value ?? U(0), max: sorted.last?.value ?? U(0) @@ -61,7 +61,7 @@ public extension Graph { } switch type { - case .Bar: + case .bar: self.init(barGraph:BarGraph( units: data.map{ GraphUnit(key: $0.key, value: $0.value) }, @@ -69,7 +69,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Line: + case .line: self.init(lineGraph: LineGraph( units: data.map{ GraphUnit(key: $0.key, value: $0.value) }, @@ -77,7 +77,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Pie: + case .pie: self.init(pieGraph: PieGraph( units: data.map{ GraphUnit(key: $0.key, value: $0.value) }, @@ -103,7 +103,7 @@ public extension Graph { let r = {() -> GraphRange in if let r = rangeOrNil { return r } - let sorted = array.sort{ $0 < $1 } + let sorted = array.sorted{ $0 < $1 } return GraphRange( min: sorted.first ?? U(0), max: sorted.last ?? U(0) @@ -111,7 +111,7 @@ public extension Graph { } switch type { - case .Bar: + case .bar: self.init(barGraph:BarGraph( units: array.map{ GraphUnit(key: nil, value: $0) }, @@ -119,7 +119,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Line: + case .line: self.init(lineGraph: LineGraph( units: array.map{ GraphUnit(key: nil, value: $0) }, @@ -127,7 +127,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Pie: + case .pie: self.init(pieGraph: PieGraph( units: array.map{ GraphUnit(key: nil, value: $0) }, @@ -153,7 +153,7 @@ public extension Graph { public convenience init(type: GraphType, dictionary: [T: U], range rangeOrNil: GraphRange? = nil, textDisplayHandler: GraphTextDisplayHandler? = nil) { - let sorted = dictionary.sort{ $0.1 < $1.1 } + let sorted = dictionary.sorted{ $0.1 < $1.1 } let r = {() -> GraphRange in if let r = rangeOrNil { return r } @@ -165,7 +165,7 @@ public extension Graph { } switch type { - case .Bar: + case .bar: self.init(barGraph:BarGraph( units: sorted.map{ GraphUnit(key: $0.0, value: $0.1) }, @@ -173,7 +173,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Line: + case .line: self.init(lineGraph: LineGraph( units: sorted.map{ GraphUnit(key: $0.0, value: $0.1) }, @@ -181,7 +181,7 @@ public extension Graph { textDisplayHandler: textDisplayHandler )) - case .Pie: + case .pie: self.init(pieGraph: PieGraph( units: sorted.map{ GraphUnit(key: $0.0, value: $0.1) }, @@ -193,27 +193,27 @@ public extension Graph { public extension Graph { - public func view(frame: CGRect) -> GraphView { + public func view(_ frame: CGRect) -> GraphView { return GraphView(frame: frame, graph: self) } } enum GraphKind { case - Bar(BarGraph), - Line(LineGraph), - Pie(PieGraph) + bar(BarGraph), + line(LineGraph), + pie(PieGraph) - internal static func barGraph(units: [GraphUnit], range: GraphRange) -> GraphKind { - return GraphKind.Bar(BarGraph(units: units, range: range)) + internal static func barGraph(_ units: [GraphUnit], range: GraphRange) -> GraphKind { + return GraphKind.bar(BarGraph(units: units, range: range)) } - internal static func lineGraph(units: [GraphUnit], range: GraphRange) -> GraphKind { - return GraphKind.Line(LineGraph(units: units, range: range)) + internal static func lineGraph(_ units: [GraphUnit], range: GraphRange) -> GraphKind { + return GraphKind.line(LineGraph(units: units, range: range)) } - internal static func pieGraph(units: [GraphUnit]) -> GraphKind { - return GraphKind.Pie(PieGraph(units: units)) + internal static func pieGraph(_ units: [GraphUnit]) -> GraphKind { + return GraphKind.pie(PieGraph(units: units)) } } @@ -250,7 +250,7 @@ internal struct BarGraph: GraphBase { self.textDisplayHandler = textDisplayHandler } - func view(frame: CGRect) -> GraphView? { + func view(_ frame: CGRect) -> GraphView? { return BarGraphView( frame: frame, graph: self @@ -261,7 +261,7 @@ internal struct BarGraph: GraphBase { if let f = textDisplayHandler { return f } - return { (unit, total) -> String? in String(unit.value) } + return { (unit, total) -> String? in String(describing: unit.value) } } } @@ -279,7 +279,7 @@ internal struct MultiBarGraph: GraphBase { if let f = textDisplayHandler { return f } - return { (unit, total) -> String? in String(unit.value) } + return { (unit, total) -> String? in String(describing: unit.value) } } } @@ -304,7 +304,7 @@ internal struct LineGraph: GraphBase { self.textDisplayHandler = textDisplayHandler } - func view(frame: CGRect) -> GraphView? { + func view(_ frame: CGRect) -> GraphView? { return LineGraphView(frame: frame, graph: self) } @@ -312,7 +312,7 @@ internal struct LineGraph: GraphBase { if let f = textDisplayHandler { return f } - return { (unit, total) -> String? in String(unit.value) } + return { (unit, total) -> String? in String(describing: unit.value) } } } @@ -334,7 +334,7 @@ internal struct PieGraph: GraphBase { self.textDisplayHandler = textDisplayHandler } - func view(frame: CGRect) -> GraphView? { + func view(_ frame: CGRect) -> GraphView? { return PieGraphView(frame: frame, graph: self) } @@ -344,7 +344,7 @@ internal struct PieGraph: GraphBase { } return { (unit, total) -> String? in let f = unit.value.floatValue() / total.floatValue() - return String(unit.value) + " : " + String(format: "%.0f%%", f * 100.0) + return String(describing: unit.value) + " : " + String(format: "%.0f%%", f * 100.0) } } } @@ -384,7 +384,7 @@ public struct BarGraphApperance { barWidthScale: CGFloat?, valueTextAttributes: GraphTextAttributes? ) { - self.barColor = barColor ?? DefaultColorType.Bar.color() + self.barColor = barColor ?? DefaultColorType.bar.color() self.barWidthScale = barWidthScale ?? 0.8 self.valueTextAttributes = valueTextAttributes } @@ -400,9 +400,9 @@ public struct GraphTextAttributes { textColor: UIColor?, textAlign: NSTextAlignment? ) { - self.font = font ?? UIFont.systemFontOfSize(10.0) - self.textColor = textColor ?? UIColor.grayColor() - self.textAlign = textAlign ?? .Center + self.font = font ?? UIFont.systemFont(ofSize: 10.0) + self.textColor = textColor ?? UIColor.gray + self.textAlign = textAlign ?? .center } } @@ -411,11 +411,11 @@ public struct GraphTextAttributes { public protocol NumericType: Equatable, Comparable { - func +(lhs: Self, rhs: Self) -> Self - func -(lhs: Self, rhs: Self) -> Self - func *(lhs: Self, rhs: Self) -> Self - func /(lhs: Self, rhs: Self) -> Self - func %(lhs: Self, rhs: Self) -> Self + static func +(lhs: Self, rhs: Self) -> Self + static func -(lhs: Self, rhs: Self) -> Self + static func *(lhs: Self, rhs: Self) -> Self + static func /(lhs: Self, rhs: Self) -> Self + static func %(lhs: Self, rhs: Self) -> Self init() init(_ v: Int) } diff --git a/Graphs/GraphView.swift b/Graphs/GraphView.swift index 3a8cacf..a4de0d2 100644 --- a/Graphs/GraphView.swift +++ b/Graphs/GraphView.swift @@ -8,29 +8,29 @@ import UIKit -public class GraphView: UIView { +open class GraphView: UIView { - public var graph: Graph? { + open var graph: Graph? { didSet { self.reloadData() } } - private var barGraphConfig: BarGraphViewConfig? - private var lineGraphConfig: LineGraphViewConfig? - private var pieGraphConfig: PieGraphViewConfig? + fileprivate var barGraphConfig: BarGraphViewConfig? + fileprivate var lineGraphConfig: LineGraphViewConfig? + fileprivate var pieGraphConfig: PieGraphViewConfig? public init(frame: CGRect, graph: Graph? = nil) { self.graph = graph super.init(frame: frame) - self.backgroundColor = UIColor.clearColor() + self.backgroundColor = UIColor.clear self.reloadData() } required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) - self.backgroundColor = UIColor.clearColor() + self.backgroundColor = UIColor.clear self.reloadData() } @@ -41,7 +41,7 @@ public class GraphView: UIView { guard let graph = self.graph else { return } switch graph.kind { - case .Bar(let g): + case .bar(let g): if let view = g.view(self.bounds) { if let c = barGraphConfig { @@ -50,7 +50,7 @@ public class GraphView: UIView { self.addSubview(view) } - case .Line(let g): + case .line(let g): if let view = g.view(self.bounds) { if let c = lineGraphConfig { @@ -59,7 +59,7 @@ public class GraphView: UIView { self.addSubview(view) } - case .Pie(let g): + case .pie(let g): if let view = g.view(self.bounds) { if let c = pieGraphConfig { @@ -70,7 +70,7 @@ public class GraphView: UIView { } } - public override func layoutSubviews() { + open override func layoutSubviews() { super.layoutSubviews() self.subviews.forEach{ $0.frame = self.bounds @@ -80,7 +80,7 @@ public class GraphView: UIView { extension GraphView { - public func barGraphConfiguration(configuration: () -> BarGraphViewConfig) -> Self { + public func barGraphConfiguration(_ configuration: () -> BarGraphViewConfig) -> Self { self.barGraphConfig = configuration() self.subviews.forEach { (v) in if let barGraphView = v as? BarGraphView { @@ -90,7 +90,7 @@ extension GraphView { return self } - public func lineGraphConfiguration(configuration: () -> LineGraphViewConfig) -> Self { + public func lineGraphConfiguration(_ configuration: () -> LineGraphViewConfig) -> Self { self.lineGraphConfig = configuration() self.subviews.forEach { (v) in if let lineGraphView = v as? LineGraphView { @@ -100,7 +100,7 @@ extension GraphView { return self } - public func pieGraphConfiguration(configuration: () -> PieGraphViewConfig) -> Self { + public func pieGraphConfiguration(_ configuration: () -> PieGraphViewConfig) -> Self { self.pieGraphConfig = configuration() self.subviews.forEach { (v) in if let pieGraphView = v as? PieGraphView { diff --git a/Graphs/GraphsExtensions.swift b/Graphs/GraphsExtensions.swift index 58ab391..00ca166 100644 --- a/Graphs/GraphsExtensions.swift +++ b/Graphs/GraphsExtensions.swift @@ -26,32 +26,32 @@ public protocol GraphData { SequenceType -> 'Graph' object */ -extension SequenceType where Generator.Element: GraphData { +extension Sequence where Iterator.Element: GraphData { - typealias GraphDataKey = Generator.Element.GraphDataKey - typealias GraphDataValue = Generator.Element.GraphDataValue + typealias GraphDataKey = Iterator.Element.GraphDataKey + typealias GraphDataValue = Iterator.Element.GraphDataValue public func barGraph( - range: GraphRange? = nil, + _ range: GraphRange? = nil, textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + ) -> Graph { - return Graph(type: .Bar, data: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .bar, data: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) } public func lineGraph( - range: GraphRange? = nil, + _ range: GraphRange? = nil, textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + ) -> Graph { - return Graph(type: .Line, data: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .line, data: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) } public func pieGraph( - textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + _ textDisplayHandler: Graph.GraphTextDisplayHandler? = nil + ) -> Graph { - return Graph(type: .Pie, data: self.map{ $0 }, range: nil, textDisplayHandler: textDisplayHandler) + return Graph(type: .pie, data: self.map{ $0 }, range: nil, textDisplayHandler: textDisplayHandler) } } @@ -60,31 +60,31 @@ extension SequenceType where Generator.Element: GraphData { SequenceType -> 'Graph' object */ -extension SequenceType where Generator.Element: NumericType { +extension Sequence where Iterator.Element: NumericType { public func barGraph( - range: GraphRange? = nil, - textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + _ range: GraphRange? = nil, + textDisplayHandler: Graph.GraphTextDisplayHandler? = nil + ) -> Graph { - return Graph(type: .Bar, array: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .bar, array: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) } public func lineGraph( - range: GraphRange? = nil, - textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + _ range: GraphRange? = nil, + textDisplayHandler: Graph.GraphTextDisplayHandler? = nil + ) -> Graph { - return Graph(type: .Line, array: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .line, array: self.map{ $0 }, range: range, textDisplayHandler: textDisplayHandler) } public func pieGraph( - textDisplayHandler: Graph.GraphTextDisplayHandler? = nil - ) -> Graph { + _ textDisplayHandler: Graph.GraphTextDisplayHandler? = nil + ) -> Graph { - return Graph(type: .Pie, array: self.map{ $0 }, range: nil, textDisplayHandler: textDisplayHandler) + return Graph(type: .pie, array: self.map{ $0 }, range: nil, textDisplayHandler: textDisplayHandler) } } @@ -94,37 +94,37 @@ extension SequenceType where Generator.Element: NumericType { Dictionary -> 'Graph' object */ -extension CollectionType where Self: DictionaryLiteralConvertible, Self.Key: Hashable, Self.Value: NumericType, Generator.Element == (Self.Key, Self.Value) { +extension Collection where Self: ExpressibleByDictionaryLiteral, Self.Key: Hashable, Self.Value: NumericType, Iterator.Element == (Self.Key, Self.Value) { typealias aKey = Self.Key typealias aValue = Self.Value public func barGraph( - range: GraphRange? = nil, + _ range: GraphRange? = nil, sort: (((Self.Key, Self.Value), (Self.Key, Self.Value)) -> Bool)? = nil, textDisplayHandler: Graph.GraphTextDisplayHandler? = nil ) -> Graph { - return Graph(type: .Bar, dictionary: dict(), range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .bar, dictionary: dict(), range: range, textDisplayHandler: textDisplayHandler) } public func lineGraph( - range: GraphRange? = nil, + _ range: GraphRange? = nil, sort: (((Self.Key, Self.Value), (Self.Key, Self.Value)) -> Bool)? = nil, textDisplayHandler: Graph.GraphTextDisplayHandler? = nil ) -> Graph { - return Graph(type: .Line, dictionary: dict(), range: range, textDisplayHandler: textDisplayHandler) + return Graph(type: .line, dictionary: dict(), range: range, textDisplayHandler: textDisplayHandler) } public func pieGraph( - range: GraphRange? = nil, + _ range: GraphRange? = nil, sort: (((Self.Key, Self.Value), (Self.Key, Self.Value)) -> Bool)? = nil, textDisplayHandler: Graph.GraphTextDisplayHandler? = nil ) -> Graph { - return Graph(type: .Pie, dictionary: dict(), range: nil, textDisplayHandler: textDisplayHandler) + return Graph(type: .pie, dictionary: dict(), range: nil, textDisplayHandler: textDisplayHandler) } func dict() -> [aKey: aValue] { @@ -153,21 +153,21 @@ extension Array { } enum DefaultColorType { - case Bar, Line, BarText, LineText, PieText + case bar, line, barText, lineText, pieText func color() -> UIColor { switch self { - case .Bar: return UIColor(hex: "#4DC2AB") - case .Line: return UIColor(hex: "#FF0066") - case .BarText: return UIColor(hex: "#333333") - case .LineText: return UIColor(hex: "#333333") - case .PieText: return UIColor(hex: "#FFFFFF") + case .bar: return UIColor(hex: "#4DC2AB") + case .line: return UIColor(hex: "#FF0066") + case .barText: return UIColor(hex: "#333333") + case .lineText: return UIColor(hex: "#333333") + case .pieText: return UIColor(hex: "#FFFFFF") } } - static func pieColors(count: Int) -> [UIColor] { + static func pieColors(_ count: Int) -> [UIColor] { - func randomArray(arr: [Int]) -> [Int] { + func randomArray(_ arr: [Int]) -> [Int] { if arr.count <= 0 { return [] } @@ -201,7 +201,7 @@ public extension UIColor { let prefixHex = {(str) -> String in for prefix in ["0x", "0X", "#"] { if str.hasPrefix(prefix) { - return str.substringFromIndex(str.startIndex.advancedBy(prefix.characters.count)) + return str.substring(from: str.characters.index(str.startIndex, offsetBy: prefix.characters.count)) } } return str @@ -213,9 +213,9 @@ public extension UIColor { return } - let scanner = NSScanner(string: prefixHex) + let scanner = Scanner(string: prefixHex) var hexInt: UInt64 = 0 - if !scanner.scanHexLongLong(&hexInt) { + if !scanner.scanHexInt64(&hexInt) { self.init(white: 0.0, alpha: 1.0) return } @@ -251,9 +251,9 @@ public extension UIEdgeInsets { extension NSAttributedString { - class func graphAttributedString(string: String, color: UIColor, font: UIFont) -> NSAttributedString { + class func graphAttributedString(_ string: String, color: UIColor, font: UIFont) -> NSAttributedString { let paragraph = NSMutableParagraphStyle() - paragraph.alignment = .Center + paragraph.alignment = .center return NSAttributedString(string: string, attributes: [ NSForegroundColorAttributeName:color, diff --git a/Graphs/LineGraphView.swift b/Graphs/LineGraphView.swift index 0bfc6b6..8c6745c 100644 --- a/Graphs/LineGraphView.swift +++ b/Graphs/LineGraphView.swift @@ -27,24 +27,24 @@ public struct LineGraphViewConfig { dotDiameter: CGFloat? = nil, contentInsets: UIEdgeInsets? = nil ) { - self.lineColor = lineColor ?? DefaultColorType.Line.color() + self.lineColor = lineColor ?? DefaultColorType.line.color() self.lineWidth = lineWidth ?? 3.0 - self.textColor = textColor ?? DefaultColorType.LineText.color() - self.textFont = textFont ?? UIFont.systemFontOfSize(10.0) + self.textColor = textColor ?? DefaultColorType.lineText.color() + self.textFont = textFont ?? UIFont.systemFont(ofSize: 10.0) self.dotEnable = true self.dotDiameter = dotDiameter ?? 10.0 - self.contentInsets = contentInsets ?? UIEdgeInsetsZero + self.contentInsets = contentInsets ?? UIEdgeInsets.zero } } internal class LineGraphView: UIView { - private var graph: LineGraph? - private var config: LineGraphViewConfig + fileprivate var graph: LineGraph? + fileprivate var config: LineGraphViewConfig var lineColor: UIColor? = nil { didSet { - self.config.lineColor = lineColor ?? DefaultColorType.Line.color() + self.config.lineColor = lineColor ?? DefaultColorType.line.color() self.setNeedsDisplay() } } @@ -53,17 +53,21 @@ internal class LineGraphView: UIView { self.config = LineGraphViewConfig() super.init(frame: frame) - self.backgroundColor = UIColor.clearColor() + self.backgroundColor = UIColor.clear self.graph = graph } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - func setLineGraphViewConfig(config: LineGraphViewConfig?) { + func setLineGraphViewConfig(_ config: LineGraphViewConfig?) { self.config = config ?? LineGraphViewConfig() self.setNeedsDisplay() } - override func drawRect(rect: CGRect) { - super.drawRect(rect) + override func draw(_ rect: CGRect) { + super.draw(rect) guard let lineGraph = self.graph else { return } let rect = self.graphFrame() @@ -72,34 +76,34 @@ internal class LineGraphView: UIView { let ps = self.points(lineGraph, rect: rect) let context = UIGraphicsGetCurrentContext() - CGContextSetStrokeColorWithColor(context, config.lineColor.CGColor ?? UIColor.blackColor().CGColor) - CGContextSetLineWidth(context, self.config.lineWidth) + context?.setStrokeColor(config.lineColor.cgColor) + context?.setLineWidth(self.config.lineWidth) ps.forEach({point in if point == ps.first { - CGContextMoveToPoint(context, point.x, point.y) + context?.move(to: CGPoint(x: point.x, y: point.y)) } else { - CGContextAddLineToPoint(context, point.x, point.y) - CGContextStrokePath(context) - CGContextMoveToPoint(context, point.x, point.y) + context?.addLine(to: CGPoint(x: point.x, y: point.y)) + context?.strokePath() + context?.move(to: CGPoint(x: point.x, y: point.y)) } }) - CGContextSetLineWidth(context, 0.0) - CGContextSetFillColorWithColor(context, config.lineColor.CGColor ?? UIColor.blackColor().CGColor) + context?.setLineWidth(0.0) + context?.setFillColor(config.lineColor.cgColor) if self.config.dotEnable { ps.forEach({point in let r = CGRect(x: point.x - CGFloat(self.config.dotDiameter / 2.0), y: point.y - CGFloat(self.config.dotDiameter / 2.0), width: CGFloat(self.config.dotDiameter), height: CGFloat(self.config.dotDiameter)) - CGContextStrokeEllipseInRect(context, r) - CGContextFillEllipseInRect(context, r) + context?.strokeEllipse(in: r) + context?.fillEllipse(in: r) }) } zip(lineGraph.units, ps).forEach { (u, p) in - guard let str = self.graph?.graphTextDisplay()(unit: u, totalValue: total) else { + guard let str = self.graph?.graphTextDisplay()(u, total) else { return } @@ -107,8 +111,8 @@ internal class LineGraphView: UIView { let size = attrStr.size() - attrStr.drawInRect( - CGRect( + attrStr.draw( + in: CGRect( origin: CGPoint( x: p.x - sectionWidth / 2.0, y: u.value >= U(0) @@ -124,7 +128,7 @@ internal class LineGraphView: UIView { } } - private func graphFrame() -> CGRect { + fileprivate func graphFrame() -> CGRect { return CGRect( x: self.config.contentInsets.left, y: self.config.contentInsets.top, @@ -133,11 +137,11 @@ internal class LineGraphView: UIView { ) } - private func points(graph: LineGraph, rect: CGRect) -> [CGPoint] { + fileprivate func points(_ graph: LineGraph, rect: CGRect) -> [CGPoint] { let sectionWidth = rect.width / CGFloat(graph.units.count) - return graph.units.enumerate().map { + return graph.units.enumerated().map { CGPoint( x: CGFloat($0) * sectionWidth + (sectionWidth / 2.0) + rect.origin.x, y: rect.size.height - rect.size.height * CGFloat(($1.value - graph.range.min).floatValue() / (graph.range.max - graph.range.min).floatValue()) + rect.origin.y diff --git a/Graphs/MultiBarGraphView.swift b/Graphs/MultiBarGraphView.swift index 975c9a3..c189dc7 100644 --- a/Graphs/MultiBarGraphView.swift +++ b/Graphs/MultiBarGraphView.swift @@ -10,10 +10,10 @@ import UIKit class MultiBarGraphView: UIView { - private var scrollView: UIScrollView! + fileprivate var scrollView: UIScrollView! - private var graph: MultiBarGraph? - private var config: MultiBarGraphViewConfig + fileprivate var graph: MultiBarGraph? + fileprivate var config: MultiBarGraphViewConfig init(frame: CGRect, graph: MultiBarGraph?, viewConfig: MultiBarGraphViewConfig? = nil) { @@ -25,6 +25,10 @@ class MultiBarGraphView: UIView { ) self.addSubview(self.scrollView) } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } } struct MultiBarGraphViewConfig { @@ -38,7 +42,7 @@ struct MultiBarGraphViewConfig { barWidthScale: CGFloat? = nil, sectionWidth: CGFloat? = nil ) { - self.barColors = barColors ?? [DefaultColorType.Bar.color()] + self.barColors = barColors ?? [DefaultColorType.bar.color()] self.barWidthScale = barWidthScale ?? 0.8 self.sectionWidth = sectionWidth } diff --git a/Graphs/PieGraphView.swift b/Graphs/PieGraphView.swift index 5f6b1e1..95b6fd4 100644 --- a/Graphs/PieGraphView.swift +++ b/Graphs/PieGraphView.swift @@ -24,53 +24,57 @@ public struct PieGraphViewConfig { contentInsets: UIEdgeInsets? = nil ) { self.pieColors = pieColors - self.textColor = textColor ?? DefaultColorType.PieText.color() - self.textFont = textFont ?? UIFont.systemFontOfSize(10.0) + self.textColor = textColor ?? DefaultColorType.pieText.color() + self.textFont = textFont ?? UIFont.systemFont(ofSize: 10.0) self.isDounut = isDounut - self.contentInsets = contentInsets ?? UIEdgeInsetsZero + self.contentInsets = contentInsets ?? UIEdgeInsets.zero } } internal class PieGraphView: UIView { - private var graph: PieGraph? { + fileprivate var graph: PieGraph? { didSet { self.config.pieColors = DefaultColorType.pieColors(graph?.units.count ?? 0) self.setNeedsDisplay() } } - private var config: PieGraphViewConfig + fileprivate var config: PieGraphViewConfig init(frame: CGRect, graph: PieGraph?) { self.config = PieGraphViewConfig(pieColors: DefaultColorType.pieColors(graph?.units.count ?? 0)) super.init(frame: frame) - self.backgroundColor = UIColor.clearColor() + self.backgroundColor = UIColor.clear self.graph = graph } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - func setPieGraphViewConfig(config: PieGraphViewConfig?) { + func setPieGraphViewConfig(_ config: PieGraphViewConfig?) { self.config = config ?? PieGraphViewConfig() self.setNeedsDisplay() } - override func drawRect(rect: CGRect) { - super.drawRect(rect) + override func draw(_ rect: CGRect) { + super.draw(rect) guard let graph = self.graph else { return } - func convert(s: S, arr: [S], f: (S) -> S) -> [S] { + func convert(_ s: S, arr: [S], f: (S) -> S) -> [S] { switch arr.match { - case let .Some(h, t): return [f(h) + s] + convert(h + s, arr:t, f: f) - case .None: return [] + case let .some(h, t): return [(f(h) + s) as S] + convert(h + s, arr:t, f: f) + case .none: return [] } } let colors = self.config.pieColors ?? DefaultColorType.pieColors(graph.units.count) let values = graph.units.map({ max($0.value, U(0)) }) - let total = values.reduce(U(0), combine: { $0 + $1 }) + let total = values.reduce(U(0), { $0 + $1 }) let percentages = values.map({ Double($0.floatValue() / total.floatValue()) }) let rect = self.graphFrame() @@ -90,40 +94,42 @@ internal class PieGraphView: UIView { var startAngle = -M_PI / 2.0 - percentages.enumerate().forEach { (index, f) in + percentages.enumerated().forEach { (index, f) in let endAngle = startAngle + M_PI * 2.0 * f - CGContextMoveToPoint(context, x, y); - CGContextAddArc(context, x, y, radius, CGFloat(startAngle), CGFloat(endAngle), 0); + context?.move(to: CGPoint(x: x, y: y)); + context?.addArc(center: CGPoint(x: x, y: y), radius: radius, startAngle: CGFloat(startAngle), endAngle: CGFloat(endAngle), clockwise: false) if self.config.isDounut { - CGContextAddArc(context, x, y, radius/2, CGFloat(endAngle), CGFloat(startAngle), 1) + context?.addArc(center: CGPoint(x: x, y: y), radius: radius/2, startAngle: CGFloat(endAngle), endAngle: CGFloat(startAngle), clockwise: true) } - CGContextSetFillColor(context, CGColorGetComponents( colors[index].CGColor )) - CGContextClosePath(context); - CGContextFillPath(context); + if let comps = colors[index].cgColor.components { + context?.setFillColor(comps) + } + context?.closePath(); + context?.fillPath(); startAngle = endAngle } zip(graph.units, centers).forEach { (u, center) in - guard let str = self.graph?.graphTextDisplay()(unit: u, totalValue: total) else { + guard let str = self.graph?.graphTextDisplay()(u, total) else { return } let paragraph = NSMutableParagraphStyle() - paragraph.alignment = .Center + paragraph.alignment = .center let attrStr = NSAttributedString(string: str, attributes: [ NSForegroundColorAttributeName:self.config.textColor, - NSFontAttributeName: UIFont.systemFontOfSize(10.0), + NSFontAttributeName: UIFont.systemFont(ofSize: 10.0), NSParagraphStyleAttributeName: paragraph ]) let size = attrStr.size() - attrStr.drawInRect( - CGRect( + attrStr.draw( + in: CGRect( origin: CGPoint( x: center.x - size.width / 2.0, y: center.y - size.height / 2.0 @@ -134,7 +140,7 @@ internal class PieGraphView: UIView { } } - private func graphFrame() -> CGRect { + fileprivate func graphFrame() -> CGRect { return CGRect( x: self.config.contentInsets.left, y: self.config.contentInsets.top, diff --git a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj index 66c05fc..226252d 100644 --- a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj +++ b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj @@ -172,14 +172,18 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Recruit Holdings Co., Ltd."; TargetAttributes = { E92069A71CFC3D200025DBC8 = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = RT4NRJPHW3; + LastSwiftMigration = 0800; }; E92069BB1CFC3D200025DBC8 = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = RT4NRJPHW3; + LastSwiftMigration = 0800; TestTargetID = E92069A71CFC3D200025DBC8; }; }; @@ -349,8 +353,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -395,8 +401,10 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -415,6 +423,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -424,12 +433,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 4227E7448AC62671208299D7 /* Pods-GraphsExample.debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = RT4NRJPHW3; INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -437,12 +449,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 648833EF53F9A4F7C44598BB /* Pods-GraphsExample.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = RT4NRJPHW3; INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -450,10 +465,12 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = RT4NRJPHW3; INFOPLIST_FILE = GraphsExampleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GraphsExample.app/GraphsExample"; }; name = Debug; @@ -462,10 +479,12 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = RT4NRJPHW3; INFOPLIST_FILE = GraphsExampleTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GraphsExample.app/GraphsExample"; }; name = Release; diff --git a/GraphsExample/GraphsExample/AppDelegate.swift b/GraphsExample/GraphsExample/AppDelegate.swift index f6e1480..cd5f4c6 100644 --- a/GraphsExample/GraphsExample/AppDelegate.swift +++ b/GraphsExample/GraphsExample/AppDelegate.swift @@ -13,31 +13,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - // Override point for customization after application launch. + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { return true } - func applicationWillResignActive(application: UIApplication) { + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - func applicationDidEnterBackground(application: UIApplication) { + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(application: UIApplication) { + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(application: UIApplication) { + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - func applicationWillTerminate(application: UIApplication) { + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } diff --git a/GraphsExample/GraphsExample/MainViewController.swift b/GraphsExample/GraphsExample/MainViewController.swift index 659e2bf..59f1a7b 100644 --- a/GraphsExample/GraphsExample/MainViewController.swift +++ b/GraphsExample/GraphsExample/MainViewController.swift @@ -31,41 +31,39 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec @IBOutlet private var collectionView: UICollectionView! - override func viewWillAppear(animated: Bool) { + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.navigationController?.setNavigationBarHidden(true, animated: animated) } - override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) { + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { self.collectionView.reloadData() } - override func willTransitionToTraitCollection(newCollection: UITraitCollection, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { - super.willTransitionToTraitCollection(newCollection, withTransitionCoordinator: coordinator) + override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) { + super.willTransition(to: newCollection, with: coordinator) self.collectionView.reloadData() } - - override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { - super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) + + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + super.viewWillTransition(to: size, with: coordinator) self.collectionView.reloadData() } - // MARK: - UICollectionViewDataSource - - func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { + func numberOfSections(in collectionView: UICollectionView) -> Int { return 1 } - - func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return GraphExampleType.count() } - - func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! GraphCollectionViewCell + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! GraphCollectionViewCell cell.graphView.subviews.forEach({ $0.removeFromSuperview() }) @@ -73,7 +71,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .BarGraph1: let view = (1 ... 10).barGraph(GraphRange(min: 0, max: 11)).view(cell.graphView.bounds) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "let view = (1 ... 10).barGraph(GraphRange(min: 0, max: 11)).view(cell.graphView.bounds)" @@ -81,7 +79,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .BarGraph2: let view = [8, 12, 20, -10, 6, 20, -11, 9, 12, 16, -10, 6, 20, -12].barGraph().view(cell.graphView.bounds).barGraphConfiguration({ BarGraphViewConfig(barColor: UIColor(hex: "#ff6699"), contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "[8, 12, 20, -10, 6, 20, -11, 9, 12, 16, -10, 6, 20, -12].barGraph().view(cell.graphView.bounds).barGraphConfiguration({ BarGraphViewConfig(barColor: UIColor(hex: \"#ff6699\"), contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) })" @@ -89,7 +87,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .BarGraph3: let view = [8.0, 12.0, 20.0, 10.0, 6.0, 20.0, 11.0, 9.0, 12.0, 16.0, 10.0, 6.0, 20.0].barGraph(GraphRange(min: 0, max: 25)).view(cell.graphView.bounds).barGraphConfiguration({ BarGraphViewConfig(barColor: UIColor(hex: "#ccff66"), barWidthScale: 0.4) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "let view = [8.0, 12.0, 20.0, 10.0, 6.0, 20.0, 11.0, 9.0, 12.0, 16.0, 10.0, 6.0, 20.0].barGraph(GraphRange(min: 0, max: 25)).view(cell.graphView.bounds).barGraphConfiguration({ BarGraphViewConfig(barColor: UIColor(hex: \"#ccff66\"), barWidthScale: 0.4) })" @@ -97,7 +95,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .LineGraph1: let view = (1 ... 10).lineGraph(GraphRange(min: 0, max: 11)).view(cell.graphView.bounds) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "let view = (1 ... 10).lineGraph(GraphRange(min: 0, max: 11)).view(cell.graphView.bounds)" @@ -105,7 +103,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .LineGraph2: let view = [8, 12, 20, -10, 6, 20, -11, 9, 12, 16, -10, 6, 20, -12].lineGraph().view(cell.graphView.bounds).lineGraphConfiguration({ LineGraphViewConfig(lineColor: UIColor(hex: "#ff6699"), contentInsets: UIEdgeInsets(top: 32.0, left: 32.0, bottom: 32.0, right: 32.0)) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "[8, 12, 20, -10, 6, 20, -11, 9, 12, 16, -10, 6, 20, -12].lineGraph().view(cell.graphView.bounds).lineGraphConfiguration({ LineGraphViewConfig(lineColor: UIColor(hex: \"#ff6699\"), contentInsets: UIEdgeInsets(top: 32.0, left: 32.0, bottom: 32.0, right: 32.0)) })" @@ -113,7 +111,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .LineGraph3: let view = [8.0, 12.0, 20.0, 10.0, 6.0, 20.0, 11.0, 9.0, 12.0, 16.0, 10.0, 6.0, 20.0].lineGraph(GraphRange(min: 0, max: 25)).view(cell.graphView.bounds).lineGraphConfiguration({ LineGraphViewConfig(lineColor: UIColor(hex: "#ccff33"), lineWidth: 2.0, dotDiameter: 20.0) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "[8.0, 12.0, 20.0, 10.0, 6.0, 20.0, 11.0, 9.0, 12.0, 16.0, 10.0, 6.0, 20.0].lineGraph(GraphRange(min: 0, max: 25)).view(cell.graphView.bounds).lineGraphConfiguration({ LineGraphViewConfig(lineColor: UIColor(hex: \"#ccff66\"), lineWidth: 1.0, dotDiameter: 10.0) })" @@ -121,7 +119,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .PieGraph1: let view = (5 ... 10).pieGraph().view(cell.graphView.bounds) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "(5 ... 10).pieGraph().view(cell.graphView.bounds)" @@ -129,7 +127,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .PieGraph2: let view = [8, 12, 20, 6, 20, 11, 9].pieGraph(){ (u, t) -> String? in String(format: "%.0f%%", (Float(u.value) / Float(t)))}.view(cell.graphView.bounds).pieGraphConfiguration({ PieGraphViewConfig(textFont: UIFont(name: "DINCondensed-Bold", size: 14.0), isDounut: true, contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "[8, 12, 20, 6, 20, 11, 9].pieGraph(){ (u, t) -> String? in String(format: \"%.0f%%\", (Float(u.value) / Float(t)))}.view(cell.graphView.bounds).pieGraphConfiguration({ PieGraphViewConfig(textFont: UIFont(name: \"DINCondensed-Bold\", size: 14.0), isDounut: true, contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) })" @@ -137,7 +135,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec case .PieGraph3: let view = [8.5, 20.0].pieGraph(){ (u, t) -> String? in String(format: "%.0f%%", (Float(u.value) / Float(t)))}.view(cell.graphView.bounds).pieGraphConfiguration({ PieGraphViewConfig(textFont: UIFont(name: "DINCondensed-Bold", size: 14.0), isDounut: true, contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) }) - view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + view.autoresizingMask = [.flexibleWidth, .flexibleHeight] cell.graphView.addSubview(view) cell.label.text = "[8.5, 20.0].pieGraph(){ (u, t) -> String? in String(format: \"%.0f%%\", (Float(u.value) / Float(t)))}.view(cell.graphView.bounds).pieGraphConfiguration({ PieGraphViewConfig(textFont: UIFont(name: \"DINCondensed-Bold\", size: 14.0), isDounut: true, contentInsets: UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)) })" @@ -149,11 +147,11 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec // MARK: - UICollectionViewDelegate - func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { + func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { switch kind { case UICollectionElementKindSectionHeader: - let view = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "Header", forIndexPath: indexPath) + let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "Header", for: indexPath) return view case _: return UICollectionReusableView() @@ -162,12 +160,12 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec private let cellMargin = CGFloat(8.0) - func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let regularCollection = UITraitCollection(horizontalSizeClass: .Regular) + let regularCollection = UITraitCollection(horizontalSizeClass: .regular) - let horizontalCellCount = self.traitCollection.containsTraitsInCollection(regularCollection) ? 2 : 1 + let horizontalCellCount = self.traitCollection.containsTraits(in: regularCollection) ? 2 : 1 let width = (collectionView.frame.size.width - cellMargin * CGFloat(horizontalCellCount + 1)) / CGFloat(horizontalCellCount) return CGSize( @@ -176,7 +174,7 @@ class MainViewController: UIViewController, UICollectionViewDataSource, UICollec ) } - func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSize(width: collectionView.frame.size.width, height: 120.0) } diff --git a/GraphsExample/Podfile.lock b/GraphsExample/Podfile.lock index 07f8850..e9c3ef5 100644 --- a/GraphsExample/Podfile.lock +++ b/GraphsExample/Podfile.lock @@ -1,14 +1,14 @@ PODS: - - Graphs (0.1.0) + - Graphs (0.1.2) DEPENDENCIES: - Graphs (from `..`) EXTERNAL SOURCES: Graphs: - :path: ".." + :path: .. SPEC CHECKSUMS: - Graphs: 86c8882eff318c40ed092790116aaa8d23d52676 + Graphs: 08e8c2ee01dc13c96222dfd92ccb018d14748f4c COCOAPODS: 0.39.0 From 9df85312c64046c101c23684d427317b78f85d99 Mon Sep 17 00:00:00 2001 From: "Yingbo (Max) Wang" Date: Sun, 23 Apr 2017 22:21:17 -0700 Subject: [PATCH 2/6] Resolve bug of swift compiler segfault in Xcode 8.2.1. --- Graphs/PieGraphView.swift | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Graphs/PieGraphView.swift b/Graphs/PieGraphView.swift index 95b6fd4..9b5af61 100644 --- a/Graphs/PieGraphView.swift +++ b/Graphs/PieGraphView.swift @@ -58,21 +58,22 @@ internal class PieGraphView: UIView { self.config = config ?? PieGraphViewConfig() self.setNeedsDisplay() } - + + // This generic function has to be put outside of "draw(_ rect: CGRect)", to avoid Swift compiler segmentation fault 11 + func convert(_ s: S, arr: [S], f: (S) -> S) -> [S] { + switch arr.match { + case let .some(h, t): return [(f(h) + s) as S] + convert(h + s, arr:t, f: f) + case .none: return [] + } + } + override func draw(_ rect: CGRect) { super.draw(rect) guard let graph = self.graph else { return } - - func convert(_ s: S, arr: [S], f: (S) -> S) -> [S] { - switch arr.match { - case let .some(h, t): return [(f(h) + s) as S] + convert(h + s, arr:t, f: f) - case .none: return [] - } - } - + let colors = self.config.pieColors ?? DefaultColorType.pieColors(graph.units.count) - + let values = graph.units.map({ max($0.value, U(0)) }) let total = values.reduce(U(0), { $0 + $1 }) let percentages = values.map({ Double($0.floatValue() / total.floatValue()) }) From 7db33b19007463ffa4d2978988b9dd3a60f584aa Mon Sep 17 00:00:00 2001 From: Tyson Kerridge Date: Sat, 16 Sep 2017 23:35:09 +1000 Subject: [PATCH 3/6] Migrated to Swift 4. Had to remove mod operator (%) from NumericType. Doesn't appear to be in use within the project at least... --- Cartfile.resolved | 4 +-- Graphs.xcodeproj/project.pbxproj | 30 ++++++++++++++----- .../xcshareddata/xcschemes/Graphs.xcscheme | 4 ++- Graphs/Graph.swift | 3 +- Graphs/GraphsExtensions.swift | 16 +++++----- Graphs/PieGraphView.swift | 12 ++++---- 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index 5836577..4a33a6b 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "Quick/Nimble" "v5.0.0" -github "Quick/Quick" "v0.9.3" +github "Quick/Nimble" "v7.0.1" +github "Quick/Quick" "v1.1.0" diff --git a/Graphs.xcodeproj/project.pbxproj b/Graphs.xcodeproj/project.pbxproj index 274b053..004173f 100644 --- a/Graphs.xcodeproj/project.pbxproj +++ b/Graphs.xcodeproj/project.pbxproj @@ -194,19 +194,19 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Recruit Holdings Co., Ltd."; TargetAttributes = { E92069811CFC20840025DBC8 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = RT4NRJPHW3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; ProvisioningStyle = Manual; }; E920698B1CFC20840025DBC8 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = RT4NRJPHW3; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; ProvisioningStyle = Manual; }; }; @@ -289,14 +289,20 @@ 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_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; @@ -340,14 +346,20 @@ 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_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; @@ -394,7 +406,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -415,7 +428,8 @@ PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.Graphs; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -431,7 +445,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -448,7 +463,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme b/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme index c976214..d368b4e 100644 --- a/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme +++ b/Graphs.xcodeproj/xcshareddata/xcschemes/Graphs.xcscheme @@ -1,6 +1,6 @@ Self static func -(lhs: Self, rhs: Self) -> Self static func *(lhs: Self, rhs: Self) -> Self static func /(lhs: Self, rhs: Self) -> Self - static func %(lhs: Self, rhs: Self) -> Self init() init(_ v: Int) } diff --git a/Graphs/GraphsExtensions.swift b/Graphs/GraphsExtensions.swift index 00ca166..d454faf 100644 --- a/Graphs/GraphsExtensions.swift +++ b/Graphs/GraphsExtensions.swift @@ -28,8 +28,8 @@ public protocol GraphData { extension Sequence where Iterator.Element: GraphData { - typealias GraphDataKey = Iterator.Element.GraphDataKey - typealias GraphDataValue = Iterator.Element.GraphDataValue + public typealias GraphDataKey = Iterator.Element.GraphDataKey + public typealias GraphDataValue = Iterator.Element.GraphDataValue public func barGraph( _ range: GraphRange? = nil, @@ -97,8 +97,8 @@ extension Sequence where Iterator.Element: NumericType { extension Collection where Self: ExpressibleByDictionaryLiteral, Self.Key: Hashable, Self.Value: NumericType, Iterator.Element == (Self.Key, Self.Value) { - typealias aKey = Self.Key - typealias aValue = Self.Value + public typealias aKey = Self.Key + public typealias aValue = Self.Value public func barGraph( _ range: GraphRange? = nil, @@ -201,7 +201,7 @@ public extension UIColor { let prefixHex = {(str) -> String in for prefix in ["0x", "0X", "#"] { if str.hasPrefix(prefix) { - return str.substring(from: str.characters.index(str.startIndex, offsetBy: prefix.characters.count)) + return String(str[str.characters.index(str.startIndex, offsetBy: prefix.characters.count)...]) } } return str @@ -256,9 +256,9 @@ extension NSAttributedString { paragraph.alignment = .center return NSAttributedString(string: string, attributes: [ - NSForegroundColorAttributeName:color, - NSFontAttributeName: font, - NSParagraphStyleAttributeName: paragraph + .foregroundColor: color, + .font: font, + .paragraphStyle: paragraph ]) } } diff --git a/Graphs/PieGraphView.swift b/Graphs/PieGraphView.swift index 9b5af61..136a0fb 100644 --- a/Graphs/PieGraphView.swift +++ b/Graphs/PieGraphView.swift @@ -86,17 +86,17 @@ internal class PieGraphView: UIView { let radius = min(rect.width, rect.height) / 2.0 let centers = convert(0.0, arr: percentages) { $0 / 2.0 }.map { (c) -> CGPoint in - let angle = M_PI * 2.0 * c - M_PI / 2.0 + let angle = .pi * 2.0 * c - .pi / 2.0 return CGPoint( x: Double(x) + cos(angle) * Double(radius * 3.0 / 4.0), y: Double(y) + sin(angle) * Double(radius * 3.0 / 4.0) ) } - var startAngle = -M_PI / 2.0 + var startAngle = -.pi / 2.0 percentages.enumerated().forEach { (index, f) in - let endAngle = startAngle + M_PI * 2.0 * f + let endAngle = startAngle + .pi * 2.0 * f context?.move(to: CGPoint(x: x, y: y)); context?.addArc(center: CGPoint(x: x, y: y), radius: radius, startAngle: CGFloat(startAngle), endAngle: CGFloat(endAngle), clockwise: false) @@ -122,9 +122,9 @@ internal class PieGraphView: UIView { paragraph.alignment = .center let attrStr = NSAttributedString(string: str, attributes: [ - NSForegroundColorAttributeName:self.config.textColor, - NSFontAttributeName: UIFont.systemFont(ofSize: 10.0), - NSParagraphStyleAttributeName: paragraph + .foregroundColor: self.config.textColor, + .font: UIFont.systemFont(ofSize: 10.0), + .paragraphStyle: paragraph ]) let size = attrStr.size() From 38f63383b6c4698439b5a03129ce4308e85cb151 Mon Sep 17 00:00:00 2001 From: Tyson Kerridge Date: Fri, 29 Dec 2017 13:33:03 +1000 Subject: [PATCH 4/6] Additions Swift 4 String migrations. characters is deprecated. --- Graphs/GraphsExtensions.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Graphs/GraphsExtensions.swift b/Graphs/GraphsExtensions.swift index d454faf..52f8226 100644 --- a/Graphs/GraphsExtensions.swift +++ b/Graphs/GraphsExtensions.swift @@ -201,14 +201,14 @@ public extension UIColor { let prefixHex = {(str) -> String in for prefix in ["0x", "0X", "#"] { if str.hasPrefix(prefix) { - return String(str[str.characters.index(str.startIndex, offsetBy: prefix.characters.count)...]) + return String(str[str.index(str.startIndex, offsetBy: prefix.count)...]) } } return str }(hex) - if prefixHex.characters.count != 6 && prefixHex.characters.count != 8 { + if prefixHex.count != 6 && prefixHex.count != 8 { self.init(white: 0.0, alpha: 1.0) return } @@ -220,7 +220,7 @@ public extension UIColor { return } - switch prefixHex.characters.count { + switch prefixHex.count { case 6: self.init(RGBInt: hexInt) case 8: From 4531b825dd1948e65914529128e9a8cee71336b6 Mon Sep 17 00:00:00 2001 From: Nash Gadre Date: Mon, 25 Jun 2018 12:55:01 -0400 Subject: [PATCH 5/6] Fix broken extension --- Graphs/GraphsExtensions.swift | 8 +- Graphs/PieGraphView.swift | 8 +- .../GraphsExample.xcodeproj/project.pbxproj | 103 ++++++++---------- GraphsExample/Podfile.lock | 8 +- 4 files changed, 57 insertions(+), 70 deletions(-) diff --git a/Graphs/GraphsExtensions.swift b/Graphs/GraphsExtensions.swift index 52f8226..7b50212 100644 --- a/Graphs/GraphsExtensions.swift +++ b/Graphs/GraphsExtensions.swift @@ -255,11 +255,9 @@ extension NSAttributedString { let paragraph = NSMutableParagraphStyle() paragraph.alignment = .center - return NSAttributedString(string: string, attributes: [ - .foregroundColor: color, - .font: font, - .paragraphStyle: paragraph - ]) + return NSMutableAttributedString( + string: string, + attributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: color, NSParagraphStyleAttributeName: paragraph]) } } diff --git a/Graphs/PieGraphView.swift b/Graphs/PieGraphView.swift index 136a0fb..b9bb067 100644 --- a/Graphs/PieGraphView.swift +++ b/Graphs/PieGraphView.swift @@ -121,11 +121,9 @@ internal class PieGraphView: UIView { let paragraph = NSMutableParagraphStyle() paragraph.alignment = .center - let attrStr = NSAttributedString(string: str, attributes: [ - .foregroundColor: self.config.textColor, - .font: UIFont.systemFont(ofSize: 10.0), - .paragraphStyle: paragraph - ]) + let attrStr = NSMutableAttributedString( + string: str, + attributes: [NSFontAttributeName:UIFont.systemFont(ofSize: 10.0), NSForegroundColorAttributeName: self.config.textColor, NSParagraphStyleAttributeName: paragraph]) let size = attrStr.size() diff --git a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj index 226252d..e65f4ad 100644 --- a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj +++ b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 974E409B1F3C36BC5D841350 /* Pods_GraphsExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8F49A1ECEBF7A92816B652F8 /* Pods_GraphsExample.framework */; }; + 997732406C40FD3614D32C96 /* Pods_GraphsExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 151EB9703E3E799C3FE91973 /* Pods_GraphsExample.framework */; }; E92069AC1CFC3D200025DBC8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E92069AB1CFC3D200025DBC8 /* AppDelegate.swift */; }; E92069B11CFC3D200025DBC8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E92069AF1CFC3D200025DBC8 /* Main.storyboard */; }; E92069B31CFC3D200025DBC8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E92069B21CFC3D200025DBC8 /* Assets.xcassets */; }; @@ -28,9 +28,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 4227E7448AC62671208299D7 /* Pods-GraphsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GraphsExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample.debug.xcconfig"; sourceTree = ""; }; - 648833EF53F9A4F7C44598BB /* Pods-GraphsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GraphsExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample.release.xcconfig"; sourceTree = ""; }; - 8F49A1ECEBF7A92816B652F8 /* Pods_GraphsExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GraphsExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 151EB9703E3E799C3FE91973 /* Pods_GraphsExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GraphsExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 465F0ABDDEF4C02C753CE97A /* Pods-GraphsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GraphsExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample.debug.xcconfig"; sourceTree = ""; }; E92069A81CFC3D200025DBC8 /* GraphsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GraphsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; E92069AB1CFC3D200025DBC8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; E92069B01CFC3D200025DBC8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -42,6 +41,7 @@ E92069C21CFC3D200025DBC8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E961AAE51D1245C400B4D5A7 /* GraphCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphCollectionViewCell.swift; sourceTree = ""; }; E97D788E1D112F8F00F4F8CF /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; + EE1A0FF102CF6F40687D38D2 /* Pods-GraphsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GraphsExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,7 +49,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 974E409B1F3C36BC5D841350 /* Pods_GraphsExample.framework in Frameworks */, + 997732406C40FD3614D32C96 /* Pods_GraphsExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,21 +63,21 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 29D120C267599379DAEF37A8 /* Frameworks */ = { + 22CB99AD1E7F847B621ADBE5 /* Pods */ = { isa = PBXGroup; children = ( - 8F49A1ECEBF7A92816B652F8 /* Pods_GraphsExample.framework */, + 465F0ABDDEF4C02C753CE97A /* Pods-GraphsExample.debug.xcconfig */, + EE1A0FF102CF6F40687D38D2 /* Pods-GraphsExample.release.xcconfig */, ); - name = Frameworks; + name = Pods; sourceTree = ""; }; - 8AFFCF1B50DBACE8319B88C4 /* Pods */ = { + A90BA0B16C5C466CEE0A0869 /* Frameworks */ = { isa = PBXGroup; children = ( - 4227E7448AC62671208299D7 /* Pods-GraphsExample.debug.xcconfig */, - 648833EF53F9A4F7C44598BB /* Pods-GraphsExample.release.xcconfig */, + 151EB9703E3E799C3FE91973 /* Pods_GraphsExample.framework */, ); - name = Pods; + name = Frameworks; sourceTree = ""; }; E920699F1CFC3D200025DBC8 = { @@ -86,8 +86,8 @@ E92069AA1CFC3D200025DBC8 /* GraphsExample */, E92069BF1CFC3D200025DBC8 /* GraphsExampleTests */, E92069A91CFC3D200025DBC8 /* Products */, - 8AFFCF1B50DBACE8319B88C4 /* Pods */, - 29D120C267599379DAEF37A8 /* Frameworks */, + 22CB99AD1E7F847B621ADBE5 /* Pods */, + A90BA0B16C5C466CEE0A0869 /* Frameworks */, ); sourceTree = ""; }; @@ -130,13 +130,11 @@ isa = PBXNativeTarget; buildConfigurationList = E92069C51CFC3D210025DBC8 /* Build configuration list for PBXNativeTarget "GraphsExample" */; buildPhases = ( - 238EE3CEB76B45FE11A50757 /* [CP] Check Pods Manifest.lock */, + 65C4C7FE5F71C5549E3AAC37 /* [CP] Check Pods Manifest.lock */, E92069A41CFC3D200025DBC8 /* Sources */, E92069A51CFC3D200025DBC8 /* Frameworks */, E92069A61CFC3D200025DBC8 /* Resources */, - 757FB9C9151E3B788984CFB0 /* [CP] Embed Pods Frameworks */, - 17985833460BB9F83DF0E125 /* [CP] Copy Pods Resources */, - 406E61D919A0A9E11D6F2F3E /* Embed Pods Frameworks */, + 94B11597A60E31C8C2A3F286 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -172,12 +170,11 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = "Recruit Holdings Co., Ltd."; TargetAttributes = { E92069A71CFC3D200025DBC8 = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = RT4NRJPHW3; LastSwiftMigration = 0800; }; E92069BB1CFC3D200025DBC8 = { @@ -228,60 +225,36 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 17985833460BB9F83DF0E125 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 238EE3CEB76B45FE11A50757 /* [CP] Check Pods Manifest.lock */ = { + 65C4C7FE5F71C5549E3AAC37 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-GraphsExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 406E61D919A0A9E11D6F2F3E /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 757FB9C9151E3B788984CFB0 /* [CP] Embed Pods Frameworks */ = { + 94B11597A60E31C8C2A3F286 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-GraphsExample/Pods-GraphsExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Graphs/Graphs.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Graphs.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -348,14 +321,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; @@ -396,14 +377,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; @@ -431,11 +420,11 @@ }; E92069C61CFC3D210025DBC8 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4227E7448AC62671208299D7 /* Pods-GraphsExample.debug.xcconfig */; + baseConfigurationReference = 465F0ABDDEF4C02C753CE97A /* Pods-GraphsExample.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = RT4NRJPHW3; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -447,11 +436,11 @@ }; E92069C71CFC3D210025DBC8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 648833EF53F9A4F7C44598BB /* Pods-GraphsExample.release.xcconfig */; + baseConfigurationReference = EE1A0FF102CF6F40687D38D2 /* Pods-GraphsExample.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = RT4NRJPHW3; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/GraphsExample/Podfile.lock b/GraphsExample/Podfile.lock index e9c3ef5..fac2e6c 100644 --- a/GraphsExample/Podfile.lock +++ b/GraphsExample/Podfile.lock @@ -6,9 +6,11 @@ DEPENDENCIES: EXTERNAL SOURCES: Graphs: - :path: .. + :path: ".." SPEC CHECKSUMS: - Graphs: 08e8c2ee01dc13c96222dfd92ccb018d14748f4c + Graphs: 20ab93a2d97bc48e885d98ca08ceee9b9323fc26 -COCOAPODS: 0.39.0 +PODFILE CHECKSUM: 44a93f406ae068a7c552ed78b7f4276e3e8546e0 + +COCOAPODS: 1.5.3 From de89cd9f6f2a2a887121d578beef4dbef67330d1 Mon Sep 17 00:00:00 2001 From: Nash Gadre Date: Mon, 25 Jun 2018 13:01:15 -0400 Subject: [PATCH 6/6] update and remove some package names --- GraphsExample/GraphsExample.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj index e65f4ad..955216c 100644 --- a/GraphsExample/GraphsExample.xcodeproj/project.pbxproj +++ b/GraphsExample/GraphsExample.xcodeproj/project.pbxproj @@ -428,7 +428,7 @@ INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExample; + PRODUCT_BUNDLE_IDENTIFIER = come.example.GraphsExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; @@ -444,7 +444,7 @@ INFOPLIST_FILE = GraphsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = jp.co.recruit.mtl.GraphsExample; + PRODUCT_BUNDLE_IDENTIFIER = come.example.GraphsExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; };