From 0b165d9acf9b81ad44f565fce0946def7df7187d Mon Sep 17 00:00:00 2001 From: Justin Heo Date: Wed, 27 Jan 2016 00:50:47 -0800 Subject: [PATCH] Convenience init for RippleView --- Minamo.xcodeproj/project.pbxproj | 8 +------- Minamo/RippleView.swift | 8 +++++++- MinamoExample/Base.lproj/LaunchScreen.storyboard | 5 ++--- MinamoExample/Base.lproj/Main.storyboard | 6 ++---- MinamoExample/ViewController.swift | 4 +--- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Minamo.xcodeproj/project.pbxproj b/Minamo.xcodeproj/project.pbxproj index 5c81b03..c44993d 100644 --- a/Minamo.xcodeproj/project.pbxproj +++ b/Minamo.xcodeproj/project.pbxproj @@ -8,16 +8,13 @@ /* Begin PBXBuildFile section */ 4622B5301C5111BF00DBE9E5 /* Minamo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4622B5251C5111BF00DBE9E5 /* Minamo.framework */; }; - 46C6CDCF1C55BD4600FB146D /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDCC1C55BD4600FB146D /* Info.plist */; }; 46C6CDD01C55BD4600FB146D /* RippleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C6CDCD1C55BD4600FB146D /* RippleView.swift */; }; 46C6CDDA1C55BD5100FB146D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C6CDD21C55BD5100FB146D /* AppDelegate.swift */; }; 46C6CDDB1C55BD5100FB146D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDD31C55BD5100FB146D /* Assets.xcassets */; }; 46C6CDDC1C55BD5100FB146D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDD41C55BD5100FB146D /* LaunchScreen.storyboard */; }; 46C6CDDD1C55BD5100FB146D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDD61C55BD5100FB146D /* Main.storyboard */; }; - 46C6CDDE1C55BD5100FB146D /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDD81C55BD5100FB146D /* Info.plist */; }; 46C6CDDF1C55BD5100FB146D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C6CDD91C55BD5100FB146D /* ViewController.swift */; }; 46C6CDE31C55BD6200FB146D /* MinamoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C6CDE11C55BD6200FB146D /* MinamoTests.swift */; }; - 46C6CDE41C55BD6200FB146D /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 46C6CDE21C55BD6200FB146D /* Info.plist */; }; 46C6CDE51C55BD6800FB146D /* RippleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C6CDCD1C55BD4600FB146D /* RippleView.swift */; }; /* End PBXBuildFile section */ @@ -197,7 +194,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0720; ORGANIZATIONNAME = yukiasai; TargetAttributes = { 4622B5241C5111BF00DBE9E5 = { @@ -236,7 +233,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 46C6CDCF1C55BD4600FB146D /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,7 +240,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 46C6CDE41C55BD6200FB146D /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -252,7 +247,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 46C6CDDE1C55BD5100FB146D /* Info.plist in Resources */, 46C6CDDD1C55BD5100FB146D /* Main.storyboard in Resources */, 46C6CDDB1C55BD5100FB146D /* Assets.xcassets in Resources */, 46C6CDDC1C55BD5100FB146D /* LaunchScreen.storyboard in Resources */, diff --git a/Minamo/RippleView.swift b/Minamo/RippleView.swift index 80a2bff..7ebbcaa 100644 --- a/Minamo/RippleView.swift +++ b/Minamo/RippleView.swift @@ -32,7 +32,13 @@ public class RippleView: UIView { public var coreImage: UIImage? { didSet { imageView.image = coreImage } } - + + convenience init(image: UIImage?, tintColor: UIColor = UIColor(red: 0.3, green: 0.7, blue: 1, alpha: 1)) { + self.init() + imageView.image = image + self.tintColor = tintColor + } + init() { super.init(frame: CGRectZero) commonInit() diff --git a/MinamoExample/Base.lproj/LaunchScreen.storyboard b/MinamoExample/Base.lproj/LaunchScreen.storyboard index d6f2932..78686cd 100644 --- a/MinamoExample/Base.lproj/LaunchScreen.storyboard +++ b/MinamoExample/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,8 @@ - + - + @@ -16,7 +16,6 @@ - diff --git a/MinamoExample/Base.lproj/Main.storyboard b/MinamoExample/Base.lproj/Main.storyboard index 582b091..c305ffc 100644 --- a/MinamoExample/Base.lproj/Main.storyboard +++ b/MinamoExample/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -14,7 +14,6 @@ - @@ -58,7 +57,6 @@ written in Swift. - diff --git a/MinamoExample/ViewController.swift b/MinamoExample/ViewController.swift index b0d282b..b9e201f 100644 --- a/MinamoExample/ViewController.swift +++ b/MinamoExample/ViewController.swift @@ -11,9 +11,7 @@ import UIKit class ViewController: UIViewController { let rippleView = { Void -> RippleView in - let view = RippleView() - view.tintColor = UIColor(red: 0.3, green: 0.7, blue: 1, alpha: 1) - view.coreImage = UIImage(named: "q") + let view = RippleView(image: UIImage(named: "q"), tintColor: UIColor(red: 0.3, green: 0.7, blue: 1, alpha: 1)) return view }()