├── LICENSE.md ├── README.md ├── Screen Shot.png ├── TJProfileImage.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── TJProfileImage ├── AppDelegate.swift ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── TJProfileImage.swift └── ViewController.swift /LICENSE.md: -------------------------------------------------------------------------------- 1 | Licensed under the **MIT** license 2 | 3 | > Copyright (c) 2016 Awesome Labs 4 | > 5 | > Permission is hereby granted, free of charge, to any person obtaining 6 | > a copy of this software and associated documentation files (the 7 | > "Software"), to deal in the Software without restriction, including 8 | > without limitation the rights to use, copy, modify, merge, publish, 9 | > distribute, sublicense, and/or sell copies of the Software, and to 10 | > permit persons to whom the Software is furnished to do so, subject to 11 | > the following conditions: 12 | > 13 | > The above copyright notice and this permission notice shall be 14 | > included in all copies or substantial portions of the Software. 15 | > 16 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | > IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | > CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | > TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # TJProfileImage 3 | Live rendering of componet’s properties in Interface Builder 4 | 5 | [![Swift Version][swift-image]][swift-url] 6 | [![License][license-image]][license-url] 7 | [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/EZSwiftExtensions.svg)](https://img.shields.io/cocoapods/v/LFAlertController.svg) 8 | [![Platform](https://img.shields.io/cocoapods/p/LFAlertController.svg?style=flat)](http://cocoapods.org/pods/LFAlertController) 9 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 10 | 11 | ![Image](https://github.com/tejas-ardeshna/TJProfileImage/blob/master/Screen%20Shot.png) 12 | 13 | ## Features 14 | - [x] Dashed border 15 | - [x] Solid border 16 | - [x] Round corner 17 | - [x] Circle image 18 | 19 | ## Requirements 20 | 21 | - iOS 9.0+ 22 | - Xcode 8.3 23 | 24 | ## Installation 25 | 26 | #### CocoaPods 27 | 28 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: 29 | 30 | ```bash 31 | $ gem install cocoapods 32 | ``` 33 | 34 | 35 | 36 | To integrate TJProfileImage into your Xcode project using CocoaPods, specify it in your `Podfile`: 37 | 38 | ```ruby 39 | source 'https://github.com/CocoaPods/Specs.git' 40 | platform :ios, '10.0' 41 | use_frameworks! 42 | 43 | target '' do 44 | pod 'TJProfileImage' 45 | end 46 | ``` 47 | 48 | Then, run the following command: 49 | 50 | ```bash 51 | $ pod install 52 | ``` 53 | 54 | #### Manually 55 | 1. Download and drop ```TJProfileImage.swift``` in your project. 56 | 2. Congratulations! 57 | 58 | ## Implementation 59 | 60 | Just set class of your UIImageView to TJProfileImage and let the magic happen. 61 | 62 | ```swift 63 | import TJProfileImage 64 | @IBOutlet var imgView: TJProfileImage! 65 | 66 | imgView.dashedBorder = true // shows dashed border instead of plain 67 | imgView.isCircular = true // makes image view in round shape 68 | imgView.cornerRadious = 5 // you can set custom corner radious also. IF you set isCircular then it will neglate this corner radious 69 | imgView.borderColor = UIColor.green // border color 70 | imgView.borderWidth = 2 // border width 71 | ``` 72 | ## Contribute 73 | 74 | We would love you for the contribution to **TJProfileImage**, check the ``LICENSE`` file for more info. 75 | 76 | ## Meta 77 | 78 | Tejas Ardeshna – [@tejas_ardeshna](https://twitter.com/tejas_ardeshna) – tejasardeshna@gmail.com 79 | 80 | Distributed under the MIT license. See ``LICENSE`` for more information. 81 | 82 | 83 | 84 | 85 | [swift-image]:https://img.shields.io/badge/swift-3.0-orange.svg 86 | [swift-url]: https://swift.org/ 87 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg 88 | [license-url]: https://github.com/tejas-ardeshna/TJProfileImage/blob/master/LICENSE.md 89 | -------------------------------------------------------------------------------- /Screen Shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tejas-ardeshna/TJProfileImage/10e84c778c39a3a67d062220a82854e116db56f3/Screen Shot.png -------------------------------------------------------------------------------- /TJProfileImage.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B8E083741EBA028E00AF8DA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E083731EBA028E00AF8DA4 /* AppDelegate.swift */; }; 11 | B8E083761EBA028E00AF8DA4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E083751EBA028E00AF8DA4 /* ViewController.swift */; }; 12 | B8E083791EBA028E00AF8DA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B8E083771EBA028E00AF8DA4 /* Main.storyboard */; }; 13 | B8E0837B1EBA028E00AF8DA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B8E0837A1EBA028E00AF8DA4 /* Assets.xcassets */; }; 14 | B8E0837E1EBA028E00AF8DA4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B8E0837C1EBA028E00AF8DA4 /* LaunchScreen.storyboard */; }; 15 | B8E083861EBA02B700AF8DA4 /* TJProfileImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E083851EBA02B700AF8DA4 /* TJProfileImage.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | B8E083701EBA028E00AF8DA4 /* TJProfileImage.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TJProfileImage.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | B8E083731EBA028E00AF8DA4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | B8E083751EBA028E00AF8DA4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | B8E083781EBA028E00AF8DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | B8E0837A1EBA028E00AF8DA4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | B8E0837D1EBA028E00AF8DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | B8E0837F1EBA028E00AF8DA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | B8E083851EBA02B700AF8DA4 /* TJProfileImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TJProfileImage.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | B8E0836D1EBA028E00AF8DA4 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | B8E083671EBA028E00AF8DA4 = { 41 | isa = PBXGroup; 42 | children = ( 43 | B8E083721EBA028E00AF8DA4 /* TJProfileImage */, 44 | B8E083711EBA028E00AF8DA4 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | B8E083711EBA028E00AF8DA4 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | B8E083701EBA028E00AF8DA4 /* TJProfileImage.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | B8E083721EBA028E00AF8DA4 /* TJProfileImage */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | B8E083851EBA02B700AF8DA4 /* TJProfileImage.swift */, 60 | B8E083731EBA028E00AF8DA4 /* AppDelegate.swift */, 61 | B8E083751EBA028E00AF8DA4 /* ViewController.swift */, 62 | B8E083771EBA028E00AF8DA4 /* Main.storyboard */, 63 | B8E0837A1EBA028E00AF8DA4 /* Assets.xcassets */, 64 | B8E0837C1EBA028E00AF8DA4 /* LaunchScreen.storyboard */, 65 | B8E0837F1EBA028E00AF8DA4 /* Info.plist */, 66 | ); 67 | path = TJProfileImage; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXNativeTarget section */ 73 | B8E0836F1EBA028E00AF8DA4 /* TJProfileImage */ = { 74 | isa = PBXNativeTarget; 75 | buildConfigurationList = B8E083821EBA028E00AF8DA4 /* Build configuration list for PBXNativeTarget "TJProfileImage" */; 76 | buildPhases = ( 77 | B8E0836C1EBA028E00AF8DA4 /* Sources */, 78 | B8E0836D1EBA028E00AF8DA4 /* Frameworks */, 79 | B8E0836E1EBA028E00AF8DA4 /* Resources */, 80 | ); 81 | buildRules = ( 82 | ); 83 | dependencies = ( 84 | ); 85 | name = TJProfileImage; 86 | productName = TJProfileImage; 87 | productReference = B8E083701EBA028E00AF8DA4 /* TJProfileImage.app */; 88 | productType = "com.apple.product-type.application"; 89 | }; 90 | /* End PBXNativeTarget section */ 91 | 92 | /* Begin PBXProject section */ 93 | B8E083681EBA028E00AF8DA4 /* Project object */ = { 94 | isa = PBXProject; 95 | attributes = { 96 | LastSwiftUpdateCheck = 0830; 97 | LastUpgradeCheck = 0830; 98 | ORGANIZATIONNAME = "Tejas Ardeshna"; 99 | TargetAttributes = { 100 | B8E0836F1EBA028E00AF8DA4 = { 101 | CreatedOnToolsVersion = 8.3.2; 102 | DevelopmentTeam = Y98X8JAPH6; 103 | ProvisioningStyle = Automatic; 104 | }; 105 | }; 106 | }; 107 | buildConfigurationList = B8E0836B1EBA028E00AF8DA4 /* Build configuration list for PBXProject "TJProfileImage" */; 108 | compatibilityVersion = "Xcode 3.2"; 109 | developmentRegion = English; 110 | hasScannedForEncodings = 0; 111 | knownRegions = ( 112 | en, 113 | Base, 114 | ); 115 | mainGroup = B8E083671EBA028E00AF8DA4; 116 | productRefGroup = B8E083711EBA028E00AF8DA4 /* Products */; 117 | projectDirPath = ""; 118 | projectRoot = ""; 119 | targets = ( 120 | B8E0836F1EBA028E00AF8DA4 /* TJProfileImage */, 121 | ); 122 | }; 123 | /* End PBXProject section */ 124 | 125 | /* Begin PBXResourcesBuildPhase section */ 126 | B8E0836E1EBA028E00AF8DA4 /* Resources */ = { 127 | isa = PBXResourcesBuildPhase; 128 | buildActionMask = 2147483647; 129 | files = ( 130 | B8E0837E1EBA028E00AF8DA4 /* LaunchScreen.storyboard in Resources */, 131 | B8E0837B1EBA028E00AF8DA4 /* Assets.xcassets in Resources */, 132 | B8E083791EBA028E00AF8DA4 /* Main.storyboard in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | B8E0836C1EBA028E00AF8DA4 /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | B8E083761EBA028E00AF8DA4 /* ViewController.swift in Sources */, 144 | B8E083861EBA02B700AF8DA4 /* TJProfileImage.swift in Sources */, 145 | B8E083741EBA028E00AF8DA4 /* AppDelegate.swift in Sources */, 146 | ); 147 | runOnlyForDeploymentPostprocessing = 0; 148 | }; 149 | /* End PBXSourcesBuildPhase section */ 150 | 151 | /* Begin PBXVariantGroup section */ 152 | B8E083771EBA028E00AF8DA4 /* Main.storyboard */ = { 153 | isa = PBXVariantGroup; 154 | children = ( 155 | B8E083781EBA028E00AF8DA4 /* Base */, 156 | ); 157 | name = Main.storyboard; 158 | sourceTree = ""; 159 | }; 160 | B8E0837C1EBA028E00AF8DA4 /* LaunchScreen.storyboard */ = { 161 | isa = PBXVariantGroup; 162 | children = ( 163 | B8E0837D1EBA028E00AF8DA4 /* Base */, 164 | ); 165 | name = LaunchScreen.storyboard; 166 | sourceTree = ""; 167 | }; 168 | /* End PBXVariantGroup section */ 169 | 170 | /* Begin XCBuildConfiguration section */ 171 | B8E083801EBA028E00AF8DA4 /* Debug */ = { 172 | isa = XCBuildConfiguration; 173 | buildSettings = { 174 | ALWAYS_SEARCH_USER_PATHS = NO; 175 | CLANG_ANALYZER_NONNULL = YES; 176 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 177 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 178 | CLANG_CXX_LIBRARY = "libc++"; 179 | CLANG_ENABLE_MODULES = YES; 180 | CLANG_ENABLE_OBJC_ARC = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_CONSTANT_CONVERSION = YES; 183 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 184 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 185 | CLANG_WARN_EMPTY_BODY = YES; 186 | CLANG_WARN_ENUM_CONVERSION = YES; 187 | CLANG_WARN_INFINITE_RECURSION = YES; 188 | CLANG_WARN_INT_CONVERSION = YES; 189 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 190 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 191 | CLANG_WARN_UNREACHABLE_CODE = YES; 192 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 193 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 194 | COPY_PHASE_STRIP = NO; 195 | DEBUG_INFORMATION_FORMAT = dwarf; 196 | ENABLE_STRICT_OBJC_MSGSEND = YES; 197 | ENABLE_TESTABILITY = YES; 198 | GCC_C_LANGUAGE_STANDARD = gnu99; 199 | GCC_DYNAMIC_NO_PIC = NO; 200 | GCC_NO_COMMON_BLOCKS = YES; 201 | GCC_OPTIMIZATION_LEVEL = 0; 202 | GCC_PREPROCESSOR_DEFINITIONS = ( 203 | "DEBUG=1", 204 | "$(inherited)", 205 | ); 206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 208 | GCC_WARN_UNDECLARED_SELECTOR = YES; 209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 210 | GCC_WARN_UNUSED_FUNCTION = YES; 211 | GCC_WARN_UNUSED_VARIABLE = YES; 212 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 213 | MTL_ENABLE_DEBUG_INFO = YES; 214 | ONLY_ACTIVE_ARCH = YES; 215 | SDKROOT = iphoneos; 216 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 217 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 218 | }; 219 | name = Debug; 220 | }; 221 | B8E083811EBA028E00AF8DA4 /* Release */ = { 222 | isa = XCBuildConfiguration; 223 | buildSettings = { 224 | ALWAYS_SEARCH_USER_PATHS = NO; 225 | CLANG_ANALYZER_NONNULL = YES; 226 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 227 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 228 | CLANG_CXX_LIBRARY = "libc++"; 229 | CLANG_ENABLE_MODULES = YES; 230 | CLANG_ENABLE_OBJC_ARC = YES; 231 | CLANG_WARN_BOOL_CONVERSION = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INFINITE_RECURSION = YES; 238 | CLANG_WARN_INT_CONVERSION = YES; 239 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 240 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 241 | CLANG_WARN_UNREACHABLE_CODE = YES; 242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 243 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 244 | COPY_PHASE_STRIP = NO; 245 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 246 | ENABLE_NS_ASSERTIONS = NO; 247 | ENABLE_STRICT_OBJC_MSGSEND = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu99; 249 | GCC_NO_COMMON_BLOCKS = YES; 250 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 252 | GCC_WARN_UNDECLARED_SELECTOR = YES; 253 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 254 | GCC_WARN_UNUSED_FUNCTION = YES; 255 | GCC_WARN_UNUSED_VARIABLE = YES; 256 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 257 | MTL_ENABLE_DEBUG_INFO = NO; 258 | SDKROOT = iphoneos; 259 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 260 | VALIDATE_PRODUCT = YES; 261 | }; 262 | name = Release; 263 | }; 264 | B8E083831EBA028E00AF8DA4 /* Debug */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 268 | DEVELOPMENT_TEAM = Y98X8JAPH6; 269 | INFOPLIST_FILE = TJProfileImage/Info.plist; 270 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 271 | PRODUCT_BUNDLE_IDENTIFIER = com.jalsa.TJProfileImage; 272 | PRODUCT_NAME = "$(TARGET_NAME)"; 273 | SWIFT_VERSION = 3.0; 274 | }; 275 | name = Debug; 276 | }; 277 | B8E083841EBA028E00AF8DA4 /* Release */ = { 278 | isa = XCBuildConfiguration; 279 | buildSettings = { 280 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 281 | DEVELOPMENT_TEAM = Y98X8JAPH6; 282 | INFOPLIST_FILE = TJProfileImage/Info.plist; 283 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 284 | PRODUCT_BUNDLE_IDENTIFIER = com.jalsa.TJProfileImage; 285 | PRODUCT_NAME = "$(TARGET_NAME)"; 286 | SWIFT_VERSION = 3.0; 287 | }; 288 | name = Release; 289 | }; 290 | /* End XCBuildConfiguration section */ 291 | 292 | /* Begin XCConfigurationList section */ 293 | B8E0836B1EBA028E00AF8DA4 /* Build configuration list for PBXProject "TJProfileImage" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | B8E083801EBA028E00AF8DA4 /* Debug */, 297 | B8E083811EBA028E00AF8DA4 /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | B8E083821EBA028E00AF8DA4 /* Build configuration list for PBXNativeTarget "TJProfileImage" */ = { 303 | isa = XCConfigurationList; 304 | buildConfigurations = ( 305 | B8E083831EBA028E00AF8DA4 /* Debug */, 306 | B8E083841EBA028E00AF8DA4 /* Release */, 307 | ); 308 | defaultConfigurationIsVisible = 0; 309 | }; 310 | /* End XCConfigurationList section */ 311 | }; 312 | rootObject = B8E083681EBA028E00AF8DA4 /* Project object */; 313 | } 314 | -------------------------------------------------------------------------------- /TJProfileImage.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TJProfileImage/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TJProfileImage 4 | // 5 | // Created by Tejas Ardeshna on 03/05/17. 6 | // Copyright © 2017 Tejas Ardeshna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /TJProfileImage/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 | } -------------------------------------------------------------------------------- /TJProfileImage/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 | -------------------------------------------------------------------------------- /TJProfileImage/Base.lproj/Main.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 | 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 | -------------------------------------------------------------------------------- /TJProfileImage/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /TJProfileImage/TJProfileImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TJProfileImage.swift 3 | // TJProfileImage 4 | // 5 | // Created by Tejas Ardeshna on 02/05/17. 6 | // Copyright © 2017 Tejas Ardeshna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | @IBDesignable class TJProfileImage:UIImageView { 11 | 12 | @IBInspectable var dashedBorder: Bool = false { 13 | didSet { 14 | self.setNeedsLayout() 15 | } 16 | } 17 | @IBInspectable var isCircular: Bool = false { 18 | didSet { 19 | self.setNeedsLayout() 20 | } 21 | } 22 | @IBInspectable var cornerRadious: CGFloat = 5 { 23 | didSet { 24 | self.setNeedsLayout() 25 | } 26 | } 27 | @IBInspectable var borderColor: UIColor = UIColor.blue { 28 | didSet { 29 | self.setNeedsLayout() 30 | } 31 | } 32 | @IBInspectable var borderWidth: CGFloat = 0.0 { 33 | didSet { 34 | self.setNeedsLayout() 35 | } 36 | } 37 | 38 | 39 | override func awakeFromNib() { 40 | super.awakeFromNib() 41 | self.layoutIfNeeded() 42 | self.applyProperties() 43 | } 44 | required init(coder aDecoder: NSCoder) { 45 | super.init(coder: aDecoder)! 46 | self.setNeedsDisplay() 47 | } 48 | 49 | override init(frame: CGRect) { 50 | super.init(frame: frame) 51 | self.setNeedsDisplay() 52 | } 53 | 54 | override func layoutSubviews() { 55 | self.applyProperties() 56 | } 57 | func applyProperties() 58 | { 59 | let shapeLayer:CAShapeLayer = CAShapeLayer() 60 | let frameSize = self.frame.size 61 | let shapeRect = CGRect(x: 0, y: 0, width: frameSize.width, height: frameSize.height) 62 | 63 | shapeLayer.bounds = shapeRect 64 | shapeLayer.position = CGPoint(x: frameSize.width/2, y: frameSize.height/2) 65 | shapeLayer.fillColor = UIColor.clear.cgColor 66 | shapeLayer.strokeColor = borderColor.cgColor 67 | shapeLayer.lineWidth = borderWidth 68 | shapeLayer.lineJoin = kCALineJoinRound 69 | if dashedBorder{ 70 | shapeLayer.lineDashPattern = [6,3] 71 | } 72 | shapeLayer.path = UIBezierPath(roundedRect: shapeRect, cornerRadius: isCircular ? CGFloat(self.frame.size.height / 2.0) : cornerRadious).cgPath 73 | self.layer.cornerRadius = isCircular ? CGFloat(self.frame.size.height / 2.0) : cornerRadious 74 | self.layer.masksToBounds = true 75 | self.layer.addSublayer(shapeLayer) 76 | //self.layer.insertSublayer(shapeLayer, at: 0) 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /TJProfileImage/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // TJProfileImage 4 | // 5 | // Created by Tejas Ardeshna on 03/05/17. 6 | // Copyright © 2017 Tejas Ardeshna. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | } 17 | 18 | override func didReceiveMemoryWarning() { 19 | super.didReceiveMemoryWarning() 20 | // Dispose of any resources that can be recreated. 21 | } 22 | 23 | 24 | } 25 | 26 | --------------------------------------------------------------------------------