├── .gitignore ├── .swift-version ├── .travis.yml ├── Cartfile ├── Cartfile.resolved ├── LICENSE ├── Package.swift ├── README.md ├── TextAttributesUtil.podspec ├── TextAttributesUtil.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── TextAttributesUtil-Example.xcscheme │ └── TextAttributesUtil.xcscheme └── TextAttributesUtil ├── Assets └── .gitkeep ├── Classes ├── .gitkeep └── TextAttributesUtil.swift ├── Info.plist └── TextAttributesUtil.h /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | language: objective-c 6 | # cache: cocoapods 7 | # podfile: Example/Podfile 8 | # before_install: 9 | # - gem install cocoapods # Since Travis is not always on latest version 10 | # - pod install --project-directory=Example 11 | script: 12 | - set -o pipefail && xcodebuild test -workspace Example/TextAttributesUtil.xcworkspace -scheme TextAttributesUtil-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty 13 | - pod lib lint 14 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "delba/TextAttributes" 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "delba/TextAttributes" "v1.0" 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 muukii 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | import PackageDescription 2 | 3 | let package = Package( 4 | name: "TextAttributesUtil" 5 | ) 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextAttributesUtil 2 | 3 | [![CI Status](http://img.shields.io/travis/muukii/TextAttributesUtil.svg?style=flat)](https://travis-ci.org/muukii/TextAttributesUtil) 4 | [![Version](https://img.shields.io/cocoapods/v/TextAttributesUtil.svg?style=flat)](http://cocoapods.org/pods/TextAttributesUtil) 5 | [![License](https://img.shields.io/cocoapods/l/TextAttributesUtil.svg?style=flat)](http://cocoapods.org/pods/TextAttributesUtil) 6 | [![Platform](https://img.shields.io/cocoapods/p/TextAttributesUtil.svg?style=flat)](http://cocoapods.org/pods/TextAttributesUtil) 7 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 8 | 9 | Quickly create NSAttributedString with [TextAttributes](https://github.com/delba/TextAttributes) 10 | 11 | ## Usage 12 | 13 | ### Before 14 | 15 | ```swift 16 | let attributes = TextAttributes() 17 | .font(UIFont.systemFontOfSize(14)) 18 | .alignment(.Center) 19 | .foregroundColor(UIColor(white: 0.7, alpha: 1)) 20 | 21 | let attributedText = NSAttributedString(string: "Hello, NSAttributedText", attributes: attributes) 22 | ``` 23 | 24 | ### After 25 | ```swift 26 | let attributedText = "Hello, NSAttributedText" 27 | .attributed { 28 | TextAttributes() 29 | .font(UIFont.systemFontOfSize(14)) 30 | .alignment(.Center) 31 | .foregroundColor(UIColor(white: 0.7, alpha: 1)) 32 | } 33 | ``` 34 | 35 | ## Installation 36 | 37 | TextAttributesUtil is available through [CocoaPods](http://cocoapods.org). To install 38 | it, simply add the following line to your Podfile: 39 | 40 | ```ruby 41 | pod "TextAttributesUtil" 42 | ``` 43 | 44 | ## Author 45 | 46 | muukii, m@muukii.me 47 | 48 | ## License 49 | 50 | TextAttributesUtil is available under the MIT license. See the LICENSE file for more info. 51 | -------------------------------------------------------------------------------- /TextAttributesUtil.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint TextAttributesUtil.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "TextAttributesUtil" 11 | s.version = "1.0.1" 12 | s.summary = "Quickly create NSAttributedString with TextAttributes" 13 | s.description = <<-DESC 14 | Quickly create NSAttributedString with TextAttributes 15 | TextAttributes is awesome library. 16 | DESC 17 | 18 | s.homepage = "https://github.com/muukii/TextAttributesUtil" 19 | s.license = 'MIT' 20 | s.author = { "muukii" => "m@muukii.me" } 21 | s.source = { :git => "https://github.com/muukii/TextAttributesUtil.git", :tag => s.version.to_s } 22 | s.social_media_url = 'https://twitter.com/muukii0803' 23 | 24 | s.ios.deployment_target = '8.0' 25 | 26 | s.source_files = 'TextAttributesUtil/Classes/**/*' 27 | s.dependency 'TextAttributes' 28 | end 29 | -------------------------------------------------------------------------------- /TextAttributesUtil.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B3ABE501D929B33004435EC /* TextAttributesUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5C8F0C1D83DA640069CD6D /* TextAttributesUtil.swift */; }; 11 | 4B5C8F161D83DA730069CD6D /* TextAttributesUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5C8F141D83DA730069CD6D /* TextAttributesUtil.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 4B5C8F1B1D83DAF10069CD6D /* TextAttributes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C8F1A1D83DAF10069CD6D /* TextAttributes.framework */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 4B5C8F0C1D83DA640069CD6D /* TextAttributesUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TextAttributesUtil.swift; path = Classes/TextAttributesUtil.swift; sourceTree = ""; }; 17 | 4B5C8F121D83DA730069CD6D /* TextAttributesUtil.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TextAttributesUtil.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | 4B5C8F141D83DA730069CD6D /* TextAttributesUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextAttributesUtil.h; sourceTree = ""; }; 19 | 4B5C8F151D83DA730069CD6D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 20 | 4B5C8F1A1D83DAF10069CD6D /* TextAttributes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TextAttributes.framework; path = Carthage/Build/iOS/TextAttributes.framework; sourceTree = ""; }; 21 | 607FACE51AFB9204008FA782 /* TextAttributesUtil_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TextAttributesUtil_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | 4B5C8F0E1D83DA730069CD6D /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | 4B5C8F1B1D83DAF10069CD6D /* TextAttributes.framework in Frameworks */, 30 | ); 31 | runOnlyForDeploymentPostprocessing = 0; 32 | }; 33 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 010B1F7DDB570F9D1F9104F9 /* Frameworks */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 4B5C8F1A1D83DAF10069CD6D /* TextAttributes.framework */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | 4B5C8F131D83DA730069CD6D /* TextAttributesUtil */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | 4B5C8F141D83DA730069CD6D /* TextAttributesUtil.h */, 55 | 4B5C8F0C1D83DA640069CD6D /* TextAttributesUtil.swift */, 56 | 4B5C8F151D83DA730069CD6D /* Info.plist */, 57 | ); 58 | path = TextAttributesUtil; 59 | sourceTree = ""; 60 | }; 61 | 607FACC71AFB9204008FA782 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 4B5C8F131D83DA730069CD6D /* TextAttributesUtil */, 65 | 607FACD11AFB9204008FA782 /* Products */, 66 | 010B1F7DDB570F9D1F9104F9 /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 607FACD11AFB9204008FA782 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 607FACE51AFB9204008FA782 /* TextAttributesUtil_Tests.xctest */, 74 | 4B5C8F121D83DA730069CD6D /* TextAttributesUtil.framework */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | /* End PBXGroup section */ 80 | 81 | /* Begin PBXHeadersBuildPhase section */ 82 | 4B5C8F0F1D83DA730069CD6D /* Headers */ = { 83 | isa = PBXHeadersBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | 4B5C8F161D83DA730069CD6D /* TextAttributesUtil.h in Headers */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXHeadersBuildPhase section */ 91 | 92 | /* Begin PBXNativeTarget section */ 93 | 4B5C8F111D83DA730069CD6D /* TextAttributesUtil */ = { 94 | isa = PBXNativeTarget; 95 | buildConfigurationList = 4B5C8F171D83DA730069CD6D /* Build configuration list for PBXNativeTarget "TextAttributesUtil" */; 96 | buildPhases = ( 97 | 4B5C8F0D1D83DA730069CD6D /* Sources */, 98 | 4B5C8F0E1D83DA730069CD6D /* Frameworks */, 99 | 4B5C8F0F1D83DA730069CD6D /* Headers */, 100 | 4B5C8F101D83DA730069CD6D /* Resources */, 101 | ); 102 | buildRules = ( 103 | ); 104 | dependencies = ( 105 | ); 106 | name = TextAttributesUtil; 107 | productName = TextAttributesUtil; 108 | productReference = 4B5C8F121D83DA730069CD6D /* TextAttributesUtil.framework */; 109 | productType = "com.apple.product-type.framework"; 110 | }; 111 | 607FACE41AFB9204008FA782 /* TextAttributesUtil_Tests */ = { 112 | isa = PBXNativeTarget; 113 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "TextAttributesUtil_Tests" */; 114 | buildPhases = ( 115 | 41D37C0FCF7E67AAC6AFE68D /* Check Pods Manifest.lock */, 116 | 607FACE11AFB9204008FA782 /* Sources */, 117 | 607FACE21AFB9204008FA782 /* Frameworks */, 118 | 607FACE31AFB9204008FA782 /* Resources */, 119 | 525BD1FC68D643223B0B2EBE /* Embed Pods Frameworks */, 120 | A54B2BDD70CA571B24D6FFA2 /* Copy Pods Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = TextAttributesUtil_Tests; 127 | productName = Tests; 128 | productReference = 607FACE51AFB9204008FA782 /* TextAttributesUtil_Tests.xctest */; 129 | productType = "com.apple.product-type.bundle.unit-test"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | 607FACC81AFB9204008FA782 /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastSwiftUpdateCheck = 0720; 138 | LastUpgradeCheck = 0720; 139 | ORGANIZATIONNAME = CocoaPods; 140 | TargetAttributes = { 141 | 4B5C8F111D83DA730069CD6D = { 142 | CreatedOnToolsVersion = 8.0; 143 | DevelopmentTeam = KU2QEJ9K3Z; 144 | ProvisioningStyle = Automatic; 145 | }; 146 | 607FACE41AFB9204008FA782 = { 147 | CreatedOnToolsVersion = 6.3.1; 148 | TestTargetID = 607FACCF1AFB9204008FA782; 149 | }; 150 | }; 151 | }; 152 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "TextAttributesUtil" */; 153 | compatibilityVersion = "Xcode 3.2"; 154 | developmentRegion = English; 155 | hasScannedForEncodings = 0; 156 | knownRegions = ( 157 | en, 158 | Base, 159 | ); 160 | mainGroup = 607FACC71AFB9204008FA782; 161 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 162 | projectDirPath = ""; 163 | projectRoot = ""; 164 | targets = ( 165 | 4B5C8F111D83DA730069CD6D /* TextAttributesUtil */, 166 | 607FACE41AFB9204008FA782 /* TextAttributesUtil_Tests */, 167 | ); 168 | }; 169 | /* End PBXProject section */ 170 | 171 | /* Begin PBXResourcesBuildPhase section */ 172 | 4B5C8F101D83DA730069CD6D /* Resources */ = { 173 | isa = PBXResourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | 607FACE31AFB9204008FA782 /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXResourcesBuildPhase section */ 187 | 188 | /* Begin PBXShellScriptBuildPhase section */ 189 | 41D37C0FCF7E67AAC6AFE68D /* Check Pods Manifest.lock */ = { 190 | isa = PBXShellScriptBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | ); 194 | inputPaths = ( 195 | ); 196 | name = "Check Pods Manifest.lock"; 197 | outputPaths = ( 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | shellPath = /bin/sh; 201 | 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"; 202 | showEnvVarsInLog = 0; 203 | }; 204 | 525BD1FC68D643223B0B2EBE /* Embed Pods Frameworks */ = { 205 | isa = PBXShellScriptBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | inputPaths = ( 210 | ); 211 | name = "Embed Pods Frameworks"; 212 | outputPaths = ( 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | shellPath = /bin/sh; 216 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextAttributesUtil_Tests/Pods-TextAttributesUtil_Tests-frameworks.sh\"\n"; 217 | showEnvVarsInLog = 0; 218 | }; 219 | A54B2BDD70CA571B24D6FFA2 /* Copy Pods Resources */ = { 220 | isa = PBXShellScriptBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | inputPaths = ( 225 | ); 226 | name = "Copy Pods Resources"; 227 | outputPaths = ( 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | shellPath = /bin/sh; 231 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-TextAttributesUtil_Tests/Pods-TextAttributesUtil_Tests-resources.sh\"\n"; 232 | showEnvVarsInLog = 0; 233 | }; 234 | /* End PBXShellScriptBuildPhase section */ 235 | 236 | /* Begin PBXSourcesBuildPhase section */ 237 | 4B5C8F0D1D83DA730069CD6D /* Sources */ = { 238 | isa = PBXSourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | 4B3ABE501D929B33004435EC /* TextAttributesUtil.swift in Sources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | 607FACE11AFB9204008FA782 /* Sources */ = { 246 | isa = PBXSourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXSourcesBuildPhase section */ 253 | 254 | /* Begin XCBuildConfiguration section */ 255 | 4B5C8F181D83DA730069CD6D /* Debug */ = { 256 | isa = XCBuildConfiguration; 257 | buildSettings = { 258 | CLANG_ANALYZER_NONNULL = YES; 259 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 262 | CODE_SIGN_IDENTITY = ""; 263 | CURRENT_PROJECT_VERSION = 1; 264 | DEBUG_INFORMATION_FORMAT = dwarf; 265 | DEFINES_MODULE = YES; 266 | DEVELOPMENT_TEAM = KU2QEJ9K3Z; 267 | DYLIB_COMPATIBILITY_VERSION = 1; 268 | DYLIB_CURRENT_VERSION = 1; 269 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 270 | FRAMEWORK_SEARCH_PATHS = ( 271 | "$(inherited)", 272 | "$(PROJECT_DIR)/Carthage/Build/iOS", 273 | ); 274 | INFOPLIST_FILE = TextAttributesUtil/Info.plist; 275 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 276 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 277 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 278 | PRODUCT_BUNDLE_IDENTIFIER = me.muukii.TextAttributesUtil; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | SKIP_INSTALL = YES; 281 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 282 | SWIFT_VERSION = 3.0; 283 | TARGETED_DEVICE_FAMILY = "1,2"; 284 | VERSIONING_SYSTEM = "apple-generic"; 285 | VERSION_INFO_PREFIX = ""; 286 | }; 287 | name = Debug; 288 | }; 289 | 4B5C8F191D83DA730069CD6D /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | CLANG_ANALYZER_NONNULL = YES; 293 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 294 | CLANG_WARN_INFINITE_RECURSION = YES; 295 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 296 | CODE_SIGN_IDENTITY = ""; 297 | CURRENT_PROJECT_VERSION = 1; 298 | DEFINES_MODULE = YES; 299 | DEVELOPMENT_TEAM = KU2QEJ9K3Z; 300 | DYLIB_COMPATIBILITY_VERSION = 1; 301 | DYLIB_CURRENT_VERSION = 1; 302 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 303 | FRAMEWORK_SEARCH_PATHS = ( 304 | "$(inherited)", 305 | "$(PROJECT_DIR)/Carthage/Build/iOS", 306 | ); 307 | INFOPLIST_FILE = TextAttributesUtil/Info.plist; 308 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 309 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 310 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 311 | PRODUCT_BUNDLE_IDENTIFIER = me.muukii.TextAttributesUtil; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SKIP_INSTALL = YES; 314 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 315 | SWIFT_VERSION = 3.0; 316 | TARGETED_DEVICE_FAMILY = "1,2"; 317 | VERSIONING_SYSTEM = "apple-generic"; 318 | VERSION_INFO_PREFIX = ""; 319 | }; 320 | name = Release; 321 | }; 322 | 607FACED1AFB9204008FA782 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INT_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | ENABLE_STRICT_OBJC_MSGSEND = YES; 343 | ENABLE_TESTABILITY = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_DYNAMIC_NO_PIC = NO; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_OPTIMIZATION_LEVEL = 0; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "DEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 355 | GCC_WARN_UNDECLARED_SELECTOR = YES; 356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 357 | GCC_WARN_UNUSED_FUNCTION = YES; 358 | GCC_WARN_UNUSED_VARIABLE = YES; 359 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 360 | MTL_ENABLE_DEBUG_INFO = YES; 361 | ONLY_ACTIVE_ARCH = YES; 362 | SDKROOT = iphoneos; 363 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 364 | }; 365 | name = Debug; 366 | }; 367 | 607FACEE1AFB9204008FA782 /* Release */ = { 368 | isa = XCBuildConfiguration; 369 | buildSettings = { 370 | ALWAYS_SEARCH_USER_PATHS = NO; 371 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 372 | CLANG_CXX_LIBRARY = "libc++"; 373 | CLANG_ENABLE_MODULES = YES; 374 | CLANG_ENABLE_OBJC_ARC = YES; 375 | CLANG_WARN_BOOL_CONVERSION = YES; 376 | CLANG_WARN_CONSTANT_CONVERSION = YES; 377 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 378 | CLANG_WARN_EMPTY_BODY = YES; 379 | CLANG_WARN_ENUM_CONVERSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 385 | COPY_PHASE_STRIP = NO; 386 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 387 | ENABLE_NS_ASSERTIONS = NO; 388 | ENABLE_STRICT_OBJC_MSGSEND = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_NO_COMMON_BLOCKS = YES; 391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 393 | GCC_WARN_UNDECLARED_SELECTOR = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 395 | GCC_WARN_UNUSED_FUNCTION = YES; 396 | GCC_WARN_UNUSED_VARIABLE = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 398 | MTL_ENABLE_DEBUG_INFO = NO; 399 | SDKROOT = iphoneos; 400 | VALIDATE_PRODUCT = YES; 401 | }; 402 | name = Release; 403 | }; 404 | 607FACF31AFB9204008FA782 /* Debug */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | FRAMEWORK_SEARCH_PATHS = ( 408 | "$(SDKROOT)/Developer/Library/Frameworks", 409 | "$(inherited)", 410 | ); 411 | GCC_PREPROCESSOR_DEFINITIONS = ( 412 | "DEBUG=1", 413 | "$(inherited)", 414 | ); 415 | INFOPLIST_FILE = Tests/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 417 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | }; 420 | name = Debug; 421 | }; 422 | 607FACF41AFB9204008FA782 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | FRAMEWORK_SEARCH_PATHS = ( 426 | "$(SDKROOT)/Developer/Library/Frameworks", 427 | "$(inherited)", 428 | ); 429 | INFOPLIST_FILE = Tests/Info.plist; 430 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 431 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 432 | PRODUCT_NAME = "$(TARGET_NAME)"; 433 | }; 434 | name = Release; 435 | }; 436 | /* End XCBuildConfiguration section */ 437 | 438 | /* Begin XCConfigurationList section */ 439 | 4B5C8F171D83DA730069CD6D /* Build configuration list for PBXNativeTarget "TextAttributesUtil" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | 4B5C8F181D83DA730069CD6D /* Debug */, 443 | 4B5C8F191D83DA730069CD6D /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "TextAttributesUtil" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 607FACED1AFB9204008FA782 /* Debug */, 452 | 607FACEE1AFB9204008FA782 /* Release */, 453 | ); 454 | defaultConfigurationIsVisible = 0; 455 | defaultConfigurationName = Release; 456 | }; 457 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "TextAttributesUtil_Tests" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | 607FACF31AFB9204008FA782 /* Debug */, 461 | 607FACF41AFB9204008FA782 /* Release */, 462 | ); 463 | defaultConfigurationIsVisible = 0; 464 | defaultConfigurationName = Release; 465 | }; 466 | /* End XCConfigurationList section */ 467 | }; 468 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 469 | } 470 | -------------------------------------------------------------------------------- /TextAttributesUtil.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TextAttributesUtil.xcodeproj/xcshareddata/xcschemes/TextAttributesUtil-Example.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 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /TextAttributesUtil.xcodeproj/xcshareddata/xcschemes/TextAttributesUtil.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /TextAttributesUtil/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muukii/TextAttributesUtil/cd46c4fd143e9495f9da4286bcfbab13e8f2c844/TextAttributesUtil/Assets/.gitkeep -------------------------------------------------------------------------------- /TextAttributesUtil/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muukii/TextAttributesUtil/cd46c4fd143e9495f9da4286bcfbab13e8f2c844/TextAttributesUtil/Classes/.gitkeep -------------------------------------------------------------------------------- /TextAttributesUtil/Classes/TextAttributesUtil.swift: -------------------------------------------------------------------------------- 1 | // TextAttributesUtil.swift 2 | // 3 | // Copyright (c) 2015 muukii 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | import Foundation 24 | import TextAttributes 25 | 26 | extension String { 27 | 28 | public func attributed(_ block: () -> TextAttributes) -> NSAttributedString { 29 | return NSAttributedString(string: self, attributes: block()) 30 | } 31 | 32 | public func attributed(_ a: TextAttributes) -> NSAttributedString { 33 | return NSAttributedString(string: self, attributes: a) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /TextAttributesUtil/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 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /TextAttributesUtil/TextAttributesUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextAttributesUtil.h 3 | // TextAttributesUtil 4 | // 5 | // Created by muukii on 9/10/16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for TextAttributesUtil. 12 | FOUNDATION_EXPORT double TextAttributesUtilVersionNumber; 13 | 14 | //! Project version string for TextAttributesUtil. 15 | FOUNDATION_EXPORT const unsigned char TextAttributesUtilVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | --------------------------------------------------------------------------------