├── .gitignore ├── BulletPoint ├── BulletPoint.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── BulletPoint.xcscheme └── BulletPoint │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── List.txt │ ├── ViewController.swift │ └── bullet.png ├── LICENSE ├── Math ├── Math.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Math.xcscheme └── Math │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── Math.swift │ ├── UIFont+transform.swift │ ├── ViewController.swift │ └── latinmodern-math.otf ├── README.md ├── bulletpoint.png └── math.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 14E6A9431D79C26200EA0E61 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9421D79C26200EA0E61 /* AppDelegate.swift */; }; 11 | 14E6A9451D79C26200EA0E61 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9441D79C26200EA0E61 /* ViewController.swift */; }; 12 | 14E6A9481D79C26200EA0E61 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9461D79C26200EA0E61 /* Main.storyboard */; }; 13 | 14E6A94A1D79C26200EA0E61 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9491D79C26200EA0E61 /* Assets.xcassets */; }; 14 | 14E6A94D1D79C26200EA0E61 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A94B1D79C26200EA0E61 /* LaunchScreen.storyboard */; }; 15 | 14E6A97A1D79C38500EA0E61 /* List.txt in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9781D79C38500EA0E61 /* List.txt */; }; 16 | 14E6A97B1D79C38500EA0E61 /* bullet.png in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9791D79C38500EA0E61 /* bullet.png */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 14E6A93F1D79C26200EA0E61 /* BulletPoint.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BulletPoint.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 14E6A9421D79C26200EA0E61 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 14E6A9441D79C26200EA0E61 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 14E6A9471D79C26200EA0E61 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 14E6A9491D79C26200EA0E61 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 14E6A94C1D79C26200EA0E61 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 14E6A94E1D79C26200EA0E61 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 14E6A9781D79C38500EA0E61 /* List.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = List.txt; sourceTree = ""; }; 28 | 14E6A9791D79C38500EA0E61 /* bullet.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bullet.png; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 14E6A93C1D79C26200EA0E61 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 14E6A9361D79C26200EA0E61 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 14E6A9411D79C26200EA0E61 /* BulletPoint */, 46 | 14E6A9401D79C26200EA0E61 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 14E6A9401D79C26200EA0E61 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 14E6A93F1D79C26200EA0E61 /* BulletPoint.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 14E6A9411D79C26200EA0E61 /* BulletPoint */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 14E6A9421D79C26200EA0E61 /* AppDelegate.swift */, 62 | 14E6A9441D79C26200EA0E61 /* ViewController.swift */, 63 | 14E6A9461D79C26200EA0E61 /* Main.storyboard */, 64 | 14E6A94B1D79C26200EA0E61 /* LaunchScreen.storyboard */, 65 | 14E6A9491D79C26200EA0E61 /* Assets.xcassets */, 66 | 14E6A94E1D79C26200EA0E61 /* Info.plist */, 67 | 14E6A97C1D79C38900EA0E61 /* Resources */, 68 | ); 69 | path = BulletPoint; 70 | sourceTree = ""; 71 | }; 72 | 14E6A97C1D79C38900EA0E61 /* Resources */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 14E6A9781D79C38500EA0E61 /* List.txt */, 76 | 14E6A9791D79C38500EA0E61 /* bullet.png */, 77 | ); 78 | name = Resources; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | 14E6A93E1D79C26200EA0E61 /* BulletPoint */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = 14E6A9511D79C26200EA0E61 /* Build configuration list for PBXNativeTarget "BulletPoint" */; 87 | buildPhases = ( 88 | 14E6A93B1D79C26200EA0E61 /* Sources */, 89 | 14E6A93C1D79C26200EA0E61 /* Frameworks */, 90 | 14E6A93D1D79C26200EA0E61 /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = BulletPoint; 97 | productName = BulletPoint; 98 | productReference = 14E6A93F1D79C26200EA0E61 /* BulletPoint.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | 14E6A9371D79C26200EA0E61 /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastSwiftUpdateCheck = 0730; 108 | LastUpgradeCheck = 0730; 109 | ORGANIZATIONNAME = "Kishikawa Katsumi"; 110 | TargetAttributes = { 111 | 14E6A93E1D79C26200EA0E61 = { 112 | CreatedOnToolsVersion = 7.3.1; 113 | }; 114 | }; 115 | }; 116 | buildConfigurationList = 14E6A93A1D79C26200EA0E61 /* Build configuration list for PBXProject "BulletPoint" */; 117 | compatibilityVersion = "Xcode 3.2"; 118 | developmentRegion = English; 119 | hasScannedForEncodings = 0; 120 | knownRegions = ( 121 | en, 122 | Base, 123 | ); 124 | mainGroup = 14E6A9361D79C26200EA0E61; 125 | productRefGroup = 14E6A9401D79C26200EA0E61 /* Products */; 126 | projectDirPath = ""; 127 | projectRoot = ""; 128 | targets = ( 129 | 14E6A93E1D79C26200EA0E61 /* BulletPoint */, 130 | ); 131 | }; 132 | /* End PBXProject section */ 133 | 134 | /* Begin PBXResourcesBuildPhase section */ 135 | 14E6A93D1D79C26200EA0E61 /* Resources */ = { 136 | isa = PBXResourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 14E6A94D1D79C26200EA0E61 /* LaunchScreen.storyboard in Resources */, 140 | 14E6A94A1D79C26200EA0E61 /* Assets.xcassets in Resources */, 141 | 14E6A97B1D79C38500EA0E61 /* bullet.png in Resources */, 142 | 14E6A97A1D79C38500EA0E61 /* List.txt in Resources */, 143 | 14E6A9481D79C26200EA0E61 /* Main.storyboard in Resources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXResourcesBuildPhase section */ 148 | 149 | /* Begin PBXSourcesBuildPhase section */ 150 | 14E6A93B1D79C26200EA0E61 /* Sources */ = { 151 | isa = PBXSourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 14E6A9451D79C26200EA0E61 /* ViewController.swift in Sources */, 155 | 14E6A9431D79C26200EA0E61 /* AppDelegate.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin PBXVariantGroup section */ 162 | 14E6A9461D79C26200EA0E61 /* Main.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | 14E6A9471D79C26200EA0E61 /* Base */, 166 | ); 167 | name = Main.storyboard; 168 | sourceTree = ""; 169 | }; 170 | 14E6A94B1D79C26200EA0E61 /* LaunchScreen.storyboard */ = { 171 | isa = PBXVariantGroup; 172 | children = ( 173 | 14E6A94C1D79C26200EA0E61 /* Base */, 174 | ); 175 | name = LaunchScreen.storyboard; 176 | sourceTree = ""; 177 | }; 178 | /* End PBXVariantGroup section */ 179 | 180 | /* Begin XCBuildConfiguration section */ 181 | 14E6A94F1D79C26200EA0E61 /* Debug */ = { 182 | isa = XCBuildConfiguration; 183 | buildSettings = { 184 | ALWAYS_SEARCH_USER_PATHS = NO; 185 | CLANG_ANALYZER_NONNULL = YES; 186 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 187 | CLANG_CXX_LIBRARY = "libc++"; 188 | CLANG_ENABLE_MODULES = YES; 189 | CLANG_ENABLE_OBJC_ARC = YES; 190 | CLANG_WARN_BOOL_CONVERSION = YES; 191 | CLANG_WARN_CONSTANT_CONVERSION = YES; 192 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 193 | CLANG_WARN_EMPTY_BODY = YES; 194 | CLANG_WARN_ENUM_CONVERSION = YES; 195 | CLANG_WARN_INT_CONVERSION = YES; 196 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 197 | CLANG_WARN_UNREACHABLE_CODE = YES; 198 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 199 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 200 | COPY_PHASE_STRIP = NO; 201 | DEBUG_INFORMATION_FORMAT = dwarf; 202 | ENABLE_STRICT_OBJC_MSGSEND = YES; 203 | ENABLE_TESTABILITY = YES; 204 | GCC_C_LANGUAGE_STANDARD = gnu99; 205 | GCC_DYNAMIC_NO_PIC = NO; 206 | GCC_NO_COMMON_BLOCKS = YES; 207 | GCC_OPTIMIZATION_LEVEL = 0; 208 | GCC_PREPROCESSOR_DEFINITIONS = ( 209 | "DEBUG=1", 210 | "$(inherited)", 211 | ); 212 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 213 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 214 | GCC_WARN_UNDECLARED_SELECTOR = YES; 215 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 216 | GCC_WARN_UNUSED_FUNCTION = YES; 217 | GCC_WARN_UNUSED_VARIABLE = YES; 218 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 219 | MTL_ENABLE_DEBUG_INFO = YES; 220 | ONLY_ACTIVE_ARCH = YES; 221 | SDKROOT = iphoneos; 222 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 223 | }; 224 | name = Debug; 225 | }; 226 | 14E6A9501D79C26200EA0E61 /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_ANALYZER_NONNULL = YES; 231 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 232 | CLANG_CXX_LIBRARY = "libc++"; 233 | CLANG_ENABLE_MODULES = YES; 234 | CLANG_ENABLE_OBJC_ARC = YES; 235 | CLANG_WARN_BOOL_CONVERSION = YES; 236 | CLANG_WARN_CONSTANT_CONVERSION = YES; 237 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 238 | CLANG_WARN_EMPTY_BODY = YES; 239 | CLANG_WARN_ENUM_CONVERSION = YES; 240 | CLANG_WARN_INT_CONVERSION = YES; 241 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 242 | CLANG_WARN_UNREACHABLE_CODE = YES; 243 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 244 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 245 | COPY_PHASE_STRIP = NO; 246 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 247 | ENABLE_NS_ASSERTIONS = NO; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | GCC_C_LANGUAGE_STANDARD = gnu99; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 253 | GCC_WARN_UNDECLARED_SELECTOR = YES; 254 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 255 | GCC_WARN_UNUSED_FUNCTION = YES; 256 | GCC_WARN_UNUSED_VARIABLE = YES; 257 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 258 | MTL_ENABLE_DEBUG_INFO = NO; 259 | SDKROOT = iphoneos; 260 | VALIDATE_PRODUCT = YES; 261 | }; 262 | name = Release; 263 | }; 264 | 14E6A9521D79C26200EA0E61 /* Debug */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 268 | INFOPLIST_FILE = BulletPoint/Info.plist; 269 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 270 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.BulletPoint; 271 | PRODUCT_NAME = "$(TARGET_NAME)"; 272 | }; 273 | name = Debug; 274 | }; 275 | 14E6A9531D79C26200EA0E61 /* Release */ = { 276 | isa = XCBuildConfiguration; 277 | buildSettings = { 278 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 279 | INFOPLIST_FILE = BulletPoint/Info.plist; 280 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 281 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.BulletPoint; 282 | PRODUCT_NAME = "$(TARGET_NAME)"; 283 | }; 284 | name = Release; 285 | }; 286 | /* End XCBuildConfiguration section */ 287 | 288 | /* Begin XCConfigurationList section */ 289 | 14E6A93A1D79C26200EA0E61 /* Build configuration list for PBXProject "BulletPoint" */ = { 290 | isa = XCConfigurationList; 291 | buildConfigurations = ( 292 | 14E6A94F1D79C26200EA0E61 /* Debug */, 293 | 14E6A9501D79C26200EA0E61 /* Release */, 294 | ); 295 | defaultConfigurationIsVisible = 0; 296 | defaultConfigurationName = Release; 297 | }; 298 | 14E6A9511D79C26200EA0E61 /* Build configuration list for PBXNativeTarget "BulletPoint" */ = { 299 | isa = XCConfigurationList; 300 | buildConfigurations = ( 301 | 14E6A9521D79C26200EA0E61 /* Debug */, 302 | 14E6A9531D79C26200EA0E61 /* Release */, 303 | ); 304 | defaultConfigurationIsVisible = 0; 305 | defaultConfigurationName = Release; 306 | }; 307 | /* End XCConfigurationList section */ 308 | }; 309 | rootObject = 14E6A9371D79C26200EA0E61 /* Project object */; 310 | } 311 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint.xcodeproj/xcshareddata/xcschemes/BulletPoint.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // BulletPoint 4 | // 5 | // Created by Kishikawa Katsumi on 9/2/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 17 | return true 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/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 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/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 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/List.txt: -------------------------------------------------------------------------------- 1 | Finding and Catching wild Pokémon 2 | Finding wild Pokémon 3 | Your device will vibrate to alert you when a wild Pokémon is nearby. If you don’t see any Pokémon nearby, take a walk! Pokémon love places like parks, so try visiting a local recreational area. You can attract more Pokémon to your location by using an item known as Incense. 4 | To catch a Pokémon: 5 | - When a wild Pokémon is nearby, your device will vibrate, and the Pokémon will appear on the map. Touch the Pokémon to begin your attempt to catch it. 6 | - The Pokémon will appear in front of you. 7 | Note: You may need to orient your device or switch out of camera mode. 8 | - Touch and hold your Poké Ball. 9 | - You have the greatest chance of capturing the Pokémon while the colored ring is at its smallest diameter. At the opportune moment, fling the Poké Ball toward the Pokémon. 10 | Tip: Drag and rapidly spin the Poké Ball in a circular motion before you release it for a chance to receive a curveball bonus. -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // BulletPoint 4 | // 5 | // Created by Kishikawa Katsumi on 9/2/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | let textView = UITextView(frame: CGRectInset(view.bounds, 10, 10)) 17 | 18 | textView.editable = false 19 | 20 | textView.textContainerInset = UIEdgeInsetsZero 21 | textView.textContainer.lineFragmentPadding = 0 22 | textView.layoutManager.usesFontLeading = false 23 | 24 | view.addSubview(textView) 25 | 26 | let headFont = UIFont.boldSystemFontOfSize(20) 27 | let subheadFont = UIFont.boldSystemFontOfSize(16) 28 | let bodyFont = UIFont.systemFontOfSize(12) 29 | 30 | let text = try! String(contentsOfFile: NSBundle.mainBundle().pathForResource("List", ofType: "txt")!) 31 | let attributedText = NSMutableAttributedString(string: text) 32 | 33 | let image = UIImage(named: "bullet") 34 | let attachment = NSTextAttachment(data: nil, ofType: nil) 35 | attachment.image = image 36 | attachment.bounds = CGRect(x: 0, y: -2, width: bodyFont.pointSize, height: bodyFont.pointSize) 37 | 38 | let bulletText = NSAttributedString(attachment: attachment) 39 | attributedText.replaceCharactersInRange(NSRange(location: 350, length: 1), withAttributedString: bulletText) 40 | attributedText.replaceCharactersInRange(NSRange(location: 502, length: 1), withAttributedString: bulletText) 41 | attributedText.replaceCharactersInRange(NSRange(location: 617, length: 1), withAttributedString: bulletText) 42 | attributedText.replaceCharactersInRange(NSRange(location: 650, length: 1), withAttributedString: bulletText) 43 | 44 | do { 45 | let paragraphStyle = NSMutableParagraphStyle() 46 | 47 | paragraphStyle.minimumLineHeight = ceil(headFont.lineHeight) 48 | paragraphStyle.maximumLineHeight = ceil(headFont.lineHeight) 49 | paragraphStyle.paragraphSpacing = ceil(headFont.pointSize / 2) 50 | 51 | let attributes = [ 52 | NSFontAttributeName: headFont, 53 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 54 | NSParagraphStyleAttributeName: paragraphStyle, 55 | ] 56 | attributedText.addAttributes(attributes, range: NSRange(location: 0, length: 33)) 57 | } 58 | 59 | do { 60 | let paragraphStyle = NSMutableParagraphStyle() 61 | 62 | paragraphStyle.minimumLineHeight = ceil(subheadFont.lineHeight) 63 | paragraphStyle.maximumLineHeight = ceil(subheadFont.lineHeight) 64 | paragraphStyle.paragraphSpacing = ceil(subheadFont.lineHeight / 2) 65 | 66 | let attributes = [ 67 | NSFontAttributeName: subheadFont, 68 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 69 | NSParagraphStyleAttributeName: paragraphStyle, 70 | ] 71 | attributedText.addAttributes(attributes, range: NSRange(location: 34, length: 20)) 72 | } 73 | 74 | do { 75 | let paragraphStyle = NSMutableParagraphStyle() 76 | 77 | paragraphStyle.minimumLineHeight = ceil(bodyFont.lineHeight) 78 | paragraphStyle.maximumLineHeight = ceil(bodyFont.lineHeight) 79 | paragraphStyle.lineSpacing = 2 80 | paragraphStyle.paragraphSpacing = ceil(bodyFont.lineHeight / 2) 81 | 82 | paragraphStyle.alignment = .Justified 83 | 84 | let attributes = [ 85 | NSFontAttributeName: bodyFont, 86 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 87 | NSParagraphStyleAttributeName: paragraphStyle, 88 | ] 89 | attributedText.addAttributes(attributes, range: NSRange(location: 55, length: 275)) 90 | } 91 | 92 | do { 93 | let paragraphStyle = NSMutableParagraphStyle() 94 | 95 | paragraphStyle.minimumLineHeight = ceil(subheadFont.lineHeight) 96 | paragraphStyle.maximumLineHeight = ceil(subheadFont.lineHeight) 97 | paragraphStyle.paragraphSpacing = ceil(subheadFont.lineHeight / 2) 98 | 99 | let attributes = [ 100 | NSFontAttributeName: subheadFont, 101 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 102 | NSParagraphStyleAttributeName: paragraphStyle, 103 | ] 104 | attributedText.addAttributes(attributes, range: NSRange(location: 330, length: 19)) 105 | } 106 | 107 | do { 108 | let paragraphStyle = NSMutableParagraphStyle() 109 | 110 | paragraphStyle.minimumLineHeight = ceil(bodyFont.lineHeight) 111 | paragraphStyle.maximumLineHeight = ceil(bodyFont.lineHeight) 112 | paragraphStyle.lineSpacing = 2 113 | paragraphStyle.paragraphSpacing = ceil(bodyFont.lineHeight / 2) 114 | 115 | paragraphStyle.headIndent = bodyFont.pointSize * 2 116 | paragraphStyle.alignment = .Justified 117 | 118 | paragraphStyle.tabStops = [] 119 | paragraphStyle.defaultTabInterval = bodyFont.pointSize * 2 120 | 121 | let attributes = [ 122 | NSFontAttributeName: bodyFont, 123 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 124 | NSParagraphStyleAttributeName: paragraphStyle, 125 | ] 126 | attributedText.addAttributes(attributes, range: NSRange(location: 350, length: 472)) 127 | } 128 | 129 | do { 130 | let paragraphStyle = NSMutableParagraphStyle() 131 | 132 | paragraphStyle.minimumLineHeight = ceil(bodyFont.lineHeight) 133 | paragraphStyle.maximumLineHeight = ceil(bodyFont.lineHeight) 134 | paragraphStyle.lineSpacing = 2 135 | paragraphStyle.paragraphSpacing = ceil(bodyFont.lineHeight / 2) 136 | 137 | paragraphStyle.alignment = .Justified 138 | 139 | let attributes = [ 140 | NSFontAttributeName: bodyFont, 141 | NSForegroundColorAttributeName: UIColor(red: 0.22, green: 0.28, blue: 0.50, alpha: 1.0), 142 | NSParagraphStyleAttributeName: paragraphStyle, 143 | ] 144 | attributedText.addAttributes(attributes, range: NSRange(location: 822, length: 126)) 145 | } 146 | 147 | textView.attributedText = attributedText 148 | } 149 | 150 | override func prefersStatusBarHidden() -> Bool { 151 | return true 152 | } 153 | 154 | } 155 | -------------------------------------------------------------------------------- /BulletPoint/BulletPoint/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishikawakatsumi/TextKitExamples/78586f73150e01f4db063f0b1448ff5bdb407a82/BulletPoint/BulletPoint/bullet.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 kishikawa katsumi 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 | -------------------------------------------------------------------------------- /Math/Math.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 14E6A9611D79C2D600EA0E61 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9601D79C2D600EA0E61 /* AppDelegate.swift */; }; 11 | 14E6A9631D79C2D600EA0E61 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9621D79C2D600EA0E61 /* ViewController.swift */; }; 12 | 14E6A9661D79C2D600EA0E61 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9641D79C2D600EA0E61 /* Main.storyboard */; }; 13 | 14E6A9681D79C2D600EA0E61 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9671D79C2D600EA0E61 /* Assets.xcassets */; }; 14 | 14E6A96B1D79C2D600EA0E61 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9691D79C2D600EA0E61 /* LaunchScreen.storyboard */; }; 15 | 14E6A9731D79C30200EA0E61 /* latinmodern-math.otf in Resources */ = {isa = PBXBuildFile; fileRef = 14E6A9721D79C30200EA0E61 /* latinmodern-math.otf */; }; 16 | 14E6A9761D79C31200EA0E61 /* Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9741D79C31200EA0E61 /* Math.swift */; }; 17 | 14E6A9771D79C31200EA0E61 /* UIFont+transform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6A9751D79C31200EA0E61 /* UIFont+transform.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 14E6A95D1D79C2D600EA0E61 /* Math.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Math.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 14E6A9601D79C2D600EA0E61 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 14E6A9621D79C2D600EA0E61 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | 14E6A9651D79C2D600EA0E61 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | 14E6A9671D79C2D600EA0E61 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 14E6A96A1D79C2D600EA0E61 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 14E6A96C1D79C2D600EA0E61 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 14E6A9721D79C30200EA0E61 /* latinmodern-math.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "latinmodern-math.otf"; sourceTree = ""; }; 29 | 14E6A9741D79C31200EA0E61 /* Math.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Math.swift; sourceTree = ""; }; 30 | 14E6A9751D79C31200EA0E61 /* UIFont+transform.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIFont+transform.swift"; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 14E6A95A1D79C2D600EA0E61 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 14E6A9541D79C2D600EA0E61 = { 45 | isa = PBXGroup; 46 | children = ( 47 | 14E6A95F1D79C2D600EA0E61 /* Math */, 48 | 14E6A95E1D79C2D600EA0E61 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 14E6A95E1D79C2D600EA0E61 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 14E6A95D1D79C2D600EA0E61 /* Math.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 14E6A95F1D79C2D600EA0E61 /* Math */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 14E6A9601D79C2D600EA0E61 /* AppDelegate.swift */, 64 | 14E6A9621D79C2D600EA0E61 /* ViewController.swift */, 65 | 14E6A9741D79C31200EA0E61 /* Math.swift */, 66 | 14E6A9751D79C31200EA0E61 /* UIFont+transform.swift */, 67 | 14E6A9641D79C2D600EA0E61 /* Main.storyboard */, 68 | 14E6A9691D79C2D600EA0E61 /* LaunchScreen.storyboard */, 69 | 14E6A9671D79C2D600EA0E61 /* Assets.xcassets */, 70 | 14E6A96C1D79C2D600EA0E61 /* Info.plist */, 71 | 14E6A9721D79C30200EA0E61 /* latinmodern-math.otf */, 72 | ); 73 | path = Math; 74 | sourceTree = ""; 75 | }; 76 | /* End PBXGroup section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | 14E6A95C1D79C2D600EA0E61 /* Math */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = 14E6A96F1D79C2D600EA0E61 /* Build configuration list for PBXNativeTarget "Math" */; 82 | buildPhases = ( 83 | 14E6A9591D79C2D600EA0E61 /* Sources */, 84 | 14E6A95A1D79C2D600EA0E61 /* Frameworks */, 85 | 14E6A95B1D79C2D600EA0E61 /* Resources */, 86 | ); 87 | buildRules = ( 88 | ); 89 | dependencies = ( 90 | ); 91 | name = Math; 92 | productName = Math; 93 | productReference = 14E6A95D1D79C2D600EA0E61 /* Math.app */; 94 | productType = "com.apple.product-type.application"; 95 | }; 96 | /* End PBXNativeTarget section */ 97 | 98 | /* Begin PBXProject section */ 99 | 14E6A9551D79C2D600EA0E61 /* Project object */ = { 100 | isa = PBXProject; 101 | attributes = { 102 | LastSwiftUpdateCheck = 0730; 103 | LastUpgradeCheck = 0730; 104 | ORGANIZATIONNAME = "Kishikawa Katsumi"; 105 | TargetAttributes = { 106 | 14E6A95C1D79C2D600EA0E61 = { 107 | CreatedOnToolsVersion = 7.3.1; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = 14E6A9581D79C2D600EA0E61 /* Build configuration list for PBXProject "Math" */; 112 | compatibilityVersion = "Xcode 3.2"; 113 | developmentRegion = English; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | Base, 118 | ); 119 | mainGroup = 14E6A9541D79C2D600EA0E61; 120 | productRefGroup = 14E6A95E1D79C2D600EA0E61 /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | 14E6A95C1D79C2D600EA0E61 /* Math */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | 14E6A95B1D79C2D600EA0E61 /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 14E6A96B1D79C2D600EA0E61 /* LaunchScreen.storyboard in Resources */, 135 | 14E6A9681D79C2D600EA0E61 /* Assets.xcassets in Resources */, 136 | 14E6A9661D79C2D600EA0E61 /* Main.storyboard in Resources */, 137 | 14E6A9731D79C30200EA0E61 /* latinmodern-math.otf in Resources */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | /* End PBXResourcesBuildPhase section */ 142 | 143 | /* Begin PBXSourcesBuildPhase section */ 144 | 14E6A9591D79C2D600EA0E61 /* Sources */ = { 145 | isa = PBXSourcesBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | 14E6A9631D79C2D600EA0E61 /* ViewController.swift in Sources */, 149 | 14E6A9771D79C31200EA0E61 /* UIFont+transform.swift in Sources */, 150 | 14E6A9611D79C2D600EA0E61 /* AppDelegate.swift in Sources */, 151 | 14E6A9761D79C31200EA0E61 /* Math.swift in Sources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXSourcesBuildPhase section */ 156 | 157 | /* Begin PBXVariantGroup section */ 158 | 14E6A9641D79C2D600EA0E61 /* Main.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | 14E6A9651D79C2D600EA0E61 /* Base */, 162 | ); 163 | name = Main.storyboard; 164 | sourceTree = ""; 165 | }; 166 | 14E6A9691D79C2D600EA0E61 /* LaunchScreen.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | 14E6A96A1D79C2D600EA0E61 /* Base */, 170 | ); 171 | name = LaunchScreen.storyboard; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXVariantGroup section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | 14E6A96D1D79C2D600EA0E61 /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_ANALYZER_NONNULL = YES; 182 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 183 | CLANG_CXX_LIBRARY = "libc++"; 184 | CLANG_ENABLE_MODULES = YES; 185 | CLANG_ENABLE_OBJC_ARC = YES; 186 | CLANG_WARN_BOOL_CONVERSION = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 189 | CLANG_WARN_EMPTY_BODY = YES; 190 | CLANG_WARN_ENUM_CONVERSION = YES; 191 | CLANG_WARN_INT_CONVERSION = YES; 192 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 193 | CLANG_WARN_UNREACHABLE_CODE = YES; 194 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 195 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 196 | COPY_PHASE_STRIP = NO; 197 | DEBUG_INFORMATION_FORMAT = dwarf; 198 | ENABLE_STRICT_OBJC_MSGSEND = YES; 199 | ENABLE_TESTABILITY = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu99; 201 | GCC_DYNAMIC_NO_PIC = NO; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | GCC_OPTIMIZATION_LEVEL = 0; 204 | GCC_PREPROCESSOR_DEFINITIONS = ( 205 | "DEBUG=1", 206 | "$(inherited)", 207 | ); 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 215 | MTL_ENABLE_DEBUG_INFO = YES; 216 | ONLY_ACTIVE_ARCH = YES; 217 | SDKROOT = iphoneos; 218 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 219 | }; 220 | name = Debug; 221 | }; 222 | 14E6A96E1D79C2D600EA0E61 /* Release */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | ALWAYS_SEARCH_USER_PATHS = NO; 226 | CLANG_ANALYZER_NONNULL = YES; 227 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 228 | CLANG_CXX_LIBRARY = "libc++"; 229 | CLANG_ENABLE_MODULES = YES; 230 | CLANG_ENABLE_OBJC_ARC = YES; 231 | CLANG_WARN_BOOL_CONVERSION = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INT_CONVERSION = YES; 237 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 238 | CLANG_WARN_UNREACHABLE_CODE = YES; 239 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 240 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 241 | COPY_PHASE_STRIP = NO; 242 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 243 | ENABLE_NS_ASSERTIONS = NO; 244 | ENABLE_STRICT_OBJC_MSGSEND = YES; 245 | GCC_C_LANGUAGE_STANDARD = gnu99; 246 | GCC_NO_COMMON_BLOCKS = YES; 247 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 248 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 249 | GCC_WARN_UNDECLARED_SELECTOR = YES; 250 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 251 | GCC_WARN_UNUSED_FUNCTION = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 254 | MTL_ENABLE_DEBUG_INFO = NO; 255 | SDKROOT = iphoneos; 256 | VALIDATE_PRODUCT = YES; 257 | }; 258 | name = Release; 259 | }; 260 | 14E6A9701D79C2D600EA0E61 /* Debug */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 264 | INFOPLIST_FILE = Math/Info.plist; 265 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 266 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.Math; 267 | PRODUCT_NAME = "$(TARGET_NAME)"; 268 | }; 269 | name = Debug; 270 | }; 271 | 14E6A9711D79C2D600EA0E61 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 275 | INFOPLIST_FILE = Math/Info.plist; 276 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 277 | PRODUCT_BUNDLE_IDENTIFIER = com.kishikawakatsumi.Math; 278 | PRODUCT_NAME = "$(TARGET_NAME)"; 279 | }; 280 | name = Release; 281 | }; 282 | /* End XCBuildConfiguration section */ 283 | 284 | /* Begin XCConfigurationList section */ 285 | 14E6A9581D79C2D600EA0E61 /* Build configuration list for PBXProject "Math" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | 14E6A96D1D79C2D600EA0E61 /* Debug */, 289 | 14E6A96E1D79C2D600EA0E61 /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | 14E6A96F1D79C2D600EA0E61 /* Build configuration list for PBXNativeTarget "Math" */ = { 295 | isa = XCConfigurationList; 296 | buildConfigurations = ( 297 | 14E6A9701D79C2D600EA0E61 /* Debug */, 298 | 14E6A9711D79C2D600EA0E61 /* Release */, 299 | ); 300 | defaultConfigurationIsVisible = 0; 301 | }; 302 | /* End XCConfigurationList section */ 303 | }; 304 | rootObject = 14E6A9551D79C2D600EA0E61 /* Project object */; 305 | } 306 | -------------------------------------------------------------------------------- /Math/Math.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Math/Math.xcodeproj/xcshareddata/xcschemes/Math.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Math/Math/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Math 4 | // 5 | // Created by Kishikawa Katsumi on 9/1/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 17 | return true 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Math/Math/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Math/Math/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Math/Math/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 | -------------------------------------------------------------------------------- /Math/Math/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 | UIAppFonts 26 | 27 | latinmodern-math.otf 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Math/Math/Math.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Math.swift 3 | // Math 4 | // 5 | // Created by Kishikawa Katsumi on 9/1/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | struct Symbols { 10 | static let minus = "\u{2212}" 11 | static let plusMinus = "\u{00B1}" 12 | static let squareRoot = "\u{221A}" 13 | static let smallSigma = "\u{1D70E}" 14 | static let smallMu = "\u{1D707}" 15 | static let summation = "\u{2211}" 16 | static let horizontalLine = "\u{2500}" 17 | } 18 | 19 | func italicized(ch: UnicodeScalar) -> UnicodeScalar { 20 | if ch == "h" { 21 | return "\u{210E}" // PLANCK CONSTANT 22 | } else if ch >= "a" && ch <= "z" { 23 | return UnicodeScalar("\u{1D44E}".unicodeScalars.first!.value + (ch.value - "a".unicodeScalars.first!.value)) 24 | } else if ch >= "A" && ch <= "Z" { 25 | return UnicodeScalar("\u{1D434}".unicodeScalars.first!.value + (ch.value - "A".unicodeScalars.first!.value)) 26 | } else if ch >= "\u{03B1}" && ch <= "\u{03C9}" { 27 | return UnicodeScalar("\u{1D6FC}".unicodeScalars.first!.value + (ch.value - "\u{03B1}".unicodeScalars.first!.value)) 28 | } else if ch >= "\u{0391}" && ch <= "\u{03A9}" { 29 | return UnicodeScalar("\u{1D6E2}".unicodeScalars.first!.value + (ch.value - "\u{0391}".unicodeScalars.first!.value)) 30 | } else { 31 | return ch 32 | } 33 | } 34 | 35 | func variable(text: String) -> String { 36 | var s = "" 37 | for unicodeScalar in text.unicodeScalars { 38 | s.append(italicized(unicodeScalar)) 39 | } 40 | return s 41 | } 42 | 43 | func expression(expression: String) -> String { 44 | return variable( 45 | expression 46 | .stringByReplacingOccurrencesOfString("\\sqrt", withString: Symbols.squareRoot) 47 | .stringByReplacingOccurrencesOfString("\\pm", withString: Symbols.plusMinus) 48 | .stringByReplacingOccurrencesOfString("\\mu", withString: Symbols.smallMu) 49 | .stringByReplacingOccurrencesOfString("\\sigma", withString: Symbols.smallSigma) 50 | .stringByReplacingOccurrencesOfString("\\sum_", withString: Symbols.summation) 51 | .stringByReplacingOccurrencesOfString("-", withString: Symbols.minus) 52 | ) 53 | } 54 | -------------------------------------------------------------------------------- /Math/Math/UIFont+transform.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+transform.swift 3 | // Math 4 | // 5 | // Created by Kishikawa Katsumi on 9/1/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIFont { 12 | 13 | func scale(x x: CGFloat, y: CGFloat) -> UIFont { 14 | return transform(CGAffineTransformMakeScale(x, y)) 15 | } 16 | 17 | func transform(matrix: CGAffineTransform) -> UIFont { 18 | return UIFont(descriptor: fontDescriptor().fontDescriptorWithMatrix(matrix), size: pointSize) 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Math/Math/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Math 4 | // 5 | // Created by Kishikawa Katsumi on 9/1/16. 6 | // Copyright © 2016 Kishikawa Katsumi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | var label = UILabel() 14 | let font = UIFont(name: "LatinModernMath-Regular", size: 20)! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | label.frame = CGRectInset(view.bounds, 10, 10) 20 | label.numberOfLines = 0 21 | view.addSubview(label) 22 | 23 | let attributedText = NSMutableAttributedString() 24 | 25 | attributedText.appendAttributedString(NSAttributedString(string: "The Quadratic Formula\n\n", attributes: [NSFontAttributeName: UIFont.boldSystemFontOfSize(20)])) 26 | attributedText.appendAttributedString(formula1()) 27 | 28 | attributedText.appendAttributedString(NSAttributedString(string: "\n")) 29 | 30 | attributedText.appendAttributedString(NSAttributedString(string: "Standard Deviation and Variance\n\n", attributes: [NSFontAttributeName: UIFont.boldSystemFontOfSize(20)])) 31 | attributedText.appendAttributedString(formula2()) 32 | 33 | label.attributedText = attributedText 34 | label.sizeToFit() 35 | } 36 | 37 | func formula1() -> NSAttributedString { 38 | let formula = expression("x = -b \\pm \\sqrtb2-4ac2a") 39 | .stringByAppendingString("".stringByPaddingToLength(5, withString: Symbols.horizontalLine, startingAtIndex: 0)) // line of sqrt 40 | .stringByAppendingString("".stringByPaddingToLength(10, withString: Symbols.horizontalLine, startingAtIndex: 0)) // line of fraction 41 | 42 | let range = NSRange(location: 0, length: formula.utf16.count) 43 | 44 | let attributedText = NSMutableAttributedString(string: formula) 45 | attributedText.setAttributes([NSFontAttributeName: UIFont(name: "LatinModernMath-Regular", size: 20)!], range: range) 46 | 47 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -12, range: NSRange(location: 0, length: 5)) // x = -b 48 | 49 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 0.6, y: 0.6), range: NSRange(location: 14, length: 1)) // superscript 50 | attributedText.addAttribute(String(kCTSuperscriptAttributeName), value: 1, range: NSRange(location: 14, length: 1)) // superscript 51 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 2, range: NSRange(location: 14, length: 1)) // superscript 52 | 53 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -26, range: NSRange(location: 21, length: 3)) // 2a 54 | attributedText.addAttribute(NSKernAttributeName, value: -68, range: NSRange(location: 19, length: 2)) // 2a 55 | 56 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 18, range: NSRange(location: 11, length: 1)) // sqrt 57 | 58 | attributedText.addAttribute(NSKernAttributeName, value: -12, range: NSRange(location: 22, length: 2)) // line of sqrt 59 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 14, range: NSRange(location: 24, length: 5)) // line of sqrt 60 | 61 | attributedText.addAttribute(NSKernAttributeName, value: -135, range: NSRange(location: 28, length: 1)) // line of fraction 62 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -12, range: NSRange(location: 29, length: 10)) // line of fraction 63 | 64 | let paragraghStyle = NSMutableParagraphStyle() 65 | paragraghStyle.alignment = .Center 66 | paragraghStyle.paragraphSpacing = 40 67 | attributedText.addAttribute(NSParagraphStyleAttributeName, value: paragraghStyle, range: NSRange(location: 0, length: attributedText.string.utf16.count)) 68 | 69 | return attributedText 70 | } 71 | 72 | func formula2() -> NSAttributedString { 73 | let formula = expression("\\sigma = \\sqrt1N\(Symbols.horizontalLine)\\sum_i=1N (xi - \\mu)2") 74 | .stringByAppendingString("".stringByPaddingToLength(9, withString: Symbols.horizontalLine, startingAtIndex: 0)) 75 | 76 | let range = NSRange(location: 0, length: formula.utf16.count) 77 | 78 | let attributedText = NSMutableAttributedString(string: formula) 79 | attributedText.setAttributes([NSFontAttributeName: font], range: range) 80 | 81 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -8, range: NSRange(location: 0, length: 5)) // z = 82 | 83 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 1, y: 2.4), range: NSRange(location: 5, length: 1)) // sqrt 84 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 20, range: NSRange(location: 5, length: 1)) // sqrt 85 | attributedText.addAttribute(NSKernAttributeName, value: 2, range: NSRange(location: 5, length: 1)) // sqrt 86 | 87 | attributedText.addAttribute(NSKernAttributeName, value: -14, range: NSRange(location: 6, length: 1)) // fraction of N 88 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -20, range: NSRange(location: 7, length: 2)) // fraction of N 89 | attributedText.addAttribute(NSKernAttributeName, value: -14, range: NSRange(location: 7, length: 2)) // line of fraction 90 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -8, range: NSRange(location: 9, length: 1)) // line of fraction 91 | 92 | attributedText.addAttribute(NSKernAttributeName, value: 4, range: NSRange(location: 9, length: 1)) // Sum 93 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -8, range: NSRange(location: 10, length: 1)) // Sum 94 | 95 | attributedText.addAttribute(NSKernAttributeName, value: -20, range: NSRange(location: 10, length: 1)) // i=i 96 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 0.6, y: 0.6), range: NSRange(location: 11, length: 4)) // i=i 97 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -24, range: NSRange(location: 11, length: 4)) // i=i 98 | 99 | attributedText.addAttribute(NSKernAttributeName, value: -14, range: NSRange(location: 14, length: 1)) // N 100 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 0.6, y: 0.6), range: NSRange(location: 15, length: 2)) // N 101 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 10, range: NSRange(location: 15, length: 2)) // N 102 | 103 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 0.6, y: 0.6), range: NSRange(location: 21, length: 2)) // subscript i 104 | attributedText.addAttribute(String(kCTSuperscriptAttributeName), value: -1, range: NSRange(location: 21, length: 2)) // subscript i 105 | 106 | attributedText.addAttribute(NSFontAttributeName, value: font.scale(x: 0.6, y: 0.6), range: NSRange(location: 29, length: 1)) // superscript 2 107 | attributedText.addAttribute(String(kCTSuperscriptAttributeName), value: 1, range: NSRange(location: 29, length: 1)) // superscript 2 108 | 109 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: -8, range: NSRange(location: 18, length: 12)) // (xi - u)2 110 | 111 | attributedText.addAttribute(NSKernAttributeName, value: -118, range: NSRange(location: 29, length: 1)) // line of sqrt 112 | attributedText.addAttribute(NSBaselineOffsetAttributeName, value: 16, range: NSRange(location: 30, length: 9)) // line of sqrt 113 | 114 | let paragraghStyle = NSMutableParagraphStyle() 115 | paragraghStyle.alignment = .Center 116 | paragraghStyle.paragraphSpacing = 40 117 | attributedText.addAttribute(NSParagraphStyleAttributeName, value: paragraghStyle, range: NSRange(location: 0, length: attributedText.string.utf16.count)) 118 | 119 | return attributedText 120 | } 121 | 122 | override func prefersStatusBarHidden() -> Bool { 123 | return true 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /Math/Math/latinmodern-math.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishikawakatsumi/TextKitExamples/78586f73150e01f4db063f0b1448ff5bdb407a82/Math/Math/latinmodern-math.otf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextKitExamples 2 | TextKit examples for try! Swift NYC 2016 3 | 4 | ### Slide: 5 | https://speakerdeck.com/kishikawakatsumi/mastering-textkit 6 | 7 | ### Math Formula Example: 8 | 9 | 10 | 11 | 12 | 13 | ### Bullet Point Example: 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /bulletpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishikawakatsumi/TextKitExamples/78586f73150e01f4db063f0b1448ff5bdb407a82/bulletpoint.png -------------------------------------------------------------------------------- /math.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishikawakatsumi/TextKitExamples/78586f73150e01f4db063f0b1448ff5bdb407a82/math.png --------------------------------------------------------------------------------