├── .gitignore ├── Assets ├── grview_sample1.png ├── grview_sample2.png ├── splash_Screen.png ├── usage_sample1.png └── usage_sample2.png ├── GRView.podspec ├── GRView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── GRView.xcscheme ├── GRView ├── GRView.h └── Info.plist ├── GradientView ├── GRButton.swift └── GRView.swift ├── LICENSE ├── README.md └── Screenshots └── screen_shot1.png /.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 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /Assets/grview_sample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Assets/grview_sample1.png -------------------------------------------------------------------------------- /Assets/grview_sample2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Assets/grview_sample2.png -------------------------------------------------------------------------------- /Assets/splash_Screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Assets/splash_Screen.png -------------------------------------------------------------------------------- /Assets/usage_sample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Assets/usage_sample1.png -------------------------------------------------------------------------------- /Assets/usage_sample2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Assets/usage_sample2.png -------------------------------------------------------------------------------- /GRView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "GRView" 4 | s.version = "1.0.0" 5 | s.summary = "UIView and other UIKit elements with a gradient and other customizable attributes for IOS" 6 | s.description = "UIView and other UIKit elements classes with a gradient rendered and customizable in the storyboard (colors, direction, cornerRadius ,shadows, ... etc)." 7 | s.homepage = "https://github.com/Ahmed-Komsan/GRView" 8 | s.license = "MIT" 9 | s.author = { "Ahmed Komsan" => "ahmedkomsan0@gmail.com" } 10 | s.platform = :ios, "11.2" 11 | s.swift_version = "4.0" 12 | s.source = { :git => "https://github.com/Ahmed-Komsan/GRView.git", :tag => "1.0.0" } 13 | s.source_files = "GradientView/*.{h,m,swift}" 14 | s.swift_version = "4.0" 15 | 16 | end 17 | -------------------------------------------------------------------------------- /GRView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 335C80F8211C415600C2A482 /* GRView.h in Headers */ = {isa = PBXBuildFile; fileRef = 335C80F6211C415600C2A482 /* GRView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 335C8101211C42E500C2A482 /* GRButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335C80FF211C42E500C2A482 /* GRButton.swift */; }; 12 | 335C8102211C42E500C2A482 /* GRView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335C8100211C42E500C2A482 /* GRView.swift */; }; 13 | 33C7407E2123401100246A86 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 33C7407D2123401100246A86 /* README.md */; }; 14 | 33C740812123426700246A86 /* screen_shot1.png in Resources */ = {isa = PBXBuildFile; fileRef = 33C740802123426600246A86 /* screen_shot1.png */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 335C80F3211C415600C2A482 /* GRView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 335C80F6211C415600C2A482 /* GRView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GRView.h; sourceTree = ""; }; 20 | 335C80F7211C415600C2A482 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | 335C80FF211C42E500C2A482 /* GRButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GRButton.swift; sourceTree = ""; }; 22 | 335C8100211C42E500C2A482 /* GRView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GRView.swift; sourceTree = ""; }; 23 | 33C7407D2123401100246A86 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 24 | 33C740802123426600246A86 /* screen_shot1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screen_shot1.png; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 335C80EF211C415600C2A482 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 335C80E9211C415600C2A482 = { 39 | isa = PBXGroup; 40 | children = ( 41 | 33C7407F2123426600246A86 /* Screenshots */, 42 | 33C7407D2123401100246A86 /* README.md */, 43 | 335C80FE211C42E500C2A482 /* GradientView */, 44 | 335C80F5211C415600C2A482 /* GRView */, 45 | 335C80F4211C415600C2A482 /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 335C80F4211C415600C2A482 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 335C80F3211C415600C2A482 /* GRView.framework */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 335C80F5211C415600C2A482 /* GRView */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 335C80F6211C415600C2A482 /* GRView.h */, 61 | 335C80F7211C415600C2A482 /* Info.plist */, 62 | ); 63 | path = GRView; 64 | sourceTree = ""; 65 | }; 66 | 335C80FE211C42E500C2A482 /* GradientView */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 335C80FF211C42E500C2A482 /* GRButton.swift */, 70 | 335C8100211C42E500C2A482 /* GRView.swift */, 71 | ); 72 | path = GradientView; 73 | sourceTree = ""; 74 | }; 75 | 33C7407F2123426600246A86 /* Screenshots */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 33C740802123426600246A86 /* screen_shot1.png */, 79 | ); 80 | path = Screenshots; 81 | sourceTree = ""; 82 | }; 83 | /* End PBXGroup section */ 84 | 85 | /* Begin PBXHeadersBuildPhase section */ 86 | 335C80F0211C415600C2A482 /* Headers */ = { 87 | isa = PBXHeadersBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | 335C80F8211C415600C2A482 /* GRView.h in Headers */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXHeadersBuildPhase section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | 335C80F2211C415600C2A482 /* GRView */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = 335C80FB211C415600C2A482 /* Build configuration list for PBXNativeTarget "GRView" */; 100 | buildPhases = ( 101 | 335C80EE211C415600C2A482 /* Sources */, 102 | 335C80EF211C415600C2A482 /* Frameworks */, 103 | 335C80F0211C415600C2A482 /* Headers */, 104 | 335C80F1211C415600C2A482 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = GRView; 111 | productName = GRView; 112 | productReference = 335C80F3211C415600C2A482 /* GRView.framework */; 113 | productType = "com.apple.product-type.framework"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | 335C80EA211C415600C2A482 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0920; 122 | ORGANIZATIONNAME = akomsan; 123 | TargetAttributes = { 124 | 335C80F2211C415600C2A482 = { 125 | CreatedOnToolsVersion = 9.2; 126 | ProvisioningStyle = Automatic; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = 335C80ED211C415600C2A482 /* Build configuration list for PBXProject "GRView" */; 131 | compatibilityVersion = "Xcode 8.0"; 132 | developmentRegion = en; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | ); 137 | mainGroup = 335C80E9211C415600C2A482; 138 | productRefGroup = 335C80F4211C415600C2A482 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | 335C80F2211C415600C2A482 /* GRView */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | 335C80F1211C415600C2A482 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 33C7407E2123401100246A86 /* README.md in Resources */, 153 | 33C740812123426700246A86 /* screen_shot1.png in Resources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXResourcesBuildPhase section */ 158 | 159 | /* Begin PBXSourcesBuildPhase section */ 160 | 335C80EE211C415600C2A482 /* Sources */ = { 161 | isa = PBXSourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | 335C8101211C42E500C2A482 /* GRButton.swift in Sources */, 165 | 335C8102211C42E500C2A482 /* GRView.swift in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin XCBuildConfiguration section */ 172 | 335C80F9211C415600C2A482 /* Debug */ = { 173 | isa = XCBuildConfiguration; 174 | buildSettings = { 175 | ALWAYS_SEARCH_USER_PATHS = NO; 176 | CLANG_ANALYZER_NONNULL = YES; 177 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 178 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 179 | CLANG_CXX_LIBRARY = "libc++"; 180 | CLANG_ENABLE_MODULES = YES; 181 | CLANG_ENABLE_OBJC_ARC = YES; 182 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 183 | CLANG_WARN_BOOL_CONVERSION = YES; 184 | CLANG_WARN_COMMA = YES; 185 | CLANG_WARN_CONSTANT_CONVERSION = YES; 186 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 187 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 188 | CLANG_WARN_EMPTY_BODY = YES; 189 | CLANG_WARN_ENUM_CONVERSION = YES; 190 | CLANG_WARN_INFINITE_RECURSION = YES; 191 | CLANG_WARN_INT_CONVERSION = YES; 192 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 193 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 194 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 195 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 196 | CLANG_WARN_STRICT_PROTOTYPES = YES; 197 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 198 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 199 | CLANG_WARN_UNREACHABLE_CODE = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | CODE_SIGN_IDENTITY = "iPhone Developer"; 202 | COPY_PHASE_STRIP = NO; 203 | CURRENT_PROJECT_VERSION = 1; 204 | DEBUG_INFORMATION_FORMAT = dwarf; 205 | ENABLE_STRICT_OBJC_MSGSEND = YES; 206 | ENABLE_TESTABILITY = YES; 207 | GCC_C_LANGUAGE_STANDARD = gnu11; 208 | GCC_DYNAMIC_NO_PIC = NO; 209 | GCC_NO_COMMON_BLOCKS = YES; 210 | GCC_OPTIMIZATION_LEVEL = 0; 211 | GCC_PREPROCESSOR_DEFINITIONS = ( 212 | "DEBUG=1", 213 | "$(inherited)", 214 | ); 215 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 217 | GCC_WARN_UNDECLARED_SELECTOR = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 219 | GCC_WARN_UNUSED_FUNCTION = YES; 220 | GCC_WARN_UNUSED_VARIABLE = YES; 221 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 222 | MTL_ENABLE_DEBUG_INFO = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = iphoneos; 225 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 226 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 227 | VERSIONING_SYSTEM = "apple-generic"; 228 | VERSION_INFO_PREFIX = ""; 229 | }; 230 | name = Debug; 231 | }; 232 | 335C80FA211C415600C2A482 /* Release */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | ALWAYS_SEARCH_USER_PATHS = NO; 236 | CLANG_ANALYZER_NONNULL = YES; 237 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 238 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 239 | CLANG_CXX_LIBRARY = "libc++"; 240 | CLANG_ENABLE_MODULES = YES; 241 | CLANG_ENABLE_OBJC_ARC = YES; 242 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 243 | CLANG_WARN_BOOL_CONVERSION = YES; 244 | CLANG_WARN_COMMA = YES; 245 | CLANG_WARN_CONSTANT_CONVERSION = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 248 | CLANG_WARN_EMPTY_BODY = YES; 249 | CLANG_WARN_ENUM_CONVERSION = YES; 250 | CLANG_WARN_INFINITE_RECURSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 253 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 255 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 256 | CLANG_WARN_STRICT_PROTOTYPES = YES; 257 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 258 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | CODE_SIGN_IDENTITY = "iPhone Developer"; 262 | COPY_PHASE_STRIP = NO; 263 | CURRENT_PROJECT_VERSION = 1; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu11; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 279 | VALIDATE_PRODUCT = YES; 280 | VERSIONING_SYSTEM = "apple-generic"; 281 | VERSION_INFO_PREFIX = ""; 282 | }; 283 | name = Release; 284 | }; 285 | 335C80FC211C415600C2A482 /* Debug */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 289 | CODE_SIGN_IDENTITY = ""; 290 | CODE_SIGN_STYLE = Automatic; 291 | DEFINES_MODULE = YES; 292 | DYLIB_COMPATIBILITY_VERSION = 1; 293 | DYLIB_CURRENT_VERSION = 1; 294 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 295 | INFOPLIST_FILE = GRView/Info.plist; 296 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 298 | PRODUCT_BUNDLE_IDENTIFIER = com.ahmedkomsan.GRView; 299 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 300 | SKIP_INSTALL = YES; 301 | SWIFT_VERSION = 4.0; 302 | TARGETED_DEVICE_FAMILY = "1,2"; 303 | }; 304 | name = Debug; 305 | }; 306 | 335C80FD211C415600C2A482 /* Release */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 310 | CODE_SIGN_IDENTITY = ""; 311 | CODE_SIGN_STYLE = Automatic; 312 | DEFINES_MODULE = YES; 313 | DYLIB_COMPATIBILITY_VERSION = 1; 314 | DYLIB_CURRENT_VERSION = 1; 315 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 316 | INFOPLIST_FILE = GRView/Info.plist; 317 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 319 | PRODUCT_BUNDLE_IDENTIFIER = com.ahmedkomsan.GRView; 320 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 321 | SKIP_INSTALL = YES; 322 | SWIFT_VERSION = 4.0; 323 | TARGETED_DEVICE_FAMILY = "1,2"; 324 | }; 325 | name = Release; 326 | }; 327 | /* End XCBuildConfiguration section */ 328 | 329 | /* Begin XCConfigurationList section */ 330 | 335C80ED211C415600C2A482 /* Build configuration list for PBXProject "GRView" */ = { 331 | isa = XCConfigurationList; 332 | buildConfigurations = ( 333 | 335C80F9211C415600C2A482 /* Debug */, 334 | 335C80FA211C415600C2A482 /* Release */, 335 | ); 336 | defaultConfigurationIsVisible = 0; 337 | defaultConfigurationName = Release; 338 | }; 339 | 335C80FB211C415600C2A482 /* Build configuration list for PBXNativeTarget "GRView" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | 335C80FC211C415600C2A482 /* Debug */, 343 | 335C80FD211C415600C2A482 /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | /* End XCConfigurationList section */ 349 | }; 350 | rootObject = 335C80EA211C415600C2A482 /* Project object */; 351 | } 352 | -------------------------------------------------------------------------------- /GRView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GRView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GRView.xcodeproj/xcshareddata/xcschemes/GRView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /GRView/GRView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GRView.h 3 | // 4 | // Created by Ahmed Komsan on 8/9/18. 5 | // Copyright © 2018 Ahmed Komsan. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for GRView. 11 | FOUNDATION_EXPORT double GRViewVersionNumber; 12 | 13 | //! Project version string for GRView. 14 | FOUNDATION_EXPORT const unsigned char GRViewVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /GRView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | GRView 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /GradientView/GRButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GRButton.swift 3 | // 4 | // Created by Ahmed Komsan on 8/8/18. 5 | // Copyright © 2018 Ahmed Komsan. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | @IBDesignable 10 | public class GRButton: UIButton { 11 | 12 | @IBInspectable public var startColor: UIColor = .black { didSet { updateColors() }} 13 | @IBInspectable public var endColor: UIColor = .white { didSet { updateColors() }} 14 | @IBInspectable public var startLocation: Double = 0.05 { didSet { updateLocations() }} 15 | @IBInspectable public var endLocation: Double = 0.95 { didSet { updateLocations() }} 16 | @IBInspectable public var horizontalMode: Bool = false { didSet { updatePoints() }} 17 | @IBInspectable public var diagonalMode: Bool = false { didSet { updatePoints() }} 18 | 19 | @IBInspectable 20 | public var cornerRadius: CGFloat { 21 | get { 22 | return layer.cornerRadius 23 | } 24 | set { 25 | layer.cornerRadius = newValue 26 | } 27 | } 28 | 29 | @IBInspectable 30 | public var borderWidth: CGFloat { 31 | get { 32 | return layer.borderWidth 33 | } 34 | set { 35 | layer.borderWidth = newValue 36 | } 37 | } 38 | 39 | @IBInspectable 40 | public var borderColor: UIColor? { 41 | get { 42 | if let color = layer.borderColor { 43 | return UIColor(cgColor: color) 44 | } 45 | return nil 46 | } 47 | set { 48 | if let color = newValue { 49 | layer.borderColor = color.cgColor 50 | } else { 51 | layer.borderColor = nil 52 | } 53 | } 54 | } 55 | 56 | @IBInspectable 57 | public var shadowRadius: CGFloat { 58 | get { 59 | return layer.shadowRadius 60 | } 61 | set { 62 | layer.shadowRadius = newValue 63 | } 64 | } 65 | 66 | @IBInspectable 67 | public var shadowOpacity: Float { 68 | get { 69 | return layer.shadowOpacity 70 | } 71 | set { 72 | layer.shadowOpacity = newValue 73 | } 74 | } 75 | 76 | @IBInspectable 77 | public var shadowOffset: CGSize { 78 | get { 79 | return layer.shadowOffset 80 | } 81 | set { 82 | layer.shadowOffset = newValue 83 | } 84 | } 85 | 86 | @IBInspectable 87 | public var shadowColor: UIColor? { 88 | get { 89 | if let color = layer.shadowColor { 90 | return UIColor(cgColor: color) 91 | } 92 | return nil 93 | } 94 | set { 95 | if let color = newValue { 96 | layer.shadowColor = color.cgColor 97 | } else { 98 | layer.shadowColor = nil 99 | } 100 | } 101 | } 102 | 103 | 104 | override public class var layerClass: AnyClass { return CAGradientLayer.self } 105 | 106 | var gradientLayer: CAGradientLayer { return layer as! CAGradientLayer } 107 | 108 | func updatePoints() { 109 | if horizontalMode { 110 | gradientLayer.startPoint = diagonalMode ? CGPoint(x: 1, y: 0) : CGPoint(x: 0, y: 0.5) 111 | gradientLayer.endPoint = diagonalMode ? CGPoint(x: 0, y: 1) : CGPoint(x: 1, y: 0.5) 112 | } else { 113 | gradientLayer.startPoint = diagonalMode ? CGPoint(x: 0, y: 0) : CGPoint(x: 0.5, y: 0) 114 | gradientLayer.endPoint = diagonalMode ? CGPoint(x: 1, y: 1) : CGPoint(x: 0.5, y: 1) 115 | } 116 | } 117 | func updateLocations() { 118 | gradientLayer.locations = [startLocation as NSNumber, endLocation as NSNumber] 119 | } 120 | func updateColors() { 121 | gradientLayer.colors = [startColor.cgColor, endColor.cgColor] 122 | } 123 | 124 | override public func layoutSubviews() { 125 | super.layoutSubviews() 126 | updatePoints() 127 | updateLocations() 128 | updateColors() 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /GradientView/GRView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GRView.swift 3 | // 4 | // Created by Ahmed Komsan on 8/7/18. 5 | // Copyright © 2018 Ahmed Komsan. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | @IBDesignable 11 | public class GRView: UIView { 12 | 13 | @IBInspectable public var startColor: UIColor = .black { didSet { updateColors() }} 14 | @IBInspectable public var endColor: UIColor = .white { didSet { updateColors() }} 15 | @IBInspectable public var startLocation: Double = 0.05 { didSet { updateLocations() }} 16 | @IBInspectable public var endLocation: Double = 0.95 { didSet { updateLocations() }} 17 | @IBInspectable public var horizontalMode: Bool = false { didSet { updatePoints() }} 18 | @IBInspectable public var diagonalMode: Bool = false { didSet { updatePoints() }} 19 | override public class var layerClass: AnyClass { return CAGradientLayer.self } 20 | var gradientLayer: CAGradientLayer { return layer as! CAGradientLayer } 21 | 22 | @IBInspectable 23 | public var cornerRadius: CGFloat { 24 | get { 25 | return layer.cornerRadius 26 | } 27 | set { 28 | layer.cornerRadius = newValue 29 | } 30 | } 31 | 32 | @IBInspectable 33 | public var borderWidth: CGFloat { 34 | get { 35 | return layer.borderWidth 36 | } 37 | set { 38 | layer.borderWidth = newValue 39 | } 40 | } 41 | 42 | @IBInspectable 43 | public var borderColor: UIColor? { 44 | get { 45 | if let color = layer.borderColor { 46 | return UIColor(cgColor: color) 47 | } 48 | return nil 49 | } 50 | set { 51 | if let color = newValue { 52 | layer.borderColor = color.cgColor 53 | } else { 54 | layer.borderColor = nil 55 | } 56 | } 57 | } 58 | 59 | @IBInspectable 60 | public var shadowRadius: CGFloat { 61 | get { 62 | return layer.shadowRadius 63 | } 64 | set { 65 | layer.shadowRadius = newValue 66 | } 67 | } 68 | 69 | @IBInspectable 70 | public var shadowOpacity: Float { 71 | get { 72 | return layer.shadowOpacity 73 | } 74 | set { 75 | layer.shadowOpacity = newValue 76 | } 77 | } 78 | 79 | @IBInspectable 80 | public var shadowOffset: CGSize { 81 | get { 82 | return layer.shadowOffset 83 | } 84 | set { 85 | layer.shadowOffset = newValue 86 | } 87 | } 88 | 89 | @IBInspectable 90 | public var shadowColor: UIColor? { 91 | get { 92 | if let color = layer.shadowColor { 93 | return UIColor(cgColor: color) 94 | } 95 | return nil 96 | } 97 | set { 98 | if let color = newValue { 99 | layer.shadowColor = color.cgColor 100 | } else { 101 | layer.shadowColor = nil 102 | } 103 | } 104 | } 105 | 106 | func updatePoints() { 107 | if horizontalMode { 108 | gradientLayer.startPoint = diagonalMode ? CGPoint(x: 1, y: 0) : CGPoint(x: 0, y: 0.5) 109 | gradientLayer.endPoint = diagonalMode ? CGPoint(x: 0, y: 1) : CGPoint(x: 1, y: 0.5) 110 | } else { 111 | gradientLayer.startPoint = diagonalMode ? CGPoint(x: 0, y: 0) : CGPoint(x: 0.5, y: 0) 112 | gradientLayer.endPoint = diagonalMode ? CGPoint(x: 1, y: 1) : CGPoint(x: 0.5, y: 1) 113 | } 114 | } 115 | func updateLocations() { 116 | gradientLayer.locations = [startLocation as NSNumber, endLocation as NSNumber] 117 | } 118 | func updateColors() { 119 | gradientLayer.colors = [startColor.cgColor, endColor.cgColor] 120 | } 121 | 122 | override public func prepareForInterfaceBuilder() { 123 | updatePoints() 124 | updateLocations() 125 | updateColors() 126 | } 127 | 128 | override public func layoutSubviews() { 129 | super.layoutSubviews() 130 | updatePoints() 131 | updateLocations() 132 | updateColors() 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 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 | # GRView 2 | UIView and other UIKit elements with a gradient and other customizable properties (gradient,shadow color,corner raduis...etc.) 3 | GRView exposes many properties you can modify to customize your view or button to add gradient layer ,shadow color ,corner raduis , ... etc. GRView Classes is a @IBDesignable class so that it's rendered in your storyboard, and all its properties are @IBInspectable so that you can customize your gradient inside the storyboard in the attributes inspector. 4 | 5 | 6 | 7 |

8 | 9 | Swift version: 4.0 10 | 11 | 12 | CocoaPods: 2.5 13 | 14 | 15 | Carthage compatible 16 | 17 |

18 | 19 | # Requirements 20 | 21 | GRView is written in Swift 4. iOS 8.0+ Required 22 | 23 | ## Installation 24 | 25 | ### CocoaPods 26 | 27 | CocoaPods is the preferred way to install this library. Add this command to your Podfile: 28 | ``` 29 | pod 'GRView' 30 | ``` 31 | 32 | ### Carthage 33 | To install using [Carthage](https://github.com/Carthage/Carthage), add the following line to your Cartfile: 34 | ``` 35 | github "Ahmed-Komsan/GRView" ~> 1.0.0 36 | ``` 37 | 38 | ### Direct Installation 39 | 40 | Download .zip file and extract it. There you will find the GradientView folder, just copy and add it to your respective project. 41 | 42 | # Usage 43 | 44 | ### Storyboard/Xib 45 | 46 | while assigning GRView to UIView / other UIKit element on StoryBoard/Xib don't forget to select module 47 | (if downloaded by pod) 48 | 49 | 50 | 51 | ### Programmatically 52 | 53 | ```swift 54 | let grView = GRView(frame: view.bounds) 55 | grView.startColor = UIColor(red: 0.7, green: 1.0, blue: 0.7, alpha: 1.0) 56 | grView.endColor = UIColor(red: 0.1, green: 1.0, blue: 0.7, alpha: 1.0) 57 | view.insertSubview(grView, at: 0) 58 | 59 | ``` 60 | # To-do 61 | 62 | - Add like-instagram animation 63 | - Allow more than two colors to create gradients. 64 | - Add more UIKit elements with gradient and properties. 65 | - Add blur effect. 66 | 67 | 68 | # Author 69 | 70 | Ahmed Komsan, ahmedkomsan0@gmail.com 71 | If you found any problem please create issue or pull request to help me improve this open source project. 72 | also you can suggest features/attributes to add , am listening :) 73 | 74 | 75 | # License 76 | 77 | GRView is available under the MIT license. See the LICENSE file for more info. 78 | -------------------------------------------------------------------------------- /Screenshots/screen_shot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmed-Komsan/GRView/b439e3038d0b2f3c1f790b42f7d7335583faeb65/Screenshots/screen_shot1.png --------------------------------------------------------------------------------