diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4c3e68b..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.mode1v3
-*.pbxuser
-*.perspectivev3
-*.xcworkspace
-xcuserdata
diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift
index edec3ac..b0214b4 100644
--- a/Example/AppDelegate.swift
+++ b/Example/AppDelegate.swift
@@ -1,8 +1,8 @@
//
// AppDelegate.swift
-// GradientView
+// Gradient View
//
-// Created by Sam Soffes on 7/19/14.
+// Created by Sam Soffes on 11/26/14.
// Copyright (c) 2014 Sam Soffes. All rights reserved.
//
@@ -10,37 +10,5 @@ import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
-
- var window: UIWindow?
-
-
- func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
- // Override point for customization after application launch.
- return true
- }
-
- 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!) {
- // 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!) {
- // 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!) {
- // 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!) {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- }
-
-
+ @IBOutlet var window: UIWindow!
}
-
diff --git a/Example/Base.lproj/LaunchScreen.xib b/Example/Base.lproj/LaunchScreen.xib
new file mode 100644
index 0000000..30ea75a
--- /dev/null
+++ b/Example/Base.lproj/LaunchScreen.xib
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Example/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard
index 9bc32be..bb1153f 100644
--- a/Example/Base.lproj/Main.storyboard
+++ b/Example/Base.lproj/Main.storyboard
@@ -1,31 +1,31 @@
-
+
-
+
-
+
-
+
-
-
+
+
-
+
diff --git a/Example/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/Images.xcassets/AppIcon.appiconset/Contents.json
index 91bf9c1..36d2c80 100644
--- a/Example/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/Example/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -5,16 +5,31 @@
"size" : "29x29",
"scale" : "2x"
},
+ {
+ "idiom" : "iphone",
+ "size" : "29x29",
+ "scale" : "3x"
+ },
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
+ {
+ "idiom" : "iphone",
+ "size" : "40x40",
+ "scale" : "3x"
+ },
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
+ {
+ "idiom" : "iphone",
+ "size" : "60x60",
+ "scale" : "3x"
+ },
{
"idiom" : "ipad",
"size" : "29x29",
diff --git a/Example/Images.xcassets/LaunchImage.launchimage/Contents.json b/Example/Images.xcassets/LaunchImage.launchimage/Contents.json
deleted file mode 100644
index 6f870a4..0000000
--- a/Example/Images.xcassets/LaunchImage.launchimage/Contents.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "images" : [
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "subtype" : "retina4",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "1x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "1x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/Example/Info.plist b/Example/Info.plist
index 9b91371..3ce17f6 100644
--- a/Example/Info.plist
+++ b/Example/Info.plist
@@ -5,13 +5,13 @@
CFBundleDevelopmentRegion
en
CFBundleExecutable
- ${EXECUTABLE_NAME}
+ $(EXECUTABLE_NAME)
CFBundleIdentifier
- com.samsoffes.${PRODUCT_NAME:rfc1034identifier}
+ com.samsoffes.gradient-view.example
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- ${PRODUCT_NAME}
+ $(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
@@ -22,11 +22,26 @@
1
LSRequiresIPhoneOS
+ UILaunchStoryboardName
+ LaunchScreen
UIMainStoryboardFile
Main
UIRequiredDeviceCapabilities
armv7
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
diff --git a/Example/ViewController.swift b/Example/ViewController.swift
index 1926b72..0461fc9 100644
--- a/Example/ViewController.swift
+++ b/Example/ViewController.swift
@@ -7,6 +7,7 @@
//
import UIKit
+import GradientView
class ViewController: UIViewController {
diff --git a/Gradient View.xcodeproj/project.pbxproj b/Gradient View.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..1b339d4
--- /dev/null
+++ b/Gradient View.xcodeproj/project.pbxproj
@@ -0,0 +1,469 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 2163B9FC1A25FBF000610B0C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163B9FB1A25FBF000610B0C /* AppDelegate.swift */; };
+ 2163B9FE1A25FBF000610B0C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2163B9FD1A25FBF000610B0C /* ViewController.swift */; };
+ 2163BA011A25FBF000610B0C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2163B9FF1A25FBF000610B0C /* Main.storyboard */; };
+ 2163BA031A25FBF000610B0C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2163BA021A25FBF000610B0C /* Images.xcassets */; };
+ 2163BA061A25FBF000610B0C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2163BA041A25FBF000610B0C /* LaunchScreen.xib */; };
+ 2163BA251A25FBFD00610B0C /* GradientView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2163BA241A25FBFD00610B0C /* GradientView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 2163BA371A25FBFD00610B0C /* GradientView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2163BA201A25FBFD00610B0C /* GradientView.framework */; };
+ 2163BA381A25FBFD00610B0C /* GradientView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2163BA201A25FBFD00610B0C /* GradientView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 21AF9C3E1A25FC210086CB01 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21AF9C3D1A25FC210086CB01 /* GradientView.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 2163BA351A25FBFD00610B0C /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 2163B9EE1A25FBF000610B0C /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 2163BA1F1A25FBFD00610B0C;
+ remoteInfo = GradientView;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 2163BA3C1A25FBFD00610B0C /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 2163BA381A25FBFD00610B0C /* GradientView.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 2163B9F61A25FBF000610B0C /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2163B9FA1A25FBF000610B0C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 2163B9FB1A25FBF000610B0C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 2163B9FD1A25FBF000610B0C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
+ 2163BA001A25FBF000610B0C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 2163BA021A25FBF000610B0C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
+ 2163BA051A25FBF000610B0C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
+ 2163BA201A25FBFD00610B0C /* GradientView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GradientView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2163BA231A25FBFD00610B0C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 2163BA241A25FBFD00610B0C /* GradientView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GradientView.h; sourceTree = ""; };
+ 21AF9C3D1A25FC210086CB01 /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 2163B9F31A25FBF000610B0C /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2163BA371A25FBFD00610B0C /* GradientView.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2163BA1C1A25FBFD00610B0C /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 2163B9ED1A25FBF000610B0C = {
+ isa = PBXGroup;
+ children = (
+ 2163B9F81A25FBF000610B0C /* Example */,
+ 2163BA211A25FBFD00610B0C /* GradientView */,
+ 2163B9F71A25FBF000610B0C /* Products */,
+ );
+ sourceTree = "";
+ };
+ 2163B9F71A25FBF000610B0C /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 2163B9F61A25FBF000610B0C /* Example.app */,
+ 2163BA201A25FBFD00610B0C /* GradientView.framework */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 2163B9F81A25FBF000610B0C /* Example */ = {
+ isa = PBXGroup;
+ children = (
+ 2163B9FB1A25FBF000610B0C /* AppDelegate.swift */,
+ 2163B9FD1A25FBF000610B0C /* ViewController.swift */,
+ 2163B9FF1A25FBF000610B0C /* Main.storyboard */,
+ 2163BA021A25FBF000610B0C /* Images.xcassets */,
+ 2163BA041A25FBF000610B0C /* LaunchScreen.xib */,
+ 2163B9F91A25FBF000610B0C /* Supporting Files */,
+ );
+ path = Example;
+ sourceTree = "";
+ };
+ 2163B9F91A25FBF000610B0C /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 2163B9FA1A25FBF000610B0C /* Info.plist */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+ 2163BA211A25FBFD00610B0C /* GradientView */ = {
+ isa = PBXGroup;
+ children = (
+ 2163BA241A25FBFD00610B0C /* GradientView.h */,
+ 21AF9C3D1A25FC210086CB01 /* GradientView.swift */,
+ 2163BA221A25FBFD00610B0C /* Supporting Files */,
+ );
+ path = GradientView;
+ sourceTree = "";
+ };
+ 2163BA221A25FBFD00610B0C /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 2163BA231A25FBFD00610B0C /* Info.plist */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 2163BA1D1A25FBFD00610B0C /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2163BA251A25FBFD00610B0C /* GradientView.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 2163B9F51A25FBF000610B0C /* Example */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2163BA151A25FBF000610B0C /* Build configuration list for PBXNativeTarget "Example" */;
+ buildPhases = (
+ 2163B9F21A25FBF000610B0C /* Sources */,
+ 2163B9F31A25FBF000610B0C /* Frameworks */,
+ 2163B9F41A25FBF000610B0C /* Resources */,
+ 2163BA3C1A25FBFD00610B0C /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 2163BA361A25FBFD00610B0C /* PBXTargetDependency */,
+ );
+ name = Example;
+ productName = Example;
+ productReference = 2163B9F61A25FBF000610B0C /* Example.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 2163BA1F1A25FBFD00610B0C /* GradientView */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2163BA391A25FBFD00610B0C /* Build configuration list for PBXNativeTarget "GradientView" */;
+ buildPhases = (
+ 2163BA1B1A25FBFD00610B0C /* Sources */,
+ 2163BA1C1A25FBFD00610B0C /* Frameworks */,
+ 2163BA1D1A25FBFD00610B0C /* Headers */,
+ 2163BA1E1A25FBFD00610B0C /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = GradientView;
+ productName = GradientView;
+ productReference = 2163BA201A25FBFD00610B0C /* GradientView.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 2163B9EE1A25FBF000610B0C /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0610;
+ ORGANIZATIONNAME = "Sam Soffes";
+ TargetAttributes = {
+ 2163B9F51A25FBF000610B0C = {
+ CreatedOnToolsVersion = 6.1;
+ };
+ 2163BA1F1A25FBFD00610B0C = {
+ CreatedOnToolsVersion = 6.1;
+ };
+ };
+ };
+ buildConfigurationList = 2163B9F11A25FBF000610B0C /* Build configuration list for PBXProject "Gradient View" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 2163B9ED1A25FBF000610B0C;
+ productRefGroup = 2163B9F71A25FBF000610B0C /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 2163B9F51A25FBF000610B0C /* Example */,
+ 2163BA1F1A25FBFD00610B0C /* GradientView */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 2163B9F41A25FBF000610B0C /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2163BA011A25FBF000610B0C /* Main.storyboard in Resources */,
+ 2163BA061A25FBF000610B0C /* LaunchScreen.xib in Resources */,
+ 2163BA031A25FBF000610B0C /* Images.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2163BA1E1A25FBFD00610B0C /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 2163B9F21A25FBF000610B0C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2163B9FE1A25FBF000610B0C /* ViewController.swift in Sources */,
+ 2163B9FC1A25FBF000610B0C /* AppDelegate.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2163BA1B1A25FBFD00610B0C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 21AF9C3E1A25FC210086CB01 /* GradientView.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 2163BA361A25FBFD00610B0C /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 2163BA1F1A25FBFD00610B0C /* GradientView */;
+ targetProxy = 2163BA351A25FBFD00610B0C /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 2163B9FF1A25FBF000610B0C /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 2163BA001A25FBF000610B0C /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 2163BA041A25FBF000610B0C /* LaunchScreen.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 2163BA051A25FBF000610B0C /* Base */,
+ );
+ name = LaunchScreen.xib;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 2163BA131A25FBF000610B0C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = 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_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 2163BA141A25FBF000610B0C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = 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_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 2163BA161A25FBF000610B0C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Example/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 2163BA171A25FBF000610B0C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = Example/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+ 2163BA3A1A25FBFD00610B0C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = 8;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 8;
+ DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ INFOPLIST_FILE = GradientView/Info.plist;
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MODULE_NAME = "com.samsoffes.gradient-view";
+ MODULE_VERSION = "$(CURRENT_PROJECT_VERSION)";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+ 2163BA3B1A25FBFD00610B0C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = 8;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 8;
+ DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ INFOPLIST_FILE = GradientView/Info.plist;
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MODULE_NAME = "com.samsoffes.gradient-view";
+ MODULE_VERSION = "$(CURRENT_PROJECT_VERSION)";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 2163B9F11A25FBF000610B0C /* Build configuration list for PBXProject "Gradient View" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2163BA131A25FBF000610B0C /* Debug */,
+ 2163BA141A25FBF000610B0C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 2163BA151A25FBF000610B0C /* Build configuration list for PBXNativeTarget "Example" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2163BA161A25FBF000610B0C /* Debug */,
+ 2163BA171A25FBF000610B0C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 2163BA391A25FBFD00610B0C /* Build configuration list for PBXNativeTarget "GradientView" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2163BA3A1A25FBFD00610B0C /* Debug */,
+ 2163BA3B1A25FBFD00610B0C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 2163B9EE1A25FBF000610B0C /* Project object */;
+}
diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
new file mode 100644
index 0000000..5345661
--- /dev/null
+++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView.xcscheme
new file mode 100644
index 0000000..21175f4
--- /dev/null
+++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView.xcscheme
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GradientView.xcodeproj/project.pbxproj b/GradientView.xcodeproj/project.pbxproj
deleted file mode 100644
index 2f0565a..0000000
--- a/GradientView.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,282 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 21E5C1B4197AD7F100499002 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E5C1AE197AD7F100499002 /* AppDelegate.swift */; };
- 21E5C1B5197AD7F100499002 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21E5C1AF197AD7F100499002 /* Main.storyboard */; };
- 21E5C1B6197AD7F100499002 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 21E5C1B1197AD7F100499002 /* Images.xcassets */; };
- 21E5C1B8197AD7F100499002 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E5C1B3197AD7F100499002 /* ViewController.swift */; };
- 21E5C1BF197AD7FA00499002 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21E5C1BE197AD7FA00499002 /* GradientView.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 21E5C18B197AD72A00499002 /* GradientView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GradientView.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 21E5C1AE197AD7F100499002 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
- 21E5C1B0197AD7F100499002 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
- 21E5C1B1197AD7F100499002 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
- 21E5C1B2197AD7F100499002 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 21E5C1B3197AD7F100499002 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
- 21E5C1BE197AD7FA00499002 /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 21E5C188197AD72A00499002 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 21E5C182197AD72A00499002 = {
- isa = PBXGroup;
- children = (
- 21E5C1BE197AD7FA00499002 /* GradientView.swift */,
- 21E5C1AD197AD7F100499002 /* Example */,
- 21E5C18C197AD72A00499002 /* Products */,
- );
- sourceTree = "";
- usesTabs = 1;
- };
- 21E5C18C197AD72A00499002 /* Products */ = {
- isa = PBXGroup;
- children = (
- 21E5C18B197AD72A00499002 /* GradientView.app */,
- );
- name = Products;
- sourceTree = "";
- };
- 21E5C1AD197AD7F100499002 /* Example */ = {
- isa = PBXGroup;
- children = (
- 21E5C1AE197AD7F100499002 /* AppDelegate.swift */,
- 21E5C1B3197AD7F100499002 /* ViewController.swift */,
- 21E5C1AF197AD7F100499002 /* Main.storyboard */,
- 21E5C1B1197AD7F100499002 /* Images.xcassets */,
- 21E5C1B2197AD7F100499002 /* Info.plist */,
- );
- path = Example;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 21E5C18A197AD72A00499002 /* GradientView */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 21E5C1A7197AD72A00499002 /* Build configuration list for PBXNativeTarget "GradientView" */;
- buildPhases = (
- 21E5C187197AD72A00499002 /* Sources */,
- 21E5C188197AD72A00499002 /* Frameworks */,
- 21E5C189197AD72A00499002 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = GradientView;
- productName = GradientView;
- productReference = 21E5C18B197AD72A00499002 /* GradientView.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 21E5C183197AD72A00499002 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0600;
- ORGANIZATIONNAME = "Sam Soffes";
- TargetAttributes = {
- 21E5C18A197AD72A00499002 = {
- CreatedOnToolsVersion = 6.0;
- };
- };
- };
- buildConfigurationList = 21E5C186197AD72A00499002 /* Build configuration list for PBXProject "GradientView" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 21E5C182197AD72A00499002;
- productRefGroup = 21E5C18C197AD72A00499002 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 21E5C18A197AD72A00499002 /* GradientView */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 21E5C189197AD72A00499002 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 21E5C1B5197AD7F100499002 /* Main.storyboard in Resources */,
- 21E5C1B6197AD7F100499002 /* Images.xcassets in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 21E5C187197AD72A00499002 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 21E5C1B8197AD7F100499002 /* ViewController.swift in Sources */,
- 21E5C1B4197AD7F100499002 /* AppDelegate.swift in Sources */,
- 21E5C1BF197AD7FA00499002 /* GradientView.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
- 21E5C1AF197AD7F100499002 /* Main.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- 21E5C1B0197AD7F100499002 /* Base */,
- );
- name = Main.storyboard;
- sourceTree = "";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- 21E5C1A5197AD72A00499002 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = 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_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 21E5C1A6197AD72A00499002 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = 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_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = YES;
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- VALIDATE_PRODUCT = YES;
- };
- name = Release;
- };
- 21E5C1A8197AD72A00499002 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
- INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Debug;
- };
- 21E5C1A9197AD72A00499002 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
- INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 21E5C186197AD72A00499002 /* Build configuration list for PBXProject "GradientView" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 21E5C1A5197AD72A00499002 /* Debug */,
- 21E5C1A6197AD72A00499002 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 21E5C1A7197AD72A00499002 /* Build configuration list for PBXNativeTarget "GradientView" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 21E5C1A8197AD72A00499002 /* Debug */,
- 21E5C1A9197AD72A00499002 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 21E5C183197AD72A00499002 /* Project object */;
-}
diff --git a/GradientView/GradientView.h b/GradientView/GradientView.h
new file mode 100644
index 0000000..175cf1a
--- /dev/null
+++ b/GradientView/GradientView.h
@@ -0,0 +1,15 @@
+//
+// GradientView.h
+// GradientView
+//
+// Created by Sam Soffes on 11/26/14.
+// Copyright (c) 2014 Sam Soffes. All rights reserved.
+//
+
+@import Foundation;
+
+//! Project version number for GradientView.
+FOUNDATION_EXPORT double GradientViewVersionNumber;
+
+//! Project version string for GradientView.
+FOUNDATION_EXPORT const unsigned char GradientViewVersionString[];
diff --git a/GradientView.swift b/GradientView/GradientView.swift
similarity index 85%
rename from GradientView.swift
rename to GradientView/GradientView.swift
index 0eda928..dadb5c2 100644
--- a/GradientView.swift
+++ b/GradientView/GradientView.swift
@@ -2,135 +2,135 @@
// GradientView.swift
// Gradient View
//
-// Created by Sam Soffes on 7/19/14.
-// Copyright (c) 2014 Sam Soffes. All rights reserved.
+// Created by Sam Soffes on 10/27/09.
+// Copyright (c) 2009-2014 Sam Soffes. All rights reserved.
//
import UIKit
/// Simple view for drawing gradients and borders.
-class GradientView: UIView {
-
+public class GradientView: UIView {
+
// MARK: - Types
-
+
/// The mode of the gradient.
- enum Type {
+ public enum Type {
/// A linear gradient.
case Linear
-
+
/// A radial gradient.
case Radial
}
-
-
+
+
/// The direction of the gradient.
- enum Direction {
+ public enum Direction {
/// The gradient is vertical.
case Vertical
-
+
/// The gradient is horizontal
case Horizontal
}
-
-
+
+
// MARK: - Properties
-
+
/// An optional array of `UIColor` objects used to draw the gradient. If the value is `nil`, the `backgroundColor`
/// will be drawn instead of a gradient. The default is `nil`.
- var colors: [UIColor]? {
+ public var colors: [UIColor]? {
didSet {
updateGradient()
}
}
-
+
/// An array of `UIColor` objects used to draw the dimmed gradient. If the value is `nil`, `colors` will be
/// converted to grayscale. This will use the same `locations` as `colors`. If length of arrays don't match, bad
/// things will happen. You must make sure the number of dimmed colors equals the number of regular colors.
///
/// The default is `nil`.
- var dimmedColors: [UIColor]? {
+ public var dimmedColors: [UIColor]? {
didSet {
updateGradient()
}
}
-
+
/// Automatically dim gradient colors when prompted by the system (i.e. when an alert is shown).
///
/// The default is `true`.
- var automaticallyDims: Bool = true
-
+ public var automaticallyDims: Bool = true
+
/// An optional array of `CGFloat`s defining the location of each gradient stop.
///
/// The gradient stops are specified as values between `0` and `1`. The values must be monotonically increasing. If
/// `nil`, the stops are spread uniformly across the range.
///
/// Defaults to `nil`.
- var locations: [CGFloat]? {
+ public var locations: [CGFloat]? {
didSet {
updateGradient()
}
}
-
+
/// The mode of the gradient. The default is `.Linear`.
- var mode: Type = .Linear {
+ public var mode: Type = .Linear {
didSet {
setNeedsDisplay()
}
}
-
+
/// The direction of the gradient. Only valid for the `Mode.Linear` mode. The default is `.Vertical`.
- var direction: Direction = .Vertical {
+ public var direction: Direction = .Vertical {
didSet {
setNeedsDisplay()
}
}
-
+
/// 1px borders will be drawn instead of 1pt borders. The default is `true`.
- var drawsThinBorders: Bool = true {
+ public var drawsThinBorders: Bool = true {
didSet {
setNeedsDisplay()
}
}
-
+
/// The top border color. The default is `nil`.
- var topBorderColor: UIColor? {
+ public var topBorderColor: UIColor? {
didSet {
setNeedsDisplay()
}
}
-
+
/// The right border color. The default is `nil`.
- var rightBorderColor: UIColor? {
+ public var rightBorderColor: UIColor? {
didSet {
setNeedsDisplay()
}
}
-
+
/// The bottom border color. The default is `nil`.
- var bottomBorderColor: UIColor? {
+ public var bottomBorderColor: UIColor? {
didSet {
setNeedsDisplay()
}
}
-
+
/// The left border color. The default is `nil`.
- var leftBorderColor: UIColor? {
+ public var leftBorderColor: UIColor? {
didSet {
setNeedsDisplay()
}
}
-
-
+
+
// MARK: - UIView
-
- override func drawRect(rect: CGRect) {
+
+ override public func drawRect(rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
let size = bounds.size
-
+
// Gradient
if let gradient = gradient {
let options = CGGradientDrawingOptions(kCGGradientDrawsAfterEndLocation)
-
+
if mode == .Linear {
let startPoint = CGPointZero
let endPoint = direction == .Vertical ? CGPoint(x: 0, y: size.height) : CGPoint(x: size.width, y: 0)
@@ -140,69 +140,69 @@ class GradientView: UIView {
CGContextDrawRadialGradient(context, gradient, center, 0, center, min(size.width, size.height) / 2, options)
}
}
-
+
let screen: UIScreen = window?.screen ?? UIScreen.mainScreen()
let borderWidth: CGFloat = drawsThinBorders ? 1.0 / screen.scale : 1.0
-
+
// Top border
if let color = topBorderColor {
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, CGRect(x: 0, y: 0, width: size.width, height: borderWidth))
}
-
+
let sideY: CGFloat = topBorderColor != nil ? borderWidth : 0
let sideHeight: CGFloat = size.height - sideY - (bottomBorderColor != nil ? borderWidth : 0)
-
+
// Right border
if let color = rightBorderColor {
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, CGRect(x: size.width - borderWidth, y: sideY, width: borderWidth, height: sideHeight))
}
-
+
// Bottom border
if let color = bottomBorderColor {
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, CGRect(x: 0, y: size.height - borderWidth, width: size.width, height: borderWidth))
}
-
+
// Left border
if let color = leftBorderColor {
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, CGRect(x: 0, y: sideY, width: borderWidth, height: sideHeight))
}
}
-
- override func tintColorDidChange() {
+
+ override public func tintColorDidChange() {
super.tintColorDidChange()
-
+
if automaticallyDims {
updateGradient()
}
}
-
- override func didMoveToWindow() {
+
+ override public func didMoveToWindow() {
super.didMoveToWindow()
contentMode = .Redraw
}
-
-
+
+
// MARK: - Private
-
- var gradient: CGGradientRef?
-
- func updateGradient() {
+
+ private var gradient: CGGradientRef?
+
+ private func updateGradient() {
gradient = nil
setNeedsDisplay()
-
+
let colors = gradientColors()
if let colors = colors {
let colorSpace = CGColorGetColorSpace(colors[0].CGColor)
-
+
// TODO: This is ugly. Surely there is a way to make this more concise.
let gradientColors: NSArray = colors.map { (color: UIColor) -> AnyObject! in
return color.CGColor as AnyObject!
}
-
+
// TODO: This is ugly. Surely there is a way to make this more concise.
if let locations = locations {
gradient = CGGradientCreateWithColors(colorSpace, gradientColors, locations)
@@ -211,28 +211,28 @@ class GradientView: UIView {
}
}
}
-
- func gradientColors() -> [UIColor]? {
+
+ private func gradientColors() -> [UIColor]? {
if tintAdjustmentMode == .Dimmed {
if let dimmedColors = dimmedColors {
return dimmedColors
}
-
+
if automaticallyDims {
if let colors = colors {
return colors.map {
var hue: CGFloat = 0
var brightness: CGFloat = 0
var alpha: CGFloat = 0
-
+
$0.getHue(&hue, saturation: nil, brightness: &brightness, alpha: &alpha)
-
+
return UIColor(hue: hue, saturation: 0, brightness: brightness, alpha: alpha)
}
}
}
}
-
+
return colors
}
}
diff --git a/GradientView/Info.plist b/GradientView/Info.plist
new file mode 100644
index 0000000..60f5c64
--- /dev/null
+++ b/GradientView/Info.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ com.samsoffes.gradient-view
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 2.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(CURRENT_PROJECT_VERSION)
+ NSPrincipalClass
+
+
+
diff --git a/Readme.markdown b/Readme.markdown
index 03e792e..fc2c117 100644
--- a/Readme.markdown
+++ b/Readme.markdown
@@ -1,8 +1,8 @@
-# GradientView
+# Gradient View
-Easily use gradients in UIKit. GradientView is a simple UIView wrapper around CGGradient.
+Easily use gradients in UIKit. Gradient View is a simple UIView wrapper around CGGradient.
-GradientView is tested on iOS 7-8 and requires ARC. Released under the [MIT license](LICENSE).
+Gradient View is tested on iOS 8. Released under the [MIT license](LICENSE).
## Usage
@@ -40,4 +40,4 @@ Open up the included Xcode project for an example app.
## Installation
-Simply add the files in the `GradientView.swift` to your project.
+Simply add the files in the to your project. Gradient View also supports installation with [Carthage](https://github.com/Carthage/Carthage).