├── .gitignore ├── Assets ├── GitBanner.png ├── Step0a.png ├── Step0b.png ├── Step1a.png ├── Step1b.png ├── Step2a.png ├── Step2b.png ├── Step2c.png ├── Step3a.png ├── Step3b.png ├── Step3c.png ├── Step4a.png ├── Step4b.png ├── Step4c.png ├── Step5a.png ├── Step5b.png └── Test.xcf ├── CHANGELOG.md ├── EZYGradientView.podspec ├── EZYGradientView └── EZYGradientView.swift ├── Example ├── Default-568h@2x.png ├── EZYGradientView.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── EZYGradientView │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Blogger_Sans.otf │ ├── Info.plist │ └── ViewController.swift ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /Assets/GitBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/GitBanner.png -------------------------------------------------------------------------------- /Assets/Step0a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step0a.png -------------------------------------------------------------------------------- /Assets/Step0b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step0b.png -------------------------------------------------------------------------------- /Assets/Step1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step1a.png -------------------------------------------------------------------------------- /Assets/Step1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step1b.png -------------------------------------------------------------------------------- /Assets/Step2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step2a.png -------------------------------------------------------------------------------- /Assets/Step2b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step2b.png -------------------------------------------------------------------------------- /Assets/Step2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step2c.png -------------------------------------------------------------------------------- /Assets/Step3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step3a.png -------------------------------------------------------------------------------- /Assets/Step3b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step3b.png -------------------------------------------------------------------------------- /Assets/Step3c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step3c.png -------------------------------------------------------------------------------- /Assets/Step4a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step4a.png -------------------------------------------------------------------------------- /Assets/Step4b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step4b.png -------------------------------------------------------------------------------- /Assets/Step4c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step4c.png -------------------------------------------------------------------------------- /Assets/Step5a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step5a.png -------------------------------------------------------------------------------- /Assets/Step5b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Step5b.png -------------------------------------------------------------------------------- /Assets/Test.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Assets/Test.xcf -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [1.5.1](https://github.com/shashankpali/EZYGradientView/releases/tag/1.5.1) 4 | Released on Friday, 19 Aug, 2016. 5 | 6 | #### Fixed 7 | *"blurLayer" property now shows color separation. 8 | 9 | ## [1.5](https://github.com/shashankpali/EZYGradientView/releases/tag/1.5) 10 | Released on Friday, 19 Aug, 2016. 11 | 12 | #### Update 13 | *Set "gradientLayer" and "blurLayer" properties to public properties. 14 | 15 | ## [1.4](https://github.com/shashankpali/EZYGradientView/releases/tag/1.4) 16 | Released on Tuesday, 2 Aug, 2016. 17 | 18 | #### Fixed 19 | * Issue #1 solved: Doesn't update on changing properties. 20 | 21 | ## [1.3.1](https://github.com/shashankpali/EZYGradientView/releases/tag/1.3.1) 22 | Released on Thursday, 28 Jul, 2016. 23 | 24 | #### Update 25 | * Documentation. 26 | 27 | ## [1.3](https://github.com/shashankpali/EZYGradientView/releases/tag/1.3) 28 | Released on Thursday, 28 Jul, 2016. 29 | 30 | #### Added 31 | * Blur property. 32 | * Objective C pod re-direct link. 33 | 34 | #### Removed 35 | * Objective C pod. 36 | 37 | #### Fixed 38 | * Storyboard/xib runtime error. 39 | 40 | ## [1.2](https://github.com/shashankpali/EZYGradientView/releases/tag/1.2) 41 | Released on Saturday, 23 Jul, 2016. 42 | 43 | #### Added 44 | * Added Objective C pod. 45 | 46 | #### Fixed 47 | * Fixed IBDesignable rendering bug. 48 | 49 | ## [1.1](https://github.com/shashankpali/EZYGradientView/releases/tag/1.1) 50 | Released on Saturday, 23 Jul, 2016. 51 | 52 | #### Added 53 | * Added change log. 54 | 55 | #### Updated 56 | * Updated documentation. 57 | 58 | ## [1.0](https://github.com/shashankpali/EZYGradientView/releases/tag/1.0) 59 | Released on Friday, 22 Jul, 2016. 60 | 61 | #### Added 62 | * Initial release. 63 | -------------------------------------------------------------------------------- /EZYGradientView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'EZYGradientView' 4 | s.version = '1.5.1' 5 | s.platform = :ios, '8.0' 6 | s.license = { :type => 'MIT' } 7 | s.homepage = 'https://github.com/shashankpali/EZYGradientView' 8 | s.authors = { 'Shashank Pali' => 'shank.pali@gmail.com' } 9 | s.summary = 'Create gradients and blur gradients without a single line of code' 10 | s.source = { :git => 'https://github.com/shashankpali/EZYGradientView.git', :tag => s.version } 11 | s.source_files = 'EZYGradientView/*.swift' 12 | s.requires_arc = true 13 | end -------------------------------------------------------------------------------- /EZYGradientView/EZYGradientView.swift: -------------------------------------------------------------------------------- 1 | // EZYGradientView.swift 2 | // 3 | // Copyright (c) 2016 Shashank Pali 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | import UIKit 24 | 25 | @IBDesignable 26 | 27 | open class EZYGradientView: UIView 28 | { 29 | 30 | //MARK:- Properties 31 | /// First color of gradient i.e. it appears on top when angleº set to 0.0. 32 | @IBInspectable open var firstColor: UIColor = UIColor.white 33 | { 34 | didSet 35 | { 36 | if gradientLayer != nil 37 | { 38 | self.updateColors() 39 | } 40 | } 41 | } 42 | 43 | /// Second color of gradient i.e. it appears in bottom when angleº set to 0.0. 44 | @IBInspectable open var secondColor: UIColor = UIColor.white 45 | { 46 | didSet 47 | { 48 | if gradientLayer != nil 49 | { 50 | self.updateColors() 51 | } 52 | } 53 | } 54 | 55 | /// Angleº will describe the tilt of gradient. 56 | @IBInspectable open var angleº: Float = 45.0 57 | { 58 | didSet 59 | { 60 | // handle negative angles 61 | if angleº < 0.0 { 62 | angleº = 360.0 + angleº 63 | } 64 | 65 | // offset of 45 is needed to make logic work 66 | angleº = angleº + 45 67 | 68 | let multiplier = Int(angleº / 360) 69 | if (multiplier > 0) 70 | { 71 | angleº = angleº - Float(360 * multiplier) 72 | } 73 | 74 | if gradientLayer != nil 75 | { 76 | self.updatePoints() 77 | } 78 | } 79 | } 80 | 81 | /// Color ratio will describe the proportion of colors. It's value ranges from 0.0 to 1.0 default is 0.5. 82 | @IBInspectable open var colorRatio: Float = 0.5 83 | { 84 | didSet 85 | { 86 | assert(colorRatio >= 0 || colorRatio <= 1, "Color Ratio: Valid range is from 0.0 to 1.0") 87 | if gradientLayer != nil 88 | { 89 | self.updateLocation() 90 | } 91 | } 92 | } 93 | 94 | /// Fade intensity will describe the disperse of colors. It's value ranges from 0.0 to 1.0 default is 0.0. 95 | @IBInspectable open var fadeIntensity: Float = 0.0 96 | { 97 | didSet 98 | { 99 | assert(colorRatio >= 0 || colorRatio <= 1, "Fade Intensity: Valid range is from 0.0 to 1.0") 100 | if gradientLayer != nil 101 | { 102 | self.updateLocation() 103 | } 104 | } 105 | } 106 | 107 | /// Is blur allow to add visual effect on gradient view. Can't be change during run-time. 108 | @IBInspectable open var isBlur: Bool = false 109 | { 110 | didSet 111 | { 112 | if gradientLayer != nil 113 | { 114 | self.checkBlurStatusAndUpdateOpacity() 115 | } 116 | } 117 | } 118 | /// Blur opacity will describe the transparency of blur. It's value ranges from 0.0 to 1.0 default is 0.0. It is suggested to set EZYGradientView background color as clear color for better results. 119 | @IBInspectable open var blurOpacity: Float = 0.0 120 | { 121 | didSet 122 | { 123 | assert(blurOpacity >= 0 || blurOpacity <= 1, "Blur Opacity: Valid range is from 0.0 to 1.0") 124 | if gradientLayer != nil 125 | { 126 | self.checkBlurStatusAndUpdateOpacity() 127 | } 128 | } 129 | } 130 | 131 | fileprivate var blurView: UIVisualEffectView? 132 | open var blurLayer: CALayer? 133 | open var gradientLayer: CAGradientLayer? 134 | 135 | //MARK:- Designated Initializer 136 | 137 | override init(frame: CGRect) 138 | { 139 | super.init(frame: frame) 140 | self.backgroundColor = UIColor.clear 141 | } 142 | 143 | public required init?(coder aDecoder: NSCoder) 144 | { 145 | super.init(coder: aDecoder) 146 | self.backgroundColor = UIColor.clear 147 | } 148 | 149 | //MARK:- Draw Rect with steps 150 | 151 | override open func draw(_ rect: CGRect) 152 | { 153 | if gradientLayer == nil 154 | { 155 | gradientLayer = CAGradientLayer() 156 | gradientLayer!.frame = self.bounds 157 | layer.insertSublayer(gradientLayer!, at: 0) 158 | } 159 | self.updateColors() 160 | self.updatePoints() 161 | self.updateLocation() 162 | self.checkBlurStatusAndUpdateOpacity() 163 | } 164 | /** 165 | Step 1 166 | */ 167 | fileprivate func updateColors() 168 | { 169 | gradientLayer!.colors = [firstColor.cgColor, secondColor.cgColor] 170 | } 171 | /** 172 | Step 2 173 | */ 174 | fileprivate func updatePoints() 175 | { 176 | let points = startEndPoints() 177 | gradientLayer!.startPoint = points.0 178 | gradientLayer!.endPoint = points.1 179 | } 180 | /** 181 | Step 3 182 | */ 183 | fileprivate func updateLocation() 184 | { 185 | let colorLoc = locations() 186 | gradientLayer!.locations = [NSNumber(value: colorLoc.0), NSNumber(value: colorLoc.1)] 187 | } 188 | /** 189 | Step 4 190 | */ 191 | fileprivate func checkBlurStatusAndUpdateOpacity() 192 | { 193 | if isBlur 194 | { 195 | if blurView == nil 196 | { 197 | let blurEffect = UIBlurEffect(style: .light) 198 | blurView = UIVisualEffectView(effect: blurEffect) 199 | blurView?.frame = self.bounds 200 | blurLayer = blurView?.layer 201 | } 202 | gradientLayer!.colors = [blurColor(firstColor), blurColor(secondColor)] 203 | self.layer.insertSublayer(blurLayer!, below: gradientLayer) 204 | } 205 | else 206 | { 207 | blurLayer?.removeFromSuperlayer() 208 | blurLayer = nil 209 | blurView = nil 210 | } 211 | } 212 | 213 | //MARK:- Helpers 214 | 215 | fileprivate func blurColor(_ color: UIColor) -> CGColor 216 | { 217 | return color.withAlphaComponent(CGFloat(0.9 - (blurOpacity / 2))).cgColor 218 | } 219 | 220 | fileprivate func startEndPoints() -> (CGPoint, CGPoint) 221 | { 222 | var rotCalX: Float = 0.0 223 | var rotCalY: Float = 0.0 224 | 225 | // to convert from 0...360 range to 0...4 226 | let rotate = angleº / 90 227 | 228 | // 1...4 can be understood to denote the four quadrants 229 | if rotate <= 1 230 | { 231 | rotCalY = rotate 232 | } 233 | else if rotate <= 2 234 | { 235 | rotCalY = 1 236 | rotCalX = rotate - 1 237 | } 238 | else if rotate <= 3 239 | { 240 | rotCalX = 1 241 | rotCalY = 1 - (rotate - 2) 242 | } 243 | else if rotate <= 4 244 | { 245 | rotCalX = 1 - (rotate - 3) 246 | } 247 | 248 | let start = CGPoint(x: 1 - CGFloat(rotCalY), y: 0 + CGFloat(rotCalX)) 249 | let end = CGPoint(x: 0 + CGFloat(rotCalY), y: 1 - CGFloat(rotCalX)) 250 | 251 | return (start, end) 252 | } 253 | 254 | fileprivate func locations() -> (Float, Float) 255 | { 256 | let divider = fadeIntensity / self.divider() 257 | return(colorRatio - divider, colorRatio + divider) 258 | } 259 | 260 | fileprivate func divider() -> Float 261 | { 262 | if colorRatio == 0.1 263 | { 264 | return 10 265 | } 266 | if colorRatio < 0.5 267 | { 268 | let value = 0.5 - colorRatio + 0.5 269 | return 1 / (1 - value) 270 | } 271 | return 1 / (1 - colorRatio) 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /Example/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Example/Default-568h@2x.png -------------------------------------------------------------------------------- /Example/EZYGradientView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6BFF40641D42436E008EF94E /* Blogger_Sans.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6BFF40631D42436E008EF94E /* Blogger_Sans.otf */; }; 11 | 6CA663231D439C8F00AE785E /* EZYGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA663221D439C8F00AE785E /* EZYGradientView.swift */; }; 12 | 6CFA1AA61D40F2FF00AB04AC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFA1AA51D40F2FF00AB04AC /* AppDelegate.swift */; }; 13 | 6CFA1AA81D40F2FF00AB04AC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFA1AA71D40F2FF00AB04AC /* ViewController.swift */; }; 14 | 6CFA1AAB1D40F2FF00AB04AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CFA1AA91D40F2FF00AB04AC /* Main.storyboard */; }; 15 | 6CFA1AAD1D40F2FF00AB04AC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6CFA1AAC1D40F2FF00AB04AC /* Assets.xcassets */; }; 16 | 6CFA1AB01D40F2FF00AB04AC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CFA1AAE1D40F2FF00AB04AC /* LaunchScreen.storyboard */; }; 17 | 84F945C82381989400A9B921 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84F945C72381989400A9B921 /* Default-568h@2x.png */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 6BFF40631D42436E008EF94E /* Blogger_Sans.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Blogger_Sans.otf; sourceTree = ""; }; 22 | 6CA6630A1D439ACB00AE785E /* EzyGradientView->Objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "EzyGradientView->Objc.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 6CA663221D439C8F00AE785E /* EZYGradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EZYGradientView.swift; sourceTree = ""; }; 24 | 6CFA1AA21D40F2FE00AB04AC /* EZYGradientView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZYGradientView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 6CFA1AA51D40F2FF00AB04AC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 6CFA1AA71D40F2FF00AB04AC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 6CFA1AAA1D40F2FF00AB04AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 6CFA1AAC1D40F2FF00AB04AC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 6CFA1AAF1D40F2FF00AB04AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 6CFA1AB11D40F2FF00AB04AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 84F945C72381989400A9B921 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 6CA663071D439ACB00AE785E /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | 6CFA1A9F1D40F2FE00AB04AC /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 6CA663211D439C8F00AE785E /* EZYGradientView */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 6CA663221D439C8F00AE785E /* EZYGradientView.swift */, 56 | ); 57 | name = EZYGradientView; 58 | path = ../../EZYGradientView; 59 | sourceTree = ""; 60 | }; 61 | 6CFA1A991D40F2FE00AB04AC = { 62 | isa = PBXGroup; 63 | children = ( 64 | 84F945C72381989400A9B921 /* Default-568h@2x.png */, 65 | 6CFA1AA41D40F2FF00AB04AC /* EZYGradientView */, 66 | 6CFA1AA31D40F2FE00AB04AC /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 6CFA1AA31D40F2FE00AB04AC /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 6CFA1AA21D40F2FE00AB04AC /* EZYGradientView.app */, 74 | 6CA6630A1D439ACB00AE785E /* EzyGradientView->Objc.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 6CFA1AA41D40F2FF00AB04AC /* EZYGradientView */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 6CA663211D439C8F00AE785E /* EZYGradientView */, 83 | 6CFA1AA51D40F2FF00AB04AC /* AppDelegate.swift */, 84 | 6CFA1AA71D40F2FF00AB04AC /* ViewController.swift */, 85 | 6CFA1AA91D40F2FF00AB04AC /* Main.storyboard */, 86 | 6CFA1AAC1D40F2FF00AB04AC /* Assets.xcassets */, 87 | 6CFA1AAE1D40F2FF00AB04AC /* LaunchScreen.storyboard */, 88 | 6CFA1AB11D40F2FF00AB04AC /* Info.plist */, 89 | 6BFF40631D42436E008EF94E /* Blogger_Sans.otf */, 90 | ); 91 | path = EZYGradientView; 92 | sourceTree = ""; 93 | }; 94 | /* End PBXGroup section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | 6CA663091D439ACB00AE785E /* EzyGradientView->Objc */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = 6CA663201D439ACB00AE785E /* Build configuration list for PBXNativeTarget "EzyGradientView->Objc" */; 100 | buildPhases = ( 101 | 6CA663061D439ACB00AE785E /* Sources */, 102 | 6CA663071D439ACB00AE785E /* Frameworks */, 103 | 6CA663081D439ACB00AE785E /* Resources */, 104 | ); 105 | buildRules = ( 106 | ); 107 | dependencies = ( 108 | ); 109 | name = "EzyGradientView->Objc"; 110 | productName = "EzyGradientView->Objc"; 111 | productReference = 6CA6630A1D439ACB00AE785E /* EzyGradientView->Objc.app */; 112 | productType = "com.apple.product-type.application"; 113 | }; 114 | 6CFA1AA11D40F2FE00AB04AC /* EZYGradientView */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 6CFA1AB41D40F2FF00AB04AC /* Build configuration list for PBXNativeTarget "EZYGradientView" */; 117 | buildPhases = ( 118 | 6CFA1A9E1D40F2FE00AB04AC /* Sources */, 119 | 6CFA1A9F1D40F2FE00AB04AC /* Frameworks */, 120 | 6CFA1AA01D40F2FE00AB04AC /* Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = EZYGradientView; 127 | productName = EZYGradientView; 128 | productReference = 6CFA1AA21D40F2FE00AB04AC /* EZYGradientView.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | 6CFA1A9A1D40F2FE00AB04AC /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastSwiftUpdateCheck = 0730; 138 | LastUpgradeCheck = 1120; 139 | ORGANIZATIONNAME = Shashank; 140 | TargetAttributes = { 141 | 6CA663091D439ACB00AE785E = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | }; 144 | 6CFA1AA11D40F2FE00AB04AC = { 145 | CreatedOnToolsVersion = 7.3.1; 146 | LastSwiftMigration = 0800; 147 | }; 148 | }; 149 | }; 150 | buildConfigurationList = 6CFA1A9D1D40F2FE00AB04AC /* Build configuration list for PBXProject "EZYGradientView" */; 151 | compatibilityVersion = "Xcode 3.2"; 152 | developmentRegion = en; 153 | hasScannedForEncodings = 0; 154 | knownRegions = ( 155 | en, 156 | Base, 157 | ); 158 | mainGroup = 6CFA1A991D40F2FE00AB04AC; 159 | productRefGroup = 6CFA1AA31D40F2FE00AB04AC /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | 6CFA1AA11D40F2FE00AB04AC /* EZYGradientView */, 164 | 6CA663091D439ACB00AE785E /* EzyGradientView->Objc */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | 6CA663081D439ACB00AE785E /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 84F945C82381989400A9B921 /* Default-568h@2x.png in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | 6CFA1AA01D40F2FE00AB04AC /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 6CFA1AB01D40F2FF00AB04AC /* LaunchScreen.storyboard in Resources */, 183 | 6BFF40641D42436E008EF94E /* Blogger_Sans.otf in Resources */, 184 | 6CFA1AAD1D40F2FF00AB04AC /* Assets.xcassets in Resources */, 185 | 6CFA1AAB1D40F2FF00AB04AC /* Main.storyboard in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXSourcesBuildPhase section */ 192 | 6CA663061D439ACB00AE785E /* Sources */ = { 193 | isa = PBXSourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | }; 199 | 6CFA1A9E1D40F2FE00AB04AC /* Sources */ = { 200 | isa = PBXSourcesBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | 6CFA1AA81D40F2FF00AB04AC /* ViewController.swift in Sources */, 204 | 6CA663231D439C8F00AE785E /* EZYGradientView.swift in Sources */, 205 | 6CFA1AA61D40F2FF00AB04AC /* AppDelegate.swift in Sources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | /* End PBXSourcesBuildPhase section */ 210 | 211 | /* Begin PBXVariantGroup section */ 212 | 6CFA1AA91D40F2FF00AB04AC /* Main.storyboard */ = { 213 | isa = PBXVariantGroup; 214 | children = ( 215 | 6CFA1AAA1D40F2FF00AB04AC /* Base */, 216 | ); 217 | name = Main.storyboard; 218 | sourceTree = ""; 219 | }; 220 | 6CFA1AAE1D40F2FF00AB04AC /* LaunchScreen.storyboard */ = { 221 | isa = PBXVariantGroup; 222 | children = ( 223 | 6CFA1AAF1D40F2FF00AB04AC /* Base */, 224 | ); 225 | name = LaunchScreen.storyboard; 226 | sourceTree = ""; 227 | }; 228 | /* End PBXVariantGroup section */ 229 | 230 | /* Begin XCBuildConfiguration section */ 231 | 6CA6631E1D439ACB00AE785E /* Debug */ = { 232 | isa = XCBuildConfiguration; 233 | buildSettings = { 234 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 235 | INFOPLIST_FILE = "EzyGradientView->Objc/Info.plist"; 236 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 237 | PRODUCT_BUNDLE_IDENTIFIER = "com.shashank.EzyGradientView--Objc"; 238 | PRODUCT_NAME = "$(TARGET_NAME)"; 239 | }; 240 | name = Debug; 241 | }; 242 | 6CA6631F1D439ACB00AE785E /* Release */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 246 | INFOPLIST_FILE = "EzyGradientView->Objc/Info.plist"; 247 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 248 | PRODUCT_BUNDLE_IDENTIFIER = "com.shashank.EzyGradientView--Objc"; 249 | PRODUCT_NAME = "$(TARGET_NAME)"; 250 | }; 251 | name = Release; 252 | }; 253 | 6CFA1AB21D40F2FF00AB04AC /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 258 | CLANG_ANALYZER_NONNULL = YES; 259 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 260 | CLANG_CXX_LIBRARY = "libc++"; 261 | CLANG_ENABLE_MODULES = YES; 262 | CLANG_ENABLE_OBJC_ARC = YES; 263 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_COMMA = YES; 266 | CLANG_WARN_CONSTANT_CONVERSION = YES; 267 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 268 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INFINITE_RECURSION = YES; 272 | CLANG_WARN_INT_CONVERSION = YES; 273 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 275 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 278 | CLANG_WARN_STRICT_PROTOTYPES = YES; 279 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 283 | COPY_PHASE_STRIP = NO; 284 | DEBUG_INFORMATION_FORMAT = dwarf; 285 | ENABLE_STRICT_OBJC_MSGSEND = YES; 286 | ENABLE_TESTABILITY = YES; 287 | GCC_C_LANGUAGE_STANDARD = gnu99; 288 | GCC_DYNAMIC_NO_PIC = NO; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_OPTIMIZATION_LEVEL = 0; 291 | GCC_PREPROCESSOR_DEFINITIONS = ( 292 | "DEBUG=1", 293 | "$(inherited)", 294 | ); 295 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 297 | GCC_WARN_UNDECLARED_SELECTOR = YES; 298 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 299 | GCC_WARN_UNUSED_FUNCTION = YES; 300 | GCC_WARN_UNUSED_VARIABLE = YES; 301 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 302 | MTL_ENABLE_DEBUG_INFO = YES; 303 | ONLY_ACTIVE_ARCH = YES; 304 | SDKROOT = iphoneos; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | SWIFT_VERSION = 5.0; 307 | }; 308 | name = Debug; 309 | }; 310 | 6CFA1AB31D40F2FF00AB04AC /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_COMMA = YES; 323 | CLANG_WARN_CONSTANT_CONVERSION = YES; 324 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INFINITE_RECURSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 335 | CLANG_WARN_STRICT_PROTOTYPES = YES; 336 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | ENABLE_NS_ASSERTIONS = NO; 343 | ENABLE_STRICT_OBJC_MSGSEND = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 353 | MTL_ENABLE_DEBUG_INFO = NO; 354 | SDKROOT = iphoneos; 355 | SWIFT_COMPILATION_MODE = wholemodule; 356 | SWIFT_VERSION = 5.0; 357 | VALIDATE_PRODUCT = YES; 358 | }; 359 | name = Release; 360 | }; 361 | 6CFA1AB51D40F2FF00AB04AC /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | INFOPLIST_FILE = EZYGradientView/Info.plist; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_BUNDLE_IDENTIFIER = com.shashank.EZYGradientView; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_VERSION = 5.0; 370 | }; 371 | name = Debug; 372 | }; 373 | 6CFA1AB61D40F2FF00AB04AC /* Release */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | INFOPLIST_FILE = EZYGradientView/Info.plist; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 379 | PRODUCT_BUNDLE_IDENTIFIER = com.shashank.EZYGradientView; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | SWIFT_VERSION = 5.0; 382 | }; 383 | name = Release; 384 | }; 385 | /* End XCBuildConfiguration section */ 386 | 387 | /* Begin XCConfigurationList section */ 388 | 6CA663201D439ACB00AE785E /* Build configuration list for PBXNativeTarget "EzyGradientView->Objc" */ = { 389 | isa = XCConfigurationList; 390 | buildConfigurations = ( 391 | 6CA6631E1D439ACB00AE785E /* Debug */, 392 | 6CA6631F1D439ACB00AE785E /* Release */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Release; 396 | }; 397 | 6CFA1A9D1D40F2FE00AB04AC /* Build configuration list for PBXProject "EZYGradientView" */ = { 398 | isa = XCConfigurationList; 399 | buildConfigurations = ( 400 | 6CFA1AB21D40F2FF00AB04AC /* Debug */, 401 | 6CFA1AB31D40F2FF00AB04AC /* Release */, 402 | ); 403 | defaultConfigurationIsVisible = 0; 404 | defaultConfigurationName = Release; 405 | }; 406 | 6CFA1AB41D40F2FF00AB04AC /* Build configuration list for PBXNativeTarget "EZYGradientView" */ = { 407 | isa = XCConfigurationList; 408 | buildConfigurations = ( 409 | 6CFA1AB51D40F2FF00AB04AC /* Debug */, 410 | 6CFA1AB61D40F2FF00AB04AC /* Release */, 411 | ); 412 | defaultConfigurationIsVisible = 0; 413 | defaultConfigurationName = Release; 414 | }; 415 | /* End XCConfigurationList section */ 416 | }; 417 | rootObject = 6CFA1A9A1D40F2FE00AB04AC /* Project object */; 418 | } 419 | -------------------------------------------------------------------------------- /Example/EZYGradientView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/EZYGradientView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/EZYGradientView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // EZYGradientView 4 | // 5 | // Created by Shashank on 21/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // 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. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // 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. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Example/EZYGradientView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/EZYGradientView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/EZYGradientView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | BloggerSans 13 | BloggerSans 14 | BloggerSans 15 | BloggerSans 16 | BloggerSans 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 173 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 197 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | -------------------------------------------------------------------------------- /Example/EZYGradientView/Blogger_Sans.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shashankpali/EZYGradientView/5258919310a4983dfd0d672989cce6c39cda2fe4/Example/EZYGradientView/Blogger_Sans.otf -------------------------------------------------------------------------------- /Example/EZYGradientView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/EZYGradientView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // EZYGradientView 4 | // 5 | // Created by Shashank on 21/07/16. 6 | // Copyright © 2016 Shashank. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate 12 | { 13 | @IBOutlet weak var navGradientView: EZYGradientView! 14 | @IBOutlet weak var tabGradientView: EZYGradientView! 15 | @IBOutlet weak var myTableView: UITableView! 16 | 17 | @IBOutlet weak var angleLabel: UILabel! 18 | @IBOutlet weak var fadeIntenLabel: UILabel! 19 | @IBOutlet weak var colorRatioLabel: UILabel! 20 | @IBOutlet weak var blurOpacLabel: UILabel! 21 | 22 | var angle:Float = 0.0 23 | { 24 | didSet 25 | { 26 | navGradientView.angleº = angle 27 | tabGradientView.angleº = angle 28 | } 29 | } 30 | 31 | var fadeIntesity:Float = 0.0 32 | { 33 | didSet 34 | { 35 | navGradientView.fadeIntensity = fadeIntesity 36 | tabGradientView.fadeIntensity = fadeIntesity 37 | } 38 | } 39 | 40 | var colorRatio:Float = 0.0 41 | { 42 | didSet 43 | { 44 | navGradientView.colorRatio = colorRatio 45 | tabGradientView.colorRatio = colorRatio 46 | } 47 | } 48 | 49 | var blurOpacity:Float = 0.0 50 | { 51 | didSet 52 | { 53 | navGradientView.blurOpacity = blurOpacity 54 | tabGradientView.blurOpacity = blurOpacity 55 | } 56 | } 57 | 58 | 59 | override func viewDidLoad() 60 | { 61 | super.viewDidLoad() 62 | myTableView.contentInset = UIEdgeInsets(top: 64, left: 0, bottom: 118, right: 0) 63 | myTableView.scrollIndicatorInsets = myTableView.contentInset 64 | } 65 | 66 | override func viewDidAppear(_ animated: Bool) { 67 | super.viewDidAppear(animated) 68 | tabGradientView.blurLayer?.cornerRadius = tabGradientView.frame.size.height/2 69 | tabGradientView.blurLayer?.masksToBounds = true 70 | } 71 | 72 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 73 | return 10; 74 | } 75 | 76 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 77 | let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) 78 | 79 | return cell; 80 | } 81 | 82 | 83 | @IBAction func sliderChangedValue(_ sender: AnyObject) 84 | { 85 | let slider = sender as! UISlider 86 | 87 | switch slider.tag { 88 | case 10: 89 | angle = ceilf(slider.value*360) 90 | angleLabel.text = String(format:"Angle->%.1f",angle) 91 | break 92 | 93 | case 11: 94 | fadeIntesity = floorf(slider.value * 10) / 10 95 | fadeIntenLabel.text = String(format:"Fade Intensity->%.1f", fadeIntesity) 96 | break 97 | 98 | case 12: 99 | colorRatio = floorf(slider.value * 10) / 10 100 | colorRatioLabel.text = String(format:"Color Ratio->%.1f",colorRatio) 101 | break 102 | 103 | case 13: 104 | blurOpacity = floorf(slider.value * 10) / 10 105 | blurOpacLabel.text = String(format:"Blur Opacity->%.1f",blurOpacity) 106 | break 107 | 108 | default: 109 | 110 | break 111 | } 112 | } 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Shashank Pali 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![EZYGradientView](Assets/GitBanner.png) 2 | 3 | `EZYGradientView` is a different and unique take on creating gradients and gradients with blur on the iOS platform. The default `CAGradientLayer` implementation works just fine, but is confusing and gives different results than expected. From the documentation: 4 | 5 | > The start point corresponds to the first stop of the gradient. The point is defined in the unit coordinate space and is then mapped to the layer’s bounds rectangle when drawn. 6 | 7 | It's not really clear what the mapped values for the start and end points will be. If we set the start x coordinate 0.2, it does not resolve to 0.2 of the view's width on the X-axis. 8 | 9 | This library attempts to create gradients intuitively. When you use `EZYGradientView`, you don't need to worry about Apple's default API. What you do need to concern yourself with is: 10 | 11 | * What your colors are 12 | * The angle of the gradient 13 | * The ratio in which the two colors are distributed; and finally... 14 | * The intensity with which the colors are dispersed 15 | 16 | `EZYGradientView` exposes five properties you can modify to customize your gradient. The view itself is `IBDesignable` and its properties `IBInspectable` which means you can customize your gradient in real time on an xib or storyboard. 17 | 18 | # Pod Installation 19 | 20 | CocoaPods is the preferred way to install this library. Add this command to your `Podfile`: 21 | 22 | ``` 23 | pod 'EZYGradientView', :git => 'https://github.com/Niphery/EZYGradientView' 24 | ``` 25 | 26 | 27 | 28 | 29 | ###For [Objective C](https://github.com/shashankpali/EZYGradientView-ObjC) 30 | 31 | 32 | # Direct Installation 33 | 34 | Download .zip file and extract it. There you will find the `EZYGradientView` folder, copy EZYGradientView.swift to your respective project. 35 | 36 | # Integration Methods 37 | 38 | ## Storyboard/Xib 39 | 40 | Just follow these simple steps and create a gradient inside your xib or storyboard! 41 | 42 | 43 | ### Initial Step (Use this step if downloaded by pod) 44 | 45 | ###### while assigning EZYGradientView to UIView on StoryBoard/Xib don't forget to select module 46 | 47 | | Step | Description | 48 | |-------------------------------|---------------------------------------------------| 49 | | ![Step 0a](Assets/Step0a.png) | | 50 | | ![Step 0b](Assets/Step0b.png) | It will reflect warning if module is not selected.| 51 | 52 | ### Step 1 - Select colors 53 | 54 | | Step | Description | 55 | |-------------------------------|---------------| 56 | | ![Step 1a](Assets/Step1a.png) | | 57 | | ![Step 1b](Assets/Step1b.png) | | 58 | 59 | ### Step 2 - Set gradient angle 60 | 61 | | Step | Description | 62 | |-------------------------------|----------------| 63 | | ![Step 2a](Assets/Step2a.png) | Default is 0º. | 64 | | ![Step 2b](Assets/Step2b.png) | At 45º. | 65 | | ![Step 2c](Assets/Step2c.png) | At 135º. | 66 | 67 | ### Step 3 - Set color ratio 68 | 69 | | Step | Description | 70 | |-------------------------------|-----------------------------------------------------------------------------------------------| 71 | | ![Step 3a](Assets/Step3a.png) | Default is 0.5, that's why colors are equally divided. Valid range 0 to 1. | 72 | | ![Step 3b](Assets/Step3b.png) | At 0.1, the first color takes one-tenth of the view area. The rest is filled by the second. | 73 | | ![Step 3c](Assets/Step3c.png) | At 0.9, the first color takes nine-tenths of the view area. The rest is filled by the second. | 74 | 75 | ### Step 4 - Set fade intensity 76 | 77 | | Step | Description | 78 | |-------------------------------|---------------------------------------------------------------------------------------------------| 79 | | ![Step 4a](Assets/Step4a.png) | Default is 0, that's why there is a sharp boundary where the two colors meet. Valid range 0 to 1. | 80 | | ![Step 4b](Assets/Step4b.png) | At 0.5, there is a much smoother transition between the two colors. | 81 | | ![Step 4c](Assets/Step4c.png) | At 1, the maximum transition smoothness is achieved. | 82 | 83 | ### Step 5 - Set isBlur and blur opacity 84 | ######(This feature is available for ios 8 and above) 85 | 86 | 87 | | Step | Description | 88 | |-------------------------------|---------------------------------------------------------------------------------------------------| 89 | | ![Step 5a](Assets/Step5a.png) | Default is 0, where the blur transparency is minimmum. Valid range 0 to 1. | 90 | | ![Step 5b](Assets/Step5b.png) | At 1.0, where the blur transparency is maximum.(The black spot is a label behind gradient view) | 91 | | Suggestion | Use this properties to design `navigationBar`, `tabBar`, `tableHeaderView` etc. | 92 | 93 | ## Programmatic way 94 | 95 | ```swift 96 | let gradientView = EZYGradientView() 97 | gradientView.frame = view.bounds 98 | gradientView.firstColor = UIColor(red: 0.5, green: 0.0, blue: 1.0, alpha: 1.0) 99 | gradientView.secondColor = UIColor(red: 0.4, green: 1.0, blue: 0.8, alpha: 1.0) 100 | gradientView.angleº = 185.0 101 | gradientView.colorRatio = 0.5 102 | gradientView.fadeIntensity = 1 103 | gradientView.isBlur = true 104 | gradientView.blurOpacity = 0.5 105 | 106 | view.insertSubview(gradientView, at: 0) 107 | ``` 108 | 109 | # To-do 110 | 111 | * Allow more than two colors to create gradients. 112 | * It may crash if blur properties used in lower version than ios 8. 113 | * Use CoreGraphics blur to replace `UIVisualEffectView`. 114 | 115 | # Thanks 116 | 117 | * To [Sudeep Jaiswal](https://github.com/sudeepjaiswal) for motivating and special thanks for the documentation and ideas. 118 | * To [Angela Yu](https://www.udemy.com/course/ios-13-app-development-bootcamp/) for the updated courses on iOS 13 & Swift 5. 119 | 120 | # License 121 | 122 | `EZYGradientView` is available under the MIT license. See the LICENSE file for more info. 123 | --------------------------------------------------------------------------------