├── .gitignore ├── .travis.yml ├── Cartfile ├── Cartfile.resolved ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Example.xcworkspace │ └── contents.xcworkspacedata ├── Example │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── 924057_811750272253472_807359659_n.imageset │ │ │ ├── 924057_811750272253472_807359659_n.jpg │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── PreviewViewController.swift │ └── ViewController.swift ├── ExampleTests │ ├── ExampleTests.swift │ └── Info.plist ├── PodFile └── Podfile.lock ├── LICENSE ├── README.md ├── Source ├── DrawTextView.swift ├── TextDrawer.h ├── TextDrawer.swift └── TextEditView.swift ├── TextDrawer.podspec ├── TextDrawer.xcworkspace └── contents.xcworkspacedata └── TextDrawer ├── TextDrawer.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── TextDrawer.xcscheme ├── TextDrawer ├── DrawTextView.swift ├── Info.plist ├── TextDrawer.h ├── TextDrawer.swift └── TextEditView.swift └── TextDrawerTests ├── Info.plist └── TextDrawerTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | xcode_project: TextDrawer/TextDrawer.xcodeproj 4 | xcode_scheme: TextDrawer/TextDrawerTests 5 | 6 | before_install: 7 | - brew update 8 | - brew upgrade xctool 9 | - brew install carthage 10 | - carthage bootstrap --verbose 11 | 12 | script: 13 | - xcodebuild clean build -project TextDrawer/TextDrawer.xcodeproj -scheme TextDrawer 14 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "SnapKit/SnapKit" -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "SnapKit/Masonry" "v0.6.4" 2 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 819DBA54094CF16F1238EACB /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23FC3F5EF27A57A6D25642AC /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 11 | BB77888A1B5940F000844CEA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7788891B5940F000844CEA /* AppDelegate.swift */; }; 12 | BB77888C1B5940F000844CEA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB77888B1B5940F000844CEA /* ViewController.swift */; }; 13 | BB77888F1B5940F000844CEA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB77888D1B5940F000844CEA /* Main.storyboard */; }; 14 | BB7788911B5940F000844CEA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BB7788901B5940F000844CEA /* Images.xcassets */; }; 15 | BB7788941B5940F000844CEA /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB7788921B5940F000844CEA /* LaunchScreen.xib */; }; 16 | BB7788A01B5940F100844CEA /* ExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB77889F1B5940F100844CEA /* ExampleTests.swift */; }; 17 | BBC02C4E1B5D143700E4BBEA /* PreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC02C4D1B5D143700E4BBEA /* PreviewViewController.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | BB77889A1B5940F000844CEA /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = BB77887C1B5940F000844CEA /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = BB7788831B5940F000844CEA; 26 | remoteInfo = Example; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 23FC3F5EF27A57A6D25642AC /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 27F8F3F4A80B7C94AB048318 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 33 | A604FC3B2D1EA5DCEF91808B /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 34 | BB7788841B5940F000844CEA /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | BB7788881B5940F000844CEA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | BB7788891B5940F000844CEA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | BB77888B1B5940F000844CEA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | BB77888E1B5940F000844CEA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | BB7788901B5940F000844CEA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | BB7788931B5940F000844CEA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | BB7788991B5940F000844CEA /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | BB77889E1B5940F100844CEA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | BB77889F1B5940F100844CEA /* ExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleTests.swift; sourceTree = ""; }; 44 | BBC02C4D1B5D143700E4BBEA /* PreviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreviewViewController.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | BB7788811B5940F000844CEA /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | 819DBA54094CF16F1238EACB /* Pods.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | BB7788961B5940F000844CEA /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | B5C26DE1791D445BB83D4F54 /* Pods */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 27F8F3F4A80B7C94AB048318 /* Pods.debug.xcconfig */, 70 | A604FC3B2D1EA5DCEF91808B /* Pods.release.xcconfig */, 71 | ); 72 | name = Pods; 73 | sourceTree = ""; 74 | }; 75 | BB77887B1B5940F000844CEA = { 76 | isa = PBXGroup; 77 | children = ( 78 | BB7788861B5940F000844CEA /* Example */, 79 | BB77889C1B5940F100844CEA /* ExampleTests */, 80 | BB7788851B5940F000844CEA /* Products */, 81 | B5C26DE1791D445BB83D4F54 /* Pods */, 82 | C8EEF005989FDBF24D46977B /* Frameworks */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | BB7788851B5940F000844CEA /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | BB7788841B5940F000844CEA /* Example.app */, 90 | BB7788991B5940F000844CEA /* ExampleTests.xctest */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | BB7788861B5940F000844CEA /* Example */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | BBC02C4D1B5D143700E4BBEA /* PreviewViewController.swift */, 99 | BB7788891B5940F000844CEA /* AppDelegate.swift */, 100 | BB77888B1B5940F000844CEA /* ViewController.swift */, 101 | BB77888D1B5940F000844CEA /* Main.storyboard */, 102 | BB7788901B5940F000844CEA /* Images.xcassets */, 103 | BB7788921B5940F000844CEA /* LaunchScreen.xib */, 104 | BB7788871B5940F000844CEA /* Supporting Files */, 105 | ); 106 | path = Example; 107 | sourceTree = ""; 108 | }; 109 | BB7788871B5940F000844CEA /* Supporting Files */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | BB7788881B5940F000844CEA /* Info.plist */, 113 | ); 114 | name = "Supporting Files"; 115 | sourceTree = ""; 116 | }; 117 | BB77889C1B5940F100844CEA /* ExampleTests */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | BB77889F1B5940F100844CEA /* ExampleTests.swift */, 121 | BB77889D1B5940F100844CEA /* Supporting Files */, 122 | ); 123 | path = ExampleTests; 124 | sourceTree = ""; 125 | }; 126 | BB77889D1B5940F100844CEA /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | BB77889E1B5940F100844CEA /* Info.plist */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | C8EEF005989FDBF24D46977B /* Frameworks */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 23FC3F5EF27A57A6D25642AC /* Pods.framework */, 138 | ); 139 | name = Frameworks; 140 | sourceTree = ""; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | BB7788831B5940F000844CEA /* Example */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = BB7788A31B5940F100844CEA /* Build configuration list for PBXNativeTarget "Example" */; 148 | buildPhases = ( 149 | 75A663AD5F51A43A50BC3FE1 /* Check Pods Manifest.lock */, 150 | BB7788801B5940F000844CEA /* Sources */, 151 | BB7788811B5940F000844CEA /* Frameworks */, 152 | BB7788821B5940F000844CEA /* Resources */, 153 | 3A3C17F182CA74A690F5B746 /* Embed Pods Frameworks */, 154 | FC0CA6A49D6739A456817E0F /* Copy Pods Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = Example; 161 | productName = Example; 162 | productReference = BB7788841B5940F000844CEA /* Example.app */; 163 | productType = "com.apple.product-type.application"; 164 | }; 165 | BB7788981B5940F000844CEA /* ExampleTests */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = BB7788A61B5940F100844CEA /* Build configuration list for PBXNativeTarget "ExampleTests" */; 168 | buildPhases = ( 169 | BB7788951B5940F000844CEA /* Sources */, 170 | BB7788961B5940F000844CEA /* Frameworks */, 171 | BB7788971B5940F000844CEA /* Resources */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | BB77889B1B5940F000844CEA /* PBXTargetDependency */, 177 | ); 178 | name = ExampleTests; 179 | productName = ExampleTests; 180 | productReference = BB7788991B5940F000844CEA /* ExampleTests.xctest */; 181 | productType = "com.apple.product-type.bundle.unit-test"; 182 | }; 183 | /* End PBXNativeTarget section */ 184 | 185 | /* Begin PBXProject section */ 186 | BB77887C1B5940F000844CEA /* Project object */ = { 187 | isa = PBXProject; 188 | attributes = { 189 | LastSwiftMigration = 0700; 190 | LastSwiftUpdateCheck = 0700; 191 | LastUpgradeCheck = 0700; 192 | ORGANIZATIONNAME = "Remi Robert"; 193 | TargetAttributes = { 194 | BB7788831B5940F000844CEA = { 195 | CreatedOnToolsVersion = 6.4; 196 | }; 197 | BB7788981B5940F000844CEA = { 198 | CreatedOnToolsVersion = 6.4; 199 | TestTargetID = BB7788831B5940F000844CEA; 200 | }; 201 | }; 202 | }; 203 | buildConfigurationList = BB77887F1B5940F000844CEA /* Build configuration list for PBXProject "Example" */; 204 | compatibilityVersion = "Xcode 3.2"; 205 | developmentRegion = English; 206 | hasScannedForEncodings = 0; 207 | knownRegions = ( 208 | en, 209 | Base, 210 | ); 211 | mainGroup = BB77887B1B5940F000844CEA; 212 | productRefGroup = BB7788851B5940F000844CEA /* Products */; 213 | projectDirPath = ""; 214 | projectRoot = ""; 215 | targets = ( 216 | BB7788831B5940F000844CEA /* Example */, 217 | BB7788981B5940F000844CEA /* ExampleTests */, 218 | ); 219 | }; 220 | /* End PBXProject section */ 221 | 222 | /* Begin PBXResourcesBuildPhase section */ 223 | BB7788821B5940F000844CEA /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | BB77888F1B5940F000844CEA /* Main.storyboard in Resources */, 228 | BB7788941B5940F000844CEA /* LaunchScreen.xib in Resources */, 229 | BB7788911B5940F000844CEA /* Images.xcassets in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | BB7788971B5940F000844CEA /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXResourcesBuildPhase section */ 241 | 242 | /* Begin PBXShellScriptBuildPhase section */ 243 | 3A3C17F182CA74A690F5B746 /* Embed Pods Frameworks */ = { 244 | isa = PBXShellScriptBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | ); 248 | inputPaths = ( 249 | ); 250 | name = "Embed Pods Frameworks"; 251 | outputPaths = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | shellPath = /bin/sh; 255 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; 256 | showEnvVarsInLog = 0; 257 | }; 258 | 75A663AD5F51A43A50BC3FE1 /* Check Pods Manifest.lock */ = { 259 | isa = PBXShellScriptBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | inputPaths = ( 264 | ); 265 | name = "Check Pods Manifest.lock"; 266 | outputPaths = ( 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | shellPath = /bin/sh; 270 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 271 | showEnvVarsInLog = 0; 272 | }; 273 | FC0CA6A49D6739A456817E0F /* Copy Pods Resources */ = { 274 | isa = PBXShellScriptBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | ); 278 | inputPaths = ( 279 | ); 280 | name = "Copy Pods Resources"; 281 | outputPaths = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | shellPath = /bin/sh; 285 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 286 | showEnvVarsInLog = 0; 287 | }; 288 | /* End PBXShellScriptBuildPhase section */ 289 | 290 | /* Begin PBXSourcesBuildPhase section */ 291 | BB7788801B5940F000844CEA /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | BB77888C1B5940F000844CEA /* ViewController.swift in Sources */, 296 | BB77888A1B5940F000844CEA /* AppDelegate.swift in Sources */, 297 | BBC02C4E1B5D143700E4BBEA /* PreviewViewController.swift in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | BB7788951B5940F000844CEA /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | BB7788A01B5940F100844CEA /* ExampleTests.swift in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | BB77889B1B5940F000844CEA /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = BB7788831B5940F000844CEA /* Example */; 315 | targetProxy = BB77889A1B5940F000844CEA /* PBXContainerItemProxy */; 316 | }; 317 | /* End PBXTargetDependency section */ 318 | 319 | /* Begin PBXVariantGroup section */ 320 | BB77888D1B5940F000844CEA /* Main.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | BB77888E1B5940F000844CEA /* Base */, 324 | ); 325 | name = Main.storyboard; 326 | sourceTree = ""; 327 | }; 328 | BB7788921B5940F000844CEA /* LaunchScreen.xib */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | BB7788931B5940F000844CEA /* Base */, 332 | ); 333 | name = LaunchScreen.xib; 334 | sourceTree = ""; 335 | }; 336 | /* End PBXVariantGroup section */ 337 | 338 | /* Begin XCBuildConfiguration section */ 339 | BB7788A11B5940F100844CEA /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_CONSTANT_CONVERSION = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INT_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 377 | MTL_ENABLE_DEBUG_INFO = YES; 378 | ONLY_ACTIVE_ARCH = YES; 379 | SDKROOT = iphoneos; 380 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 381 | }; 382 | name = Debug; 383 | }; 384 | BB7788A21B5940F100844CEA /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 389 | CLANG_CXX_LIBRARY = "libc++"; 390 | CLANG_ENABLE_MODULES = YES; 391 | CLANG_ENABLE_OBJC_ARC = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | VALIDATE_PRODUCT = YES; 418 | }; 419 | name = Release; 420 | }; 421 | BB7788A41B5940F100844CEA /* Debug */ = { 422 | isa = XCBuildConfiguration; 423 | baseConfigurationReference = 27F8F3F4A80B7C94AB048318 /* Pods.debug.xcconfig */; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | INFOPLIST_FILE = Example/Info.plist; 427 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | }; 432 | name = Debug; 433 | }; 434 | BB7788A51B5940F100844CEA /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = A604FC3B2D1EA5DCEF91808B /* Pods.release.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | INFOPLIST_FILE = Example/Info.plist; 440 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | }; 445 | name = Release; 446 | }; 447 | BB7788A71B5940F100844CEA /* Debug */ = { 448 | isa = XCBuildConfiguration; 449 | buildSettings = { 450 | BUNDLE_LOADER = "$(TEST_HOST)"; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(SDKROOT)/Developer/Library/Frameworks", 453 | "$(inherited)", 454 | ); 455 | GCC_PREPROCESSOR_DEFINITIONS = ( 456 | "DEBUG=1", 457 | "$(inherited)", 458 | ); 459 | INFOPLIST_FILE = ExampleTests/Info.plist; 460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 461 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 464 | }; 465 | name = Debug; 466 | }; 467 | BB7788A81B5940F100844CEA /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | BUNDLE_LOADER = "$(TEST_HOST)"; 471 | FRAMEWORK_SEARCH_PATHS = ( 472 | "$(SDKROOT)/Developer/Library/Frameworks", 473 | "$(inherited)", 474 | ); 475 | INFOPLIST_FILE = ExampleTests/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 477 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 478 | PRODUCT_NAME = "$(TARGET_NAME)"; 479 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; 480 | }; 481 | name = Release; 482 | }; 483 | /* End XCBuildConfiguration section */ 484 | 485 | /* Begin XCConfigurationList section */ 486 | BB77887F1B5940F000844CEA /* Build configuration list for PBXProject "Example" */ = { 487 | isa = XCConfigurationList; 488 | buildConfigurations = ( 489 | BB7788A11B5940F100844CEA /* Debug */, 490 | BB7788A21B5940F100844CEA /* Release */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | BB7788A31B5940F100844CEA /* Build configuration list for PBXNativeTarget "Example" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | BB7788A41B5940F100844CEA /* Debug */, 499 | BB7788A51B5940F100844CEA /* Release */, 500 | ); 501 | defaultConfigurationIsVisible = 0; 502 | defaultConfigurationName = Release; 503 | }; 504 | BB7788A61B5940F100844CEA /* Build configuration list for PBXNativeTarget "ExampleTests" */ = { 505 | isa = XCConfigurationList; 506 | buildConfigurations = ( 507 | BB7788A71B5940F100844CEA /* Debug */, 508 | BB7788A81B5940F100844CEA /* Release */, 509 | ); 510 | defaultConfigurationIsVisible = 0; 511 | defaultConfigurationName = Release; 512 | }; 513 | /* End XCConfigurationList section */ 514 | }; 515 | rootObject = BB77887C1B5940F000844CEA /* Project object */; 516 | } 517 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by Remi Robert on 17/07/15. 6 | // Copyright (c) 2015 Remi Robert. 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: [NSObject: AnyObject]?) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Example/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 | 36 | 61 | 88 | 115 | 142 | 154 | 166 | 178 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 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 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | -------------------------------------------------------------------------------- /Example/Example/Images.xcassets/924057_811750272253472_807359659_n.imageset/924057_811750272253472_807359659_n.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remirobert/TextDrawer/ffd6bb9c7d09fecd0f7f80a8e783bf1edddc79cb/Example/Example/Images.xcassets/924057_811750272253472_807359659_n.imageset/924057_811750272253472_807359659_n.jpg -------------------------------------------------------------------------------- /Example/Example/Images.xcassets/924057_811750272253472_807359659_n.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "924057_811750272253472_807359659_n.jpg" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Example/Images.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/Example/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/Example/PreviewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PreviewViewController.swift 3 | // 4 | // 5 | // Created by Remi Robert on 20/07/15. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | class PreviewViewController: UIViewController { 12 | 13 | var image: UIImage? 14 | @IBOutlet var imageView: UIImageView! 15 | 16 | @IBAction func returnController(sender: AnyObject) { 17 | self.navigationController?.popToRootViewControllerAnimated(true) 18 | } 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | if let image = image { 23 | imageView.image = image 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by Remi Robert on 17/07/15. 6 | // Copyright (c) 2015 Remi Robert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import TextDrawer 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet var containerControlView: UIView! 15 | @IBOutlet var drawTextView: TextDrawer! 16 | @IBOutlet var imageViewBackground: UIImageView! 17 | 18 | @IBAction func changeTextColor(sender: AnyObject) { 19 | drawTextView.textColor = (sender as! UIButton).backgroundColor 20 | } 21 | 22 | @IBAction func changeBackgroundColor(sender: AnyObject) { 23 | drawTextView.textBackgroundColor = (sender as! UIButton).backgroundColor 24 | } 25 | 26 | override func viewDidLoad() { 27 | super.viewDidLoad() 28 | 29 | drawTextView.textBackgroundColor = UIColor.clearColor() 30 | drawTextView.textColor = UIColor.whiteColor() 31 | drawTextView.text = "TextDrawer" 32 | self.view.bringSubviewToFront(containerControlView) 33 | } 34 | 35 | @IBAction func renderImage(sender: AnyObject) { 36 | //drawTextView.renderTextOnImage(imageViewBackground.image!) 37 | let image = drawTextView.renderTextOnView(imageViewBackground) 38 | self.performSegueWithIdentifier("previewSegue", sender: image) 39 | } 40 | 41 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 42 | if segue.identifier == "previewSegue" { 43 | (segue.destinationViewController as! PreviewViewController).image = sender as? UIImage 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Example/ExampleTests/ExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleTests.swift 3 | // ExampleTests 4 | // 5 | // Created by Remi Robert on 17/07/15. 6 | // Copyright (c) 2015 Remi Robert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class ExampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Example/ExampleTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/PodFile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | pod 'TextDrawer', '~> 1.0.6' 3 | 4 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Masonry (0.6.2) 3 | - TextDrawer (1.0.6): 4 | - Masonry 5 | 6 | DEPENDENCIES: 7 | - TextDrawer (~> 1.0.6) 8 | 9 | SPEC CHECKSUMS: 10 | Masonry: 362e8a1cc0beada4a4c4832d5e863da2a51533be 11 | TextDrawer: f1e7368499f747bf6c42322187f38075d453042d 12 | 13 | COCOAPODS: 0.38.0 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 rémi  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 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextDrawer 2 | [![Swift 2.0](https://img.shields.io/badge/Swift-2.0-orange.svg?style=flat)](https://developer.apple.com/swift/) 3 | ![Version Status](http://img.shields.io/cocoapods/v/TextDrawer.png) ![license MIT](http://img.shields.io/badge/license-MIT-orange.png) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | 5 | *TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage.* 6 | 7 | ## About 8 | 9 | Annotating Images 10 | 11 | TextDrawer is the easiest way to add text to `UIImage` with a touch interface. You can add text, with resizable, move, and rotate gesture with `UIGestureRecognizer`. 12 | With TextDrawer, it's easily save notes on top of a `UIImage`. 13 | 14 | ![ScreenShot](http://share.gifyoutube.com/vJAB4g.gif) 15 | 16 | ## Requirements 17 | 18 | * iOS 8 19 | * Swift 1.2 20 | 21 | ## Installation 22 | 23 | #### [CocoaPods](http://cocoapods.org) 24 | 25 | ````ruby 26 | use_frameworks! 27 | pod 'TextDrawer', '~> 1.0.6' 28 | ```` 29 | 30 | #### [Carthage](https://github.com/Carthage/Carthage) 31 | 32 | ````bash 33 | github "remirobert/TextDrawer" 34 | ```` 35 | 36 | #### Manually 37 | 38 | 1. Clone this repo and add the `TextDrawer/TextDrawer.xcodeproj` to your project 39 | 2. Select your project app target "Build Phases" tab 40 | 3. Add the `TextDrawer.framework` to the "Link Binary With Libraries" 41 | 4. Create a new build phase of type "Copy Files" and set the "Destination" to "Frameworks" 42 | 5. Add the `TextDrawer.framework` and check "Code Sign On Copy" 43 | 44 | For an example, see the demo project included in this repo. 45 | To run the example project, clone the repo, and run `pod install` from the Example directory. 46 | 47 | ## Getting Started 48 | 49 | ````swift 50 | import TextDrawer 51 | ```` 52 | 53 | ##### Design 54 | 55 | This framework is composed on different parts. 56 | The first one is the `TextEditView`. It allows you to edit the text. it is composed of a `UITextView`, and manage the keyboard notifications. 57 | Next, `DrawTextView`, is a `UIView`, showing your text in the view. 58 | And, `TextDrawer`, it contains the above views. It allows to configure some parameter (like font, size, color, etc ...). All the gestures are managed here. 59 | 60 | ## Usage 61 | Add an instance of `TextDrawer` above an `UIImageView`, or an another `UIView` (with an optional clear background). Adjust the size and layout of `TextDrawer` however you'd like. `TextDrawer` uses, `Masonry` to manage auto-layout. You don't have anything to do, after that. `TextDrawer` will handle, the gesture for you. See this screen bellow. 62 | 63 | screen shot 2015-07-21 at 14 37 45 64 | 65 | Render the `TextDrawer` to an `UIImage` outup: 66 | 67 | ```Swift 68 | // draw the TextDrawer view on an UIImageView 69 | let image = drawTextView.renderTextOnView(imageViewBackground) 70 | 71 | // render the TextDrawer View to UIImage 72 | let image = drawTextView.render() 73 | 74 | // render the TextDrawer View directly on an UIImage 75 | let image = drawTextView.renderTextOnImage(image) 76 | ``` 77 | 78 | Clear the `TextDrawer` view: 79 | 80 | ```Swift 81 | self.textDrawer.clearText() 82 | self.textDrawer.resetTransformation() 83 | ``` 84 | 85 | `TextDrawer` configuration: 86 | 87 | ```Swift 88 | drawTextView.font = UIFont.systemFontOfSize(34) 89 | drawTextView.textColor = UIColor.whiteColor() 90 | drawTextView.textAlignement = NSTextAlignment.Center 91 | drawTextView.textBackgroundColor = UIColor.redColor() 92 | drawTextView.text = "test input" 93 | drawTextView.textSize = 40 94 | ``` 95 | 96 | ## Contributors 97 | 98 | * [Rémi ROBERT](https://github.com/remirobert), creator. ( ゚ヮ゚) 99 | 100 | ## License 101 | 102 | `TextDrawer` is released under an [MIT License][mitLink]. See `LICENSE` for details. 103 | 104 | >**Copyright © 2015 Rémi ROBERT.** 105 | 106 | *Please provide attribution, it is greatly appreciated.* 107 | 108 | [mitLink]:http://opensource.org/licenses/MIT 109 | -------------------------------------------------------------------------------- /Source/DrawTextView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawTextView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | import Masonry 10 | 11 | class CustomLabel: UILabel { 12 | override func drawTextInRect(rect: CGRect) { 13 | super.drawTextInRect(UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(0, 5, 0, 5))) 14 | } 15 | } 16 | 17 | public class DrawTextView: UIView { 18 | 19 | var textLabel: CustomLabel! 20 | 21 | var text: String! { 22 | didSet { 23 | if textLabel.text == text { 24 | return 25 | } 26 | textLabel.text = text 27 | sizeTextLabel() 28 | } 29 | } 30 | 31 | init() { 32 | super.init(frame: CGRectZero) 33 | 34 | layer.masksToBounds = true 35 | backgroundColor = UIColor.clearColor() 36 | textLabel = CustomLabel() 37 | textLabel.font = textLabel.font.fontWithSize(44) 38 | textLabel.textAlignment = NSTextAlignment.Center 39 | textLabel.numberOfLines = 0 40 | textLabel.textColor = UIColor.blackColor() 41 | textLabel.backgroundColor = UIColor.clearColor() 42 | addSubview(textLabel) 43 | 44 | textLabel.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 45 | make.right.and().left().equalTo()(self) 46 | make.centerY.equalTo()(self) 47 | make.centerX.equalTo()(self) 48 | } 49 | } 50 | 51 | required public init(coder aDecoder: NSCoder) { 52 | fatalError("init(coder:) has not been implemented") 53 | } 54 | 55 | func sizeTextLabel() { 56 | let oldCenter = textLabel.center 57 | let styleText = NSMutableParagraphStyle() 58 | styleText.alignment = NSTextAlignment.Center 59 | let attributsText = [NSParagraphStyleAttributeName:styleText, NSFontAttributeName:UIFont.boldSystemFontOfSize(textLabel.font.pointSize)] 60 | let sizeParentView = CGSizeMake(CGRectGetWidth(superview!.frame) - 10, CGRectGetHeight(superview!.frame) - 10) 61 | let sizeTextLabel = (NSString(string: textLabel.text!)).boundingRectWithSize(superview!.frame.size, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: attributsText, context: nil) 62 | textLabel.frame.size = CGSizeMake(sizeTextLabel.width + 10, sizeTextLabel.height + 10) 63 | textLabel.center = oldCenter 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Source/TextDrawer.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextDrawer.h 3 | // TextDrawer 4 | // 5 | // Created by Remi Robert on 17/07/15. 6 | // Copyright (c) 2015 Remi Robert. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for TextDrawer. 12 | FOUNDATION_EXPORT double TextDrawerVersionNumber; 13 | 14 | //! Project version string for TextDrawer. 15 | FOUNDATION_EXPORT const unsigned char TextDrawerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Source/TextDrawer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | //Scrux 10 | 11 | import UIKit 12 | import Masonry 13 | 14 | public class TextDrawer: UIView, TextEditViewDelegate { 15 | 16 | private var textEditView: TextEditView! 17 | private var drawTextView: DrawTextView! 18 | 19 | private var initialTransformation: CGAffineTransform! 20 | private var initialCenterDrawTextView: CGPoint! 21 | private var initialRotationTransform: CGAffineTransform! 22 | private var initialReferenceRotationTransform: CGAffineTransform! 23 | 24 | private var activieGestureRecognizer = NSMutableSet() 25 | private var activeRotationGesture: UIRotationGestureRecognizer? 26 | private var activePinchGesture: UIPinchGestureRecognizer? 27 | 28 | private lazy var tapRecognizer: UITapGestureRecognizer! = { 29 | let tapRecognizer = UITapGestureRecognizer(target: self, action: "handleTapGesture:") 30 | tapRecognizer.delegate = self 31 | return tapRecognizer 32 | }() 33 | 34 | private lazy var panRecognizer: UIPanGestureRecognizer! = { 35 | let panRecognizer = UIPanGestureRecognizer(target: self, action: "handlePanGesture:") 36 | panRecognizer.delegate = self 37 | return panRecognizer 38 | }() 39 | 40 | private lazy var rotateRecognizer: UIRotationGestureRecognizer! = { 41 | let rotateRecognizer = UIRotationGestureRecognizer(target: self, action: "handlePinchGesture:") 42 | rotateRecognizer.delegate = self 43 | return rotateRecognizer 44 | }() 45 | 46 | private lazy var zoomRecognizer: UIPinchGestureRecognizer! = { 47 | let zoomRecognizer = UIPinchGestureRecognizer(target: self, action: "handlePinchGesture:") 48 | zoomRecognizer.delegate = self 49 | return zoomRecognizer 50 | }() 51 | 52 | public func clearText() { 53 | text = "" 54 | } 55 | 56 | public func resetTransformation() { 57 | drawTextView.transform = initialTransformation 58 | drawTextView.mas_updateConstraints({ (make: MASConstraintMaker!) -> Void in 59 | make.edges.equalTo()(self) 60 | make.centerX.and().centerY().equalTo()(self) 61 | }) 62 | drawTextView.center = center 63 | //drawTextView.sizeTextLabel() 64 | } 65 | 66 | //MARK: - 67 | //MARK: Setup DrawView 68 | 69 | private func setup() { 70 | self.layer.masksToBounds = true 71 | drawTextView = DrawTextView() 72 | initialTransformation = drawTextView.transform 73 | addSubview(drawTextView) 74 | drawTextView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 75 | make.edges.equalTo()(self) 76 | } 77 | 78 | textEditView = TextEditView() 79 | textEditView.delegate = self 80 | 81 | addSubview(textEditView) 82 | textEditView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 83 | make.edges.equalTo()(self) 84 | } 85 | 86 | addGestureRecognizer(tapRecognizer) 87 | addGestureRecognizer(panRecognizer) 88 | addGestureRecognizer(rotateRecognizer) 89 | addGestureRecognizer(zoomRecognizer) 90 | 91 | initialReferenceRotationTransform = CGAffineTransformIdentity 92 | } 93 | 94 | //MARK: - 95 | //MARK: Initialisation 96 | 97 | init() { 98 | super.init(frame: CGRectZero) 99 | setup() 100 | drawTextView.textLabel.font = drawTextView.textLabel.font.fontWithSize(44) 101 | } 102 | 103 | override init(frame: CGRect) { 104 | super.init(frame: frame) 105 | setup() 106 | } 107 | 108 | required public init?(coder aDecoder: NSCoder) { 109 | super.init(coder: aDecoder) 110 | setup() 111 | } 112 | 113 | func textEditViewFinishedEditing(text: String) { 114 | textEditView.hidden = true 115 | drawTextView.text = text 116 | } 117 | } 118 | 119 | //MARK: - 120 | //MARK: Proprety extension 121 | 122 | public extension TextDrawer { 123 | 124 | public var fontSize: CGFloat! { 125 | set { 126 | drawTextView.textLabel.font = drawTextView.textLabel.font.fontWithSize(newValue) 127 | } 128 | get { 129 | return drawTextView.textLabel.font.pointSize 130 | } 131 | } 132 | 133 | public var font: UIFont! { 134 | set { 135 | drawTextView.textLabel.font = newValue 136 | } 137 | get { 138 | return drawTextView.textLabel.font 139 | } 140 | } 141 | 142 | public var textColor: UIColor! { 143 | set { 144 | drawTextView.textLabel.textColor = newValue 145 | } 146 | get { 147 | return drawTextView.textLabel.textColor 148 | } 149 | } 150 | 151 | public var textAlignement: NSTextAlignment! { 152 | set { 153 | drawTextView.textLabel.textAlignment = newValue 154 | } 155 | get { 156 | return drawTextView.textLabel.textAlignment 157 | } 158 | } 159 | 160 | public var textBackgroundColor: UIColor! { 161 | set { 162 | drawTextView.textLabel.backgroundColor = newValue 163 | } 164 | get { 165 | return drawTextView.textLabel.backgroundColor 166 | } 167 | } 168 | 169 | public var text: String! { 170 | set { 171 | drawTextView.text = newValue 172 | } 173 | get { 174 | return drawTextView.text 175 | } 176 | } 177 | 178 | public var textSize: Int! { 179 | set { 180 | textEditView.textSize = newValue 181 | } 182 | get { 183 | return textEditView.textSize 184 | } 185 | } 186 | } 187 | 188 | //MARK: - 189 | //MARK: Gesture handler extension 190 | 191 | extension TextDrawer: UIGestureRecognizerDelegate { 192 | 193 | public func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool { 194 | return true 195 | } 196 | 197 | func handleTapGesture(recognizer: UITapGestureRecognizer) { 198 | textEditView.textEntry = text 199 | textEditView.isEditing = true 200 | textEditView.hidden = false 201 | } 202 | 203 | func handlePanGesture(recognizer: UIPanGestureRecognizer) { 204 | let translation = recognizer.translationInView(self) 205 | switch recognizer.state { 206 | case .Began, .Ended, .Failed, .Cancelled: 207 | initialCenterDrawTextView = drawTextView.center 208 | case .Changed: 209 | drawTextView.center = CGPointMake(initialCenterDrawTextView.x + translation.x, 210 | initialCenterDrawTextView.y + translation.y) 211 | default: return 212 | } 213 | } 214 | 215 | func handlePinchGesture(recognizer: UIGestureRecognizer) { 216 | var transform = initialRotationTransform 217 | 218 | switch recognizer.state { 219 | case .Began: 220 | if activieGestureRecognizer.count == 0 { 221 | initialRotationTransform = drawTextView.transform 222 | } 223 | activieGestureRecognizer.addObject(recognizer) 224 | break 225 | 226 | case .Changed: 227 | for currentRecognizer in activieGestureRecognizer { 228 | transform = applyRecogniser(currentRecognizer as? UIGestureRecognizer, currentTransform: transform) 229 | } 230 | drawTextView.transform = transform 231 | break 232 | 233 | case .Ended, .Failed, .Cancelled: 234 | initialRotationTransform = applyRecogniser(recognizer, currentTransform: initialRotationTransform) 235 | activieGestureRecognizer.removeObject(recognizer) 236 | default: return 237 | } 238 | 239 | } 240 | 241 | private func applyRecogniser(recognizer: UIGestureRecognizer?, currentTransform: CGAffineTransform) -> CGAffineTransform { 242 | if let recognizer = recognizer { 243 | if recognizer is UIRotationGestureRecognizer { 244 | return CGAffineTransformRotate(currentTransform, (recognizer as! UIRotationGestureRecognizer).rotation) 245 | } 246 | if recognizer is UIPinchGestureRecognizer { 247 | let scale = (recognizer as! UIPinchGestureRecognizer).scale 248 | return CGAffineTransformScale(currentTransform, scale, scale) 249 | } 250 | } 251 | return currentTransform 252 | } 253 | } 254 | 255 | //MARK: - 256 | //MARK: Render extension 257 | 258 | public extension TextDrawer { 259 | 260 | public func render() -> UIImage? { 261 | return renderTextOnView(self) 262 | } 263 | 264 | public func renderTextOnView(view: UIView) -> UIImage? { 265 | let size = UIScreen.mainScreen().bounds.size 266 | 267 | UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, 0) 268 | 269 | view.layer.renderInContext(UIGraphicsGetCurrentContext()!) 270 | let img = UIGraphicsGetImageFromCurrentImageContext() 271 | 272 | UIGraphicsEndImageContext() 273 | return renderTextOnImage(img) 274 | } 275 | 276 | public func renderTextOnImage(image: UIImage) -> UIImage? { 277 | let size = image.size 278 | let scale = size.width / CGRectGetWidth(self.bounds) 279 | let color = layer.backgroundColor 280 | 281 | UIGraphicsBeginImageContextWithOptions(self.bounds.size, false, 0) 282 | 283 | image.drawInRect(CGRectMake(CGRectGetWidth(self.bounds) / 2 - (image.size.width / scale) / 2, 284 | CGRectGetHeight(self.bounds) / 2 - (image.size.height / scale) / 2, 285 | image.size.width / scale, 286 | image.size.height / scale)) 287 | layer.backgroundColor = UIColor.clearColor().CGColor 288 | layer.renderInContext(UIGraphicsGetCurrentContext()!) 289 | layer.backgroundColor = color 290 | 291 | 292 | let drawnImage = UIGraphicsGetImageFromCurrentImageContext(); 293 | UIGraphicsEndImageContext(); 294 | return UIImage(CGImage: drawnImage.CGImage!, scale: 1, orientation: drawnImage.imageOrientation) 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /Source/TextEditView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextEditView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | import UIKit 10 | import Masonry 11 | 12 | protocol TextEditViewDelegate { 13 | func textEditViewFinishedEditing(text: String) 14 | } 15 | 16 | public class TextEditView: UIView { 17 | 18 | private var textView: UITextView! 19 | private var textContainer: UIView! 20 | 21 | var delegate: TextEditViewDelegate? 22 | 23 | var textSize: Int! = 42 24 | 25 | var textEntry: String! { 26 | set { 27 | textView.text = newValue 28 | } 29 | get { 30 | return textView.text 31 | } 32 | } 33 | 34 | var isEditing: Bool! { 35 | didSet { 36 | if isEditing == true { 37 | textContainer.hidden = false; 38 | userInteractionEnabled = true; 39 | backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.65) 40 | textView.becomeFirstResponder() 41 | } 42 | else { 43 | backgroundColor = UIColor.clearColor() 44 | textView.resignFirstResponder() 45 | textContainer.hidden = true; 46 | userInteractionEnabled = false; 47 | delegate?.textEditViewFinishedEditing(textView.text) 48 | } 49 | } 50 | } 51 | 52 | init() { 53 | super.init(frame: CGRectZero) 54 | 55 | isEditing = false 56 | textContainer = UIView() 57 | textContainer.layer.masksToBounds = true 58 | addSubview(textContainer) 59 | textContainer.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 60 | make.edges.equalTo()(self) 61 | } 62 | 63 | textView = UITextView() 64 | textView.tintColor = UIColor.whiteColor() 65 | textView.font = UIFont.systemFontOfSize(44) 66 | textView.textColor = UIColor.whiteColor() 67 | textView.backgroundColor = UIColor.clearColor() 68 | textView.returnKeyType = UIReturnKeyType.Done 69 | textView.clipsToBounds = true 70 | textView.delegate = self 71 | 72 | textContainer.addSubview(textView) 73 | textView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 74 | make.edges.equalTo()(self.textContainer) 75 | } 76 | 77 | textContainer.hidden = true 78 | userInteractionEnabled = false 79 | 80 | keyboardNotification() 81 | } 82 | 83 | required public init(coder aDecoder: NSCoder) { 84 | fatalError("init(coder:) has not been implemented") 85 | } 86 | 87 | deinit { 88 | NSNotificationCenter.defaultCenter().removeObserver(self) 89 | } 90 | } 91 | 92 | extension TextEditView: UITextViewDelegate { 93 | 94 | public func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool { 95 | if text == "\n" { 96 | isEditing = false 97 | return false 98 | } 99 | if textView.text.characters.count + text.characters.count > textSize { 100 | return false 101 | } 102 | return true 103 | } 104 | } 105 | 106 | extension TextEditView { 107 | 108 | func keyboardNotification() { 109 | NSNotificationCenter.defaultCenter().addObserverForName(UIKeyboardWillChangeFrameNotification, object: nil, queue: nil) { (notification: NSNotification!) -> Void in 110 | if let userInfo = notification.userInfo { 111 | self.textContainer.layer.removeAllAnimations() 112 | if let keyboardRectEnd = userInfo[UIKeyboardFrameEndUserInfoKey]?.CGRectValue(), 113 | let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey]?.floatValue { 114 | 115 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 116 | self.textContainer.mas_updateConstraints({ (make: MASConstraintMaker!) -> Void in 117 | make.bottom.offset()(-CGRectGetHeight(keyboardRectEnd)) 118 | }) 119 | UIView.animateWithDuration(NSTimeInterval(duration), delay: 0, options: UIViewAnimationOptions.BeginFromCurrentState, animations: { () -> Void in 120 | self.textContainer.layoutIfNeeded() 121 | }, completion: nil) 122 | }) 123 | } 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /TextDrawer.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "TextDrawer" 3 | s.version = "1.0.6" 4 | s.summary = "TextDrawer, is a UIView allows you to add text, with gesture, on UIView, or UIImage." 5 | s.requires_arc = true 6 | s.homepage = "https://github.com/remirobert/TextDrawer" 7 | s.ios.deployment_target = '8.0' 8 | s.screenshots = "http://share.gifyoutube.com/vJAB4g.gif" 9 | 10 | s.license = "MIT" 11 | 12 | s.social_media_url = 'https://twitter.com/remi936' 13 | s.author = { "rémi " => "remirobert33530@gmail.com" } 14 | 15 | s.source = { :git => "https://github.com/remirobert/TextDrawer.git", :tag => "1.0.6" } 16 | s.source_files = 'TextDrawer/TextDrawer/*.swift' 17 | s.dependency 'Masonry' 18 | end 19 | -------------------------------------------------------------------------------- /TextDrawer.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BBC02C2D1B5CECA600E4BBEA /* TextDrawer.h in Headers */ = {isa = PBXBuildFile; fileRef = BBC02C2C1B5CECA600E4BBEA /* TextDrawer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | BBC02C331B5CECA700E4BBEA /* TextDrawer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBC02C271B5CECA600E4BBEA /* TextDrawer.framework */; }; 12 | BBC02C3A1B5CECA700E4BBEA /* TextDrawerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC02C391B5CECA700E4BBEA /* TextDrawerTests.swift */; }; 13 | BBC02C461B5CECC500E4BBEA /* DrawTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC02C431B5CECC500E4BBEA /* DrawTextView.swift */; }; 14 | BBC02C471B5CECC500E4BBEA /* TextDrawer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC02C441B5CECC500E4BBEA /* TextDrawer.swift */; }; 15 | BBC02C481B5CECC500E4BBEA /* TextEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC02C451B5CECC500E4BBEA /* TextEditView.swift */; }; 16 | BBC02C511B5D31D000E4BBEA /* Masonry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBC02C501B5D31D000E4BBEA /* Masonry.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | BBC02C341B5CECA700E4BBEA /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = BBC02C1E1B5CECA600E4BBEA /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = BBC02C261B5CECA600E4BBEA; 25 | remoteInfo = TextDrawer; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | BBC02C271B5CECA600E4BBEA /* TextDrawer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TextDrawer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | BBC02C2B1B5CECA600E4BBEA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | BBC02C2C1B5CECA600E4BBEA /* TextDrawer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextDrawer.h; sourceTree = ""; }; 33 | BBC02C321B5CECA700E4BBEA /* TextDrawerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TextDrawerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | BBC02C381B5CECA700E4BBEA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | BBC02C391B5CECA700E4BBEA /* TextDrawerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextDrawerTests.swift; sourceTree = ""; }; 36 | BBC02C431B5CECC500E4BBEA /* DrawTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawTextView.swift; sourceTree = ""; }; 37 | BBC02C441B5CECC500E4BBEA /* TextDrawer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextDrawer.swift; sourceTree = ""; }; 38 | BBC02C451B5CECC500E4BBEA /* TextEditView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextEditView.swift; sourceTree = ""; }; 39 | BBC02C501B5D31D000E4BBEA /* Masonry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Masonry.framework; path = ../Carthage/Build/iOS/Masonry.framework; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | BBC02C231B5CECA600E4BBEA /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | BBC02C511B5D31D000E4BBEA /* Masonry.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | BBC02C2F1B5CECA700E4BBEA /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | BBC02C331B5CECA700E4BBEA /* TextDrawer.framework in Frameworks */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | BBC02C1D1B5CECA600E4BBEA = { 63 | isa = PBXGroup; 64 | children = ( 65 | BBC02C501B5D31D000E4BBEA /* Masonry.framework */, 66 | BBC02C291B5CECA600E4BBEA /* TextDrawer */, 67 | BBC02C361B5CECA700E4BBEA /* TextDrawerTests */, 68 | BBC02C281B5CECA600E4BBEA /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | BBC02C281B5CECA600E4BBEA /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | BBC02C271B5CECA600E4BBEA /* TextDrawer.framework */, 76 | BBC02C321B5CECA700E4BBEA /* TextDrawerTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | BBC02C291B5CECA600E4BBEA /* TextDrawer */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | BBC02C2C1B5CECA600E4BBEA /* TextDrawer.h */, 85 | BBC02C431B5CECC500E4BBEA /* DrawTextView.swift */, 86 | BBC02C441B5CECC500E4BBEA /* TextDrawer.swift */, 87 | BBC02C451B5CECC500E4BBEA /* TextEditView.swift */, 88 | BBC02C2A1B5CECA600E4BBEA /* Supporting Files */, 89 | ); 90 | path = TextDrawer; 91 | sourceTree = ""; 92 | }; 93 | BBC02C2A1B5CECA600E4BBEA /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | BBC02C2B1B5CECA600E4BBEA /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | BBC02C361B5CECA700E4BBEA /* TextDrawerTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | BBC02C391B5CECA700E4BBEA /* TextDrawerTests.swift */, 105 | BBC02C371B5CECA700E4BBEA /* Supporting Files */, 106 | ); 107 | path = TextDrawerTests; 108 | sourceTree = ""; 109 | }; 110 | BBC02C371B5CECA700E4BBEA /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | BBC02C381B5CECA700E4BBEA /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXHeadersBuildPhase section */ 121 | BBC02C241B5CECA600E4BBEA /* Headers */ = { 122 | isa = PBXHeadersBuildPhase; 123 | buildActionMask = 2147483647; 124 | files = ( 125 | BBC02C2D1B5CECA600E4BBEA /* TextDrawer.h in Headers */, 126 | ); 127 | runOnlyForDeploymentPostprocessing = 0; 128 | }; 129 | /* End PBXHeadersBuildPhase section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | BBC02C261B5CECA600E4BBEA /* TextDrawer */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = BBC02C3D1B5CECA700E4BBEA /* Build configuration list for PBXNativeTarget "TextDrawer" */; 135 | buildPhases = ( 136 | BBC02C221B5CECA600E4BBEA /* Sources */, 137 | BBC02C231B5CECA600E4BBEA /* Frameworks */, 138 | BBC02C241B5CECA600E4BBEA /* Headers */, 139 | BBC02C251B5CECA600E4BBEA /* Resources */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | ); 145 | name = TextDrawer; 146 | productName = TextDrawer; 147 | productReference = BBC02C271B5CECA600E4BBEA /* TextDrawer.framework */; 148 | productType = "com.apple.product-type.framework"; 149 | }; 150 | BBC02C311B5CECA700E4BBEA /* TextDrawerTests */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = BBC02C401B5CECA700E4BBEA /* Build configuration list for PBXNativeTarget "TextDrawerTests" */; 153 | buildPhases = ( 154 | BBC02C2E1B5CECA700E4BBEA /* Sources */, 155 | BBC02C2F1B5CECA700E4BBEA /* Frameworks */, 156 | BBC02C301B5CECA700E4BBEA /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | BBC02C351B5CECA700E4BBEA /* PBXTargetDependency */, 162 | ); 163 | name = TextDrawerTests; 164 | productName = TextDrawerTests; 165 | productReference = BBC02C321B5CECA700E4BBEA /* TextDrawerTests.xctest */; 166 | productType = "com.apple.product-type.bundle.unit-test"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | BBC02C1E1B5CECA600E4BBEA /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastSwiftMigration = 0700; 175 | LastSwiftUpdateCheck = 0700; 176 | LastUpgradeCheck = 0700; 177 | ORGANIZATIONNAME = "Remi Robert"; 178 | TargetAttributes = { 179 | BBC02C261B5CECA600E4BBEA = { 180 | CreatedOnToolsVersion = 6.4; 181 | }; 182 | BBC02C311B5CECA700E4BBEA = { 183 | CreatedOnToolsVersion = 6.4; 184 | }; 185 | }; 186 | }; 187 | buildConfigurationList = BBC02C211B5CECA600E4BBEA /* Build configuration list for PBXProject "TextDrawer" */; 188 | compatibilityVersion = "Xcode 3.2"; 189 | developmentRegion = English; 190 | hasScannedForEncodings = 0; 191 | knownRegions = ( 192 | en, 193 | ); 194 | mainGroup = BBC02C1D1B5CECA600E4BBEA; 195 | productRefGroup = BBC02C281B5CECA600E4BBEA /* Products */; 196 | projectDirPath = ""; 197 | projectRoot = ""; 198 | targets = ( 199 | BBC02C261B5CECA600E4BBEA /* TextDrawer */, 200 | BBC02C311B5CECA700E4BBEA /* TextDrawerTests */, 201 | ); 202 | }; 203 | /* End PBXProject section */ 204 | 205 | /* Begin PBXResourcesBuildPhase section */ 206 | BBC02C251B5CECA600E4BBEA /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | BBC02C301B5CECA700E4BBEA /* Resources */ = { 214 | isa = PBXResourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | BBC02C221B5CECA600E4BBEA /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | BBC02C461B5CECC500E4BBEA /* DrawTextView.swift in Sources */, 228 | BBC02C471B5CECC500E4BBEA /* TextDrawer.swift in Sources */, 229 | BBC02C481B5CECC500E4BBEA /* TextEditView.swift in Sources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | BBC02C2E1B5CECA700E4BBEA /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | BBC02C3A1B5CECA700E4BBEA /* TextDrawerTests.swift in Sources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXSourcesBuildPhase section */ 242 | 243 | /* Begin PBXTargetDependency section */ 244 | BBC02C351B5CECA700E4BBEA /* PBXTargetDependency */ = { 245 | isa = PBXTargetDependency; 246 | target = BBC02C261B5CECA600E4BBEA /* TextDrawer */; 247 | targetProxy = BBC02C341B5CECA700E4BBEA /* PBXContainerItemProxy */; 248 | }; 249 | /* End PBXTargetDependency section */ 250 | 251 | /* Begin XCBuildConfiguration section */ 252 | BBC02C3B1B5CECA700E4BBEA /* Debug */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_WARN_BOOL_CONVERSION = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INT_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_UNREACHABLE_CODE = YES; 268 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 269 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 270 | COPY_PHASE_STRIP = NO; 271 | CURRENT_PROJECT_VERSION = 1; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | ENABLE_TESTABILITY = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_DYNAMIC_NO_PIC = NO; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_OPTIMIZATION_LEVEL = 0; 279 | GCC_PREPROCESSOR_DEFINITIONS = ( 280 | "DEBUG=1", 281 | "$(inherited)", 282 | ); 283 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 284 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 286 | GCC_WARN_UNDECLARED_SELECTOR = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 288 | GCC_WARN_UNUSED_FUNCTION = YES; 289 | GCC_WARN_UNUSED_VARIABLE = YES; 290 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 291 | MTL_ENABLE_DEBUG_INFO = YES; 292 | ONLY_ACTIVE_ARCH = YES; 293 | SDKROOT = iphoneos; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 295 | TARGETED_DEVICE_FAMILY = "1,2"; 296 | VERSIONING_SYSTEM = "apple-generic"; 297 | VERSION_INFO_PREFIX = ""; 298 | }; 299 | name = Debug; 300 | }; 301 | BBC02C3C1B5CECA700E4BBEA /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 306 | CLANG_CXX_LIBRARY = "libc++"; 307 | CLANG_ENABLE_MODULES = YES; 308 | CLANG_ENABLE_OBJC_ARC = YES; 309 | CLANG_WARN_BOOL_CONVERSION = YES; 310 | CLANG_WARN_CONSTANT_CONVERSION = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_EMPTY_BODY = YES; 313 | CLANG_WARN_ENUM_CONVERSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 316 | CLANG_WARN_UNREACHABLE_CODE = YES; 317 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 318 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 319 | COPY_PHASE_STRIP = NO; 320 | CURRENT_PROJECT_VERSION = 1; 321 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 322 | ENABLE_NS_ASSERTIONS = NO; 323 | ENABLE_STRICT_OBJC_MSGSEND = YES; 324 | GCC_C_LANGUAGE_STANDARD = gnu99; 325 | GCC_NO_COMMON_BLOCKS = YES; 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 333 | MTL_ENABLE_DEBUG_INFO = NO; 334 | SDKROOT = iphoneos; 335 | TARGETED_DEVICE_FAMILY = "1,2"; 336 | VALIDATE_PRODUCT = YES; 337 | VERSIONING_SYSTEM = "apple-generic"; 338 | VERSION_INFO_PREFIX = ""; 339 | }; 340 | name = Release; 341 | }; 342 | BBC02C3E1B5CECA700E4BBEA /* Debug */ = { 343 | isa = XCBuildConfiguration; 344 | buildSettings = { 345 | CLANG_ENABLE_MODULES = YES; 346 | DEFINES_MODULE = YES; 347 | DYLIB_COMPATIBILITY_VERSION = 1; 348 | DYLIB_CURRENT_VERSION = 1; 349 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 350 | FRAMEWORK_SEARCH_PATHS = ( 351 | "$(inherited)", 352 | /Users/remirobert/Desktop/TextDrawer/Carthage/Build/iOS, 353 | ); 354 | INFOPLIST_FILE = TextDrawer/Info.plist; 355 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 356 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 357 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 358 | PRODUCT_NAME = "$(TARGET_NAME)"; 359 | SKIP_INSTALL = YES; 360 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 361 | }; 362 | name = Debug; 363 | }; 364 | BBC02C3F1B5CECA700E4BBEA /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | CLANG_ENABLE_MODULES = YES; 368 | DEFINES_MODULE = YES; 369 | DYLIB_COMPATIBILITY_VERSION = 1; 370 | DYLIB_CURRENT_VERSION = 1; 371 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 372 | FRAMEWORK_SEARCH_PATHS = ( 373 | "$(inherited)", 374 | /Users/remirobert/Desktop/TextDrawer/Carthage/Build/iOS, 375 | ); 376 | INFOPLIST_FILE = TextDrawer/Info.plist; 377 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 379 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | SKIP_INSTALL = YES; 382 | }; 383 | name = Release; 384 | }; 385 | BBC02C411B5CECA700E4BBEA /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "$(SDKROOT)/Developer/Library/Frameworks", 390 | "$(inherited)", 391 | ); 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | INFOPLIST_FILE = TextDrawerTests/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 398 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | }; 401 | name = Debug; 402 | }; 403 | BBC02C421B5CECA700E4BBEA /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | FRAMEWORK_SEARCH_PATHS = ( 407 | "$(SDKROOT)/Developer/Library/Frameworks", 408 | "$(inherited)", 409 | ); 410 | INFOPLIST_FILE = TextDrawerTests/Info.plist; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 412 | PRODUCT_BUNDLE_IDENTIFIER = "com.remirobert.$(PRODUCT_NAME:rfc1034identifier)"; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | BBC02C211B5CECA600E4BBEA /* Build configuration list for PBXProject "TextDrawer" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | BBC02C3B1B5CECA700E4BBEA /* Debug */, 424 | BBC02C3C1B5CECA700E4BBEA /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | BBC02C3D1B5CECA700E4BBEA /* Build configuration list for PBXNativeTarget "TextDrawer" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | BBC02C3E1B5CECA700E4BBEA /* Debug */, 433 | BBC02C3F1B5CECA700E4BBEA /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | BBC02C401B5CECA700E4BBEA /* Build configuration list for PBXNativeTarget "TextDrawerTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | BBC02C411B5CECA700E4BBEA /* Debug */, 442 | BBC02C421B5CECA700E4BBEA /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = BBC02C1E1B5CECA600E4BBEA /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer.xcodeproj/xcshareddata/xcschemes/TextDrawer.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer/DrawTextView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawTextView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | import Masonry 10 | 11 | class CustomLabel: UILabel { 12 | override func drawTextInRect(rect: CGRect) { 13 | super.drawTextInRect(UIEdgeInsetsInsetRect(rect, UIEdgeInsetsMake(0, 5, 0, 5))) 14 | } 15 | } 16 | 17 | public class DrawTextView: UIView { 18 | 19 | var textLabel: CustomLabel! 20 | 21 | var text: String! { 22 | didSet { 23 | textLabel.text = text 24 | sizeTextLabel() 25 | } 26 | } 27 | 28 | init() { 29 | super.init(frame: CGRectZero) 30 | 31 | layer.masksToBounds = true 32 | backgroundColor = UIColor.clearColor() 33 | textLabel = CustomLabel() 34 | textLabel.font = textLabel.font.fontWithSize(44) 35 | textLabel.textAlignment = NSTextAlignment.Center 36 | textLabel.numberOfLines = 0 37 | textLabel.textColor = UIColor.blackColor() 38 | textLabel.backgroundColor = UIColor.clearColor() 39 | addSubview(textLabel) 40 | 41 | textLabel.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 42 | make.right.and().left().equalTo()(self) 43 | make.centerY.equalTo()(self) 44 | make.centerX.equalTo()(self) 45 | } 46 | } 47 | 48 | required public init?(coder aDecoder: NSCoder) { 49 | fatalError("init(coder:) has not been implemented") 50 | } 51 | 52 | func sizeTextLabel() { 53 | let oldCenter = textLabel.center 54 | let styleText = NSMutableParagraphStyle() 55 | styleText.alignment = NSTextAlignment.Center 56 | let attributsText = [NSParagraphStyleAttributeName:styleText, NSFontAttributeName:UIFont.boldSystemFontOfSize(textLabel.font.pointSize)] 57 | let sizeTextLabel = (NSString(string: textLabel.text!)).boundingRectWithSize(superview!.frame.size, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: attributsText, context: nil) 58 | textLabel.frame.size = CGSizeMake(sizeTextLabel.width + 10, sizeTextLabel.height + 10) 59 | textLabel.center = oldCenter 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer/TextDrawer.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextDrawer.h 3 | // TextDrawer 4 | // 5 | // Created by Remi Robert on 20/07/15. 6 | // Copyright (c) 2015 Remi Robert. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for TextDrawer. 12 | FOUNDATION_EXPORT double TextDrawerVersionNumber; 13 | 14 | //! Project version string for TextDrawer. 15 | FOUNDATION_EXPORT const unsigned char TextDrawerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer/TextDrawer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | //Scrux 10 | 11 | import UIKit 12 | import Masonry 13 | 14 | public class TextDrawer: UIView, TextEditViewDelegate { 15 | 16 | private var textEditView: TextEditView! 17 | private var drawTextView: DrawTextView! 18 | 19 | private var initialTransformation: CGAffineTransform! 20 | private var initialCenterDrawTextView: CGPoint! 21 | private var initialRotationTransform: CGAffineTransform! 22 | private var initialReferenceRotationTransform: CGAffineTransform! 23 | 24 | private var activieGestureRecognizer = NSMutableSet() 25 | private var activeRotationGesture: UIRotationGestureRecognizer? 26 | private var activePinchGesture: UIPinchGestureRecognizer? 27 | 28 | private lazy var tapRecognizer: UITapGestureRecognizer! = { 29 | let tapRecognizer = UITapGestureRecognizer(target: self, action: "handleTapGesture:") 30 | tapRecognizer.delegate = self 31 | return tapRecognizer 32 | }() 33 | 34 | private lazy var panRecognizer: UIPanGestureRecognizer! = { 35 | let panRecognizer = UIPanGestureRecognizer(target: self, action: "handlePanGesture:") 36 | panRecognizer.delegate = self 37 | return panRecognizer 38 | }() 39 | 40 | private lazy var rotateRecognizer: UIRotationGestureRecognizer! = { 41 | let rotateRecognizer = UIRotationGestureRecognizer(target: self, action: "handlePinchGesture:") 42 | rotateRecognizer.delegate = self 43 | return rotateRecognizer 44 | }() 45 | 46 | private lazy var zoomRecognizer: UIPinchGestureRecognizer! = { 47 | let zoomRecognizer = UIPinchGestureRecognizer(target: self, action: "handlePinchGesture:") 48 | zoomRecognizer.delegate = self 49 | return zoomRecognizer 50 | }() 51 | 52 | public func clearText() { 53 | text = "" 54 | } 55 | 56 | public func resetTransformation() { 57 | drawTextView.transform = initialTransformation 58 | drawTextView.mas_updateConstraints({ (make: MASConstraintMaker!) -> Void in 59 | make.edges.equalTo()(self) 60 | make.centerX.and().centerY().equalTo()(self) 61 | }) 62 | drawTextView.center = center 63 | //drawTextView.sizeTextLabel() 64 | } 65 | 66 | //MARK: - 67 | //MARK: Setup DrawView 68 | 69 | private func setup() { 70 | self.layer.masksToBounds = true 71 | drawTextView = DrawTextView() 72 | initialTransformation = drawTextView.transform 73 | addSubview(drawTextView) 74 | drawTextView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 75 | make.edges.equalTo()(self) 76 | } 77 | 78 | textEditView = TextEditView() 79 | textEditView.delegate = self 80 | 81 | addSubview(textEditView) 82 | textEditView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 83 | make.edges.equalTo()(self) 84 | } 85 | 86 | addGestureRecognizer(tapRecognizer) 87 | addGestureRecognizer(panRecognizer) 88 | addGestureRecognizer(rotateRecognizer) 89 | addGestureRecognizer(zoomRecognizer) 90 | 91 | initialReferenceRotationTransform = CGAffineTransformIdentity 92 | } 93 | 94 | //MARK: - 95 | //MARK: Initialisation 96 | 97 | init() { 98 | super.init(frame: CGRectZero) 99 | setup() 100 | drawTextView.textLabel.font = drawTextView.textLabel.font.fontWithSize(44) 101 | } 102 | 103 | override init(frame: CGRect) { 104 | super.init(frame: frame) 105 | setup() 106 | } 107 | 108 | required public init?(coder aDecoder: NSCoder) { 109 | super.init(coder: aDecoder) 110 | setup() 111 | } 112 | 113 | func textEditViewFinishedEditing(text: String) { 114 | textEditView.hidden = true 115 | drawTextView.text = text 116 | } 117 | } 118 | 119 | //MARK: - 120 | //MARK: Proprety extension 121 | 122 | public extension TextDrawer { 123 | 124 | public var fontSize: CGFloat! { 125 | set { 126 | drawTextView.textLabel.font = drawTextView.textLabel.font.fontWithSize(newValue) 127 | } 128 | get { 129 | return drawTextView.textLabel.font.pointSize 130 | } 131 | } 132 | 133 | public var font: UIFont! { 134 | set { 135 | drawTextView.textLabel.font = newValue 136 | } 137 | get { 138 | return drawTextView.textLabel.font 139 | } 140 | } 141 | 142 | public var textColor: UIColor! { 143 | set { 144 | drawTextView.textLabel.textColor = newValue 145 | } 146 | get { 147 | return drawTextView.textLabel.textColor 148 | } 149 | } 150 | 151 | public var textAlignement: NSTextAlignment! { 152 | set { 153 | drawTextView.textLabel.textAlignment = newValue 154 | } 155 | get { 156 | return drawTextView.textLabel.textAlignment 157 | } 158 | } 159 | 160 | public var textBackgroundColor: UIColor! { 161 | set { 162 | drawTextView.textLabel.backgroundColor = newValue 163 | } 164 | get { 165 | return drawTextView.textLabel.backgroundColor 166 | } 167 | } 168 | 169 | public var text: String! { 170 | set { 171 | drawTextView.text = newValue 172 | } 173 | get { 174 | return drawTextView.text 175 | } 176 | } 177 | 178 | public var textSize: Int! { 179 | set { 180 | textEditView.textSize = newValue 181 | } 182 | get { 183 | return textEditView.textSize 184 | } 185 | } 186 | } 187 | 188 | //MARK: - 189 | //MARK: Gesture handler extension 190 | 191 | extension TextDrawer: UIGestureRecognizerDelegate { 192 | 193 | public func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool { 194 | return true 195 | } 196 | 197 | func handleTapGesture(recognizer: UITapGestureRecognizer) { 198 | textEditView.textEntry = text 199 | textEditView.isEditing = true 200 | textEditView.hidden = false 201 | } 202 | 203 | func handlePanGesture(recognizer: UIPanGestureRecognizer) { 204 | let translation = recognizer.translationInView(self) 205 | switch recognizer.state { 206 | case .Began, .Ended, .Failed, .Cancelled: 207 | initialCenterDrawTextView = drawTextView.center 208 | case .Changed: 209 | drawTextView.center = CGPointMake(initialCenterDrawTextView.x + translation.x, 210 | initialCenterDrawTextView.y + translation.y) 211 | default: return 212 | } 213 | } 214 | 215 | func handlePinchGesture(recognizer: UIGestureRecognizer) { 216 | var transform = initialRotationTransform 217 | 218 | switch recognizer.state { 219 | case .Began: 220 | if activieGestureRecognizer.count == 0 { 221 | initialRotationTransform = drawTextView.transform 222 | } 223 | activieGestureRecognizer.addObject(recognizer) 224 | break 225 | 226 | case .Changed: 227 | for currentRecognizer in activieGestureRecognizer { 228 | transform = applyRecogniser(currentRecognizer as? UIGestureRecognizer, currentTransform: transform) 229 | } 230 | drawTextView.transform = transform 231 | break 232 | 233 | case .Ended, .Failed, .Cancelled: 234 | initialRotationTransform = applyRecogniser(recognizer, currentTransform: initialRotationTransform) 235 | activieGestureRecognizer.removeObject(recognizer) 236 | default: return 237 | } 238 | 239 | } 240 | 241 | private func applyRecogniser(recognizer: UIGestureRecognizer?, currentTransform: CGAffineTransform) -> CGAffineTransform { 242 | if let recognizer = recognizer { 243 | if recognizer is UIRotationGestureRecognizer { 244 | return CGAffineTransformRotate(currentTransform, (recognizer as! UIRotationGestureRecognizer).rotation) 245 | } 246 | if recognizer is UIPinchGestureRecognizer { 247 | let scale = (recognizer as! UIPinchGestureRecognizer).scale 248 | return CGAffineTransformScale(currentTransform, scale, scale) 249 | } 250 | } 251 | return currentTransform 252 | } 253 | } 254 | 255 | //MARK: - 256 | //MARK: Render extension 257 | 258 | public extension TextDrawer { 259 | 260 | public func render() -> UIImage? { 261 | return renderTextOnView(self) 262 | } 263 | 264 | public func renderTextOnView(view: UIView) -> UIImage? { 265 | UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, 0) 266 | 267 | view.layer.renderInContext(UIGraphicsGetCurrentContext()!) 268 | let img = UIGraphicsGetImageFromCurrentImageContext() 269 | 270 | UIGraphicsEndImageContext() 271 | return renderTextOnImage(img) 272 | } 273 | 274 | public func renderTextOnImage(image: UIImage) -> UIImage? { 275 | let size = image.size 276 | let scale = size.width / CGRectGetWidth(self.bounds) 277 | let color = layer.backgroundColor 278 | 279 | UIGraphicsBeginImageContextWithOptions(self.bounds.size, false, 0) 280 | 281 | image.drawInRect(CGRectMake(CGRectGetWidth(self.bounds) / 2 - (image.size.width / scale) / 2, 282 | CGRectGetHeight(self.bounds) / 2 - (image.size.height / scale) / 2, 283 | image.size.width / scale, 284 | image.size.height / scale)) 285 | layer.backgroundColor = UIColor.clearColor().CGColor 286 | layer.renderInContext(UIGraphicsGetCurrentContext()!) 287 | layer.backgroundColor = color 288 | 289 | 290 | let drawnImage = UIGraphicsGetImageFromCurrentImageContext(); 291 | UIGraphicsEndImageContext(); 292 | return UIImage(CGImage: drawnImage.CGImage!, scale: 1, orientation: drawnImage.imageOrientation) 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawer/TextEditView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextEditView.swift 3 | // 4 | // 5 | // Created by Remi Robert on 11/07/15. 6 | // 7 | // 8 | 9 | import UIKit 10 | import Masonry 11 | 12 | protocol TextEditViewDelegate { 13 | func textEditViewFinishedEditing(text: String) 14 | } 15 | 16 | public class TextEditView: UIView { 17 | 18 | private var textView: UITextView! 19 | private var textContainer: UIView! 20 | 21 | var delegate: TextEditViewDelegate? 22 | 23 | var textSize: Int! = 42 24 | 25 | var textEntry: String! { 26 | set { 27 | textView.text = newValue 28 | } 29 | get { 30 | return textView.text 31 | } 32 | } 33 | 34 | var isEditing: Bool! { 35 | didSet { 36 | if isEditing == true { 37 | textContainer.hidden = false; 38 | userInteractionEnabled = true; 39 | backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.65) 40 | textView.becomeFirstResponder() 41 | } 42 | else { 43 | backgroundColor = UIColor.clearColor() 44 | textView.resignFirstResponder() 45 | textContainer.hidden = true; 46 | userInteractionEnabled = false; 47 | delegate?.textEditViewFinishedEditing(textView.text) 48 | } 49 | } 50 | } 51 | 52 | init() { 53 | super.init(frame: CGRectZero) 54 | 55 | isEditing = false 56 | textContainer = UIView() 57 | textContainer.layer.masksToBounds = true 58 | addSubview(textContainer) 59 | textContainer.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 60 | make.edges.equalTo()(self) 61 | } 62 | 63 | textView = UITextView() 64 | textView.tintColor = UIColor.whiteColor() 65 | textView.font = UIFont.systemFontOfSize(44) 66 | textView.textColor = UIColor.whiteColor() 67 | textView.backgroundColor = UIColor.clearColor() 68 | textView.returnKeyType = UIReturnKeyType.Done 69 | textView.clipsToBounds = true 70 | textView.delegate = self 71 | 72 | textContainer.addSubview(textView) 73 | textView.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in 74 | make.edges.equalTo()(self.textContainer) 75 | } 76 | 77 | textContainer.hidden = true 78 | userInteractionEnabled = false 79 | 80 | keyboardNotification() 81 | } 82 | 83 | required public init?(coder aDecoder: NSCoder) { 84 | fatalError("init(coder:) has not been implemented") 85 | } 86 | 87 | deinit { 88 | NSNotificationCenter.defaultCenter().removeObserver(self) 89 | } 90 | } 91 | 92 | extension TextEditView: UITextViewDelegate { 93 | 94 | public func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool { 95 | if text == "\n" { 96 | isEditing = false 97 | return false 98 | } 99 | if textView.text.characters.count + text.characters.count > textSize { 100 | return false 101 | } 102 | return true 103 | } 104 | } 105 | 106 | extension TextEditView { 107 | 108 | func keyboardNotification() { 109 | NSNotificationCenter.defaultCenter().addObserverForName(UIKeyboardWillChangeFrameNotification, object: nil, queue: nil) { (notification: NSNotification) -> Void in 110 | if let userInfo = notification.userInfo { 111 | self.textContainer.layer.removeAllAnimations() 112 | if let keyboardRectEnd = userInfo[UIKeyboardFrameEndUserInfoKey]?.CGRectValue, 113 | let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey]?.floatValue { 114 | 115 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 116 | self.textContainer.mas_updateConstraints({ (make: MASConstraintMaker!) -> Void in 117 | make.bottom.offset()(-CGRectGetHeight(keyboardRectEnd)) 118 | }) 119 | UIView.animateWithDuration(NSTimeInterval(duration), delay: 0, options: UIViewAnimationOptions.BeginFromCurrentState, animations: { () -> Void in 120 | self.textContainer.layoutIfNeeded() 121 | }, completion: nil) 122 | }) 123 | } 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawerTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /TextDrawer/TextDrawerTests/TextDrawerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextDrawerTests.swift 3 | // TextDrawerTests 4 | // 5 | // Created by Remi Robert on 20/07/15. 6 | // Copyright (c) 2015 Remi Robert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class TextDrawerTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------