├── .gitattributes ├── .gitignore ├── .gitmodules ├── .swift-version ├── .travis.yml ├── LICENSE ├── README.md ├── SourceEditor.podspec ├── SourceEditor.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── WorkspaceSettings.xcsettings ├── SourceEditor.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Sources ├── Info.plist ├── Languages │ ├── Python3Lexer.swift │ └── SwiftLexer.swift ├── SourceCodeRegexLexer.swift ├── SourceCodeTheme.swift ├── SourceCodeToken.swift ├── SourceEditor.h └── Themes │ └── DefaultSourceCodeTheme.swift ├── iOS Example ├── iOS Example.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── iOS Example.xcscheme └── iOS Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift └── readme-resources └── ios-example.png /.gitattributes: -------------------------------------------------------------------------------- 1 | SourceEditorView.podspec linguist-vendored 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | .DS_Store 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Dependencies/SavannaKit"] 2 | path = Dependencies/SavannaKit 3 | url = https://github.com/louisdh/savannakit.git 4 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.1 -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode9.4 3 | branches: 4 | only: 5 | - master 6 | env: 7 | global: 8 | - LC_CTYPE=en_US.UTF-8 9 | - LANG=en_US.UTF-8 10 | - WORKSPACE=SourceEditor.xcworkspace 11 | - IOS_FRAMEWORK_SCHEME="SourceEditor" 12 | - MACOS_FRAMEWORK_SCHEME="SourceEditor" 13 | matrix: 14 | 15 | - DESTINATION="OS=11.4,name=iPad Pro (9.7-inch)" SCHEME="$IOS_FRAMEWORK_SCHEME" 16 | # - DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" 17 | 18 | script: 19 | - set -o pipefail 20 | - xcodebuild -version 21 | - xcodebuild -showsdks 22 | 23 | - travis_retry xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty; 24 | 25 | after_success: 26 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 27 | bash <(curl -s https://codecov.io/bash); 28 | fi -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Louis D'hauwe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SourceEditor 2 |

3 | Build Status 4 | Codecov 5 |
6 | Swift 7 | PodVersion 8 | Carthage Compatible 9 | Platform: iOS macOS 10 |
11 | Twitter 12 | Donate via PayPal 13 |

14 | 15 | A native source editor for iOS and macOS. Under the hood, this uses [SavannaKit](https://github.com/louisdh/savannakit). The goal of this project is to provide a very fast source editor, supporting many programming languages, out of the box. Currently, only Swift is supported. But adding support for a new language requires little work. 16 | 17 | ![](readme-resources/ios-example.png) 18 | 19 | ## License 20 | 21 | This project is available under the MIT license. See the LICENSE file for more info. 22 | -------------------------------------------------------------------------------- /SourceEditor.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'SourceEditor' 3 | s.version = '1.0.1' 4 | s.license = 'MIT' 5 | s.summary = 'A native source editor for iOS and macOS.' 6 | s.homepage = 'https://github.com/louisdh/source-editor' 7 | s.social_media_url = 'http://twitter.com/LouisDhauwe' 8 | s.authors = { 'Louis D\'hauwe' => 'louisdhauwe@silverfox.be' } 9 | s.source = { :git => 'https://github.com/louisdh/source-editor.git', :tag => s.version } 10 | s.module_name = 'SourceEditor' 11 | 12 | s.ios.deployment_target = '11.0' 13 | s.osx.deployment_target = '10.13' 14 | 15 | s.source_files = 'Sources/**/*.swift' 16 | 17 | s.dependency 'SavannaKit', '~> 0.9' 18 | 19 | end 20 | -------------------------------------------------------------------------------- /SourceEditor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE09FBF120FFD141002BA501 /* SourceEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = BE09FBEF20FFD141002BA501 /* SourceEditor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | BE09FBF520FFD155002BA501 /* SourceCodeRegexLexer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE09FBF220FFD155002BA501 /* SourceCodeRegexLexer.swift */; }; 12 | BE09FBF720FFD155002BA501 /* SourceCodeToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE09FBF420FFD155002BA501 /* SourceCodeToken.swift */; }; 13 | BE27F55C210BAB47003FEF67 /* SavannaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE27F55B210BAB47003FEF67 /* SavannaKit.framework */; }; 14 | BED4BCBF210832A40068AEE3 /* SwiftLexer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BED4BCBE210832A40068AEE3 /* SwiftLexer.swift */; }; 15 | BED4BCC1210832FC0068AEE3 /* SourceCodeTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = BED4BCC0210832FC0068AEE3 /* SourceCodeTheme.swift */; }; 16 | BED4BCC3210833210068AEE3 /* DefaultSourceCodeTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = BED4BCC2210833210068AEE3 /* DefaultSourceCodeTheme.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | BE09FBE220FFCF06002BA501 /* SourceEditor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SourceEditor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | BE09FBEE20FFD141002BA501 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 22 | BE09FBEF20FFD141002BA501 /* SourceEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceEditor.h; sourceTree = ""; }; 23 | BE09FBF220FFD155002BA501 /* SourceCodeRegexLexer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceCodeRegexLexer.swift; sourceTree = ""; }; 24 | BE09FBF420FFD155002BA501 /* SourceCodeToken.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceCodeToken.swift; sourceTree = ""; }; 25 | BE27F55B210BAB47003FEF67 /* SavannaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SavannaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | BED4BCBE210832A40068AEE3 /* SwiftLexer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLexer.swift; sourceTree = ""; }; 27 | BED4BCC0210832FC0068AEE3 /* SourceCodeTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceCodeTheme.swift; sourceTree = ""; }; 28 | BED4BCC2210833210068AEE3 /* DefaultSourceCodeTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultSourceCodeTheme.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | BE09FBDE20FFCF06002BA501 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | BE27F55C210BAB47003FEF67 /* SavannaKit.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | BE09FBD820FFCF06002BA501 = { 44 | isa = PBXGroup; 45 | children = ( 46 | BE09FBED20FFD141002BA501 /* Sources */, 47 | BE09FBE320FFCF06002BA501 /* Products */, 48 | BE27F55A210BAB47003FEF67 /* Frameworks */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | BE09FBE320FFCF06002BA501 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | BE09FBE220FFCF06002BA501 /* SourceEditor.framework */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | BE09FBED20FFD141002BA501 /* Sources */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | BED4BCC4210833450068AEE3 /* Themes */, 64 | BED4BCBD210832930068AEE3 /* Languages */, 65 | BE09FBF420FFD155002BA501 /* SourceCodeToken.swift */, 66 | BE09FBF220FFD155002BA501 /* SourceCodeRegexLexer.swift */, 67 | BED4BCC0210832FC0068AEE3 /* SourceCodeTheme.swift */, 68 | BE09FBEE20FFD141002BA501 /* Info.plist */, 69 | BE09FBEF20FFD141002BA501 /* SourceEditor.h */, 70 | ); 71 | path = Sources; 72 | sourceTree = ""; 73 | }; 74 | BE27F55A210BAB47003FEF67 /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | BE27F55B210BAB47003FEF67 /* SavannaKit.framework */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | BED4BCBD210832930068AEE3 /* Languages */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | BED4BCBE210832A40068AEE3 /* SwiftLexer.swift */, 86 | ); 87 | path = Languages; 88 | sourceTree = ""; 89 | }; 90 | BED4BCC4210833450068AEE3 /* Themes */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | BED4BCC2210833210068AEE3 /* DefaultSourceCodeTheme.swift */, 94 | ); 95 | path = Themes; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXHeadersBuildPhase section */ 101 | BE09FBDF20FFCF06002BA501 /* Headers */ = { 102 | isa = PBXHeadersBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | BE09FBF120FFD141002BA501 /* SourceEditor.h in Headers */, 106 | ); 107 | runOnlyForDeploymentPostprocessing = 0; 108 | }; 109 | /* End PBXHeadersBuildPhase section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | BE09FBE120FFCF06002BA501 /* SourceEditor */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = BE09FBEA20FFCF06002BA501 /* Build configuration list for PBXNativeTarget "SourceEditor" */; 115 | buildPhases = ( 116 | BE09FBDD20FFCF06002BA501 /* Sources */, 117 | BE09FBDE20FFCF06002BA501 /* Frameworks */, 118 | BE09FBDF20FFCF06002BA501 /* Headers */, 119 | BE09FBE020FFCF06002BA501 /* Resources */, 120 | ); 121 | buildRules = ( 122 | ); 123 | dependencies = ( 124 | ); 125 | name = SourceEditor; 126 | productName = SourceEditor; 127 | productReference = BE09FBE220FFCF06002BA501 /* SourceEditor.framework */; 128 | productType = "com.apple.product-type.framework"; 129 | }; 130 | /* End PBXNativeTarget section */ 131 | 132 | /* Begin PBXProject section */ 133 | BE09FBD920FFCF06002BA501 /* Project object */ = { 134 | isa = PBXProject; 135 | attributes = { 136 | LastUpgradeCheck = 0940; 137 | ORGANIZATIONNAME = "Silver Fox"; 138 | TargetAttributes = { 139 | BE09FBE120FFCF06002BA501 = { 140 | CreatedOnToolsVersion = 9.4.1; 141 | LastSwiftMigration = 0940; 142 | }; 143 | }; 144 | }; 145 | buildConfigurationList = BE09FBDC20FFCF06002BA501 /* Build configuration list for PBXProject "SourceEditor" */; 146 | compatibilityVersion = "Xcode 9.3"; 147 | developmentRegion = en; 148 | hasScannedForEncodings = 0; 149 | knownRegions = ( 150 | en, 151 | ); 152 | mainGroup = BE09FBD820FFCF06002BA501; 153 | productRefGroup = BE09FBE320FFCF06002BA501 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | BE09FBE120FFCF06002BA501 /* SourceEditor */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | BE09FBE020FFCF06002BA501 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXSourcesBuildPhase section */ 173 | BE09FBDD20FFCF06002BA501 /* Sources */ = { 174 | isa = PBXSourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | BED4BCC1210832FC0068AEE3 /* SourceCodeTheme.swift in Sources */, 178 | BED4BCBF210832A40068AEE3 /* SwiftLexer.swift in Sources */, 179 | BE09FBF720FFD155002BA501 /* SourceCodeToken.swift in Sources */, 180 | BE09FBF520FFD155002BA501 /* SourceCodeRegexLexer.swift in Sources */, 181 | BED4BCC3210833210068AEE3 /* DefaultSourceCodeTheme.swift in Sources */, 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | }; 185 | /* End PBXSourcesBuildPhase section */ 186 | 187 | /* Begin XCBuildConfiguration section */ 188 | BE09FBE820FFCF06002BA501 /* Debug */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | ALWAYS_SEARCH_USER_PATHS = NO; 192 | CLANG_ANALYZER_NONNULL = YES; 193 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 194 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 195 | CLANG_CXX_LIBRARY = "libc++"; 196 | CLANG_ENABLE_MODULES = YES; 197 | CLANG_ENABLE_OBJC_ARC = YES; 198 | CLANG_ENABLE_OBJC_WEAK = YES; 199 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_COMMA = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INFINITE_RECURSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 212 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 214 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 215 | CLANG_WARN_STRICT_PROTOTYPES = YES; 216 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 217 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 218 | CLANG_WARN_UNREACHABLE_CODE = YES; 219 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 220 | CODE_SIGN_IDENTITY = "iPhone Developer"; 221 | COPY_PHASE_STRIP = NO; 222 | CURRENT_PROJECT_VERSION = 1; 223 | DEBUG_INFORMATION_FORMAT = dwarf; 224 | ENABLE_STRICT_OBJC_MSGSEND = YES; 225 | ENABLE_TESTABILITY = YES; 226 | GCC_C_LANGUAGE_STANDARD = gnu11; 227 | GCC_DYNAMIC_NO_PIC = NO; 228 | GCC_NO_COMMON_BLOCKS = YES; 229 | GCC_OPTIMIZATION_LEVEL = 0; 230 | GCC_PREPROCESSOR_DEFINITIONS = ( 231 | "DEBUG=1", 232 | "$(inherited)", 233 | ); 234 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 235 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 236 | GCC_WARN_UNDECLARED_SELECTOR = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 238 | GCC_WARN_UNUSED_FUNCTION = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 241 | MTL_ENABLE_DEBUG_INFO = YES; 242 | ONLY_ACTIVE_ARCH = YES; 243 | SDKROOT = iphoneos; 244 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 245 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 246 | VERSIONING_SYSTEM = "apple-generic"; 247 | VERSION_INFO_PREFIX = ""; 248 | }; 249 | name = Debug; 250 | }; 251 | BE09FBE920FFCF06002BA501 /* Release */ = { 252 | isa = XCBuildConfiguration; 253 | buildSettings = { 254 | ALWAYS_SEARCH_USER_PATHS = NO; 255 | CLANG_ANALYZER_NONNULL = YES; 256 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 257 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 258 | CLANG_CXX_LIBRARY = "libc++"; 259 | CLANG_ENABLE_MODULES = YES; 260 | CLANG_ENABLE_OBJC_ARC = YES; 261 | CLANG_ENABLE_OBJC_WEAK = YES; 262 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 263 | CLANG_WARN_BOOL_CONVERSION = YES; 264 | CLANG_WARN_COMMA = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 268 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INFINITE_RECURSION = YES; 272 | CLANG_WARN_INT_CONVERSION = YES; 273 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 275 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 278 | CLANG_WARN_STRICT_PROTOTYPES = YES; 279 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 280 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | CODE_SIGN_IDENTITY = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | CURRENT_PROJECT_VERSION = 1; 286 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 287 | ENABLE_NS_ASSERTIONS = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu11; 290 | GCC_NO_COMMON_BLOCKS = YES; 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 298 | MTL_ENABLE_DEBUG_INFO = NO; 299 | SDKROOT = iphoneos; 300 | SWIFT_COMPILATION_MODE = wholemodule; 301 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 302 | VALIDATE_PRODUCT = YES; 303 | VERSIONING_SYSTEM = "apple-generic"; 304 | VERSION_INFO_PREFIX = ""; 305 | }; 306 | name = Release; 307 | }; 308 | BE09FBEB20FFCF06002BA501 /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | CLANG_ENABLE_MODULES = YES; 312 | CODE_SIGN_IDENTITY = ""; 313 | CODE_SIGN_STYLE = Automatic; 314 | DEFINES_MODULE = YES; 315 | DYLIB_COMPATIBILITY_VERSION = 1; 316 | DYLIB_CURRENT_VERSION = 1; 317 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 318 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; 319 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 320 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 321 | LD_RUNPATH_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "@executable_path/Frameworks", 324 | "@loader_path/Frameworks", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.SourceEditor; 327 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 328 | SKIP_INSTALL = YES; 329 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 330 | SWIFT_VERSION = 4.0; 331 | TARGETED_DEVICE_FAMILY = "1,2"; 332 | }; 333 | name = Debug; 334 | }; 335 | BE09FBEC20FFCF06002BA501 /* Release */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | CLANG_ENABLE_MODULES = YES; 339 | CODE_SIGN_IDENTITY = ""; 340 | CODE_SIGN_STYLE = Automatic; 341 | DEFINES_MODULE = YES; 342 | DYLIB_COMPATIBILITY_VERSION = 1; 343 | DYLIB_CURRENT_VERSION = 1; 344 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 345 | INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; 346 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 347 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 348 | LD_RUNPATH_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "@executable_path/Frameworks", 351 | "@loader_path/Frameworks", 352 | ); 353 | PRODUCT_BUNDLE_IDENTIFIER = be.silverfox.SourceEditor; 354 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 355 | SKIP_INSTALL = YES; 356 | SWIFT_VERSION = 4.0; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Release; 360 | }; 361 | /* End XCBuildConfiguration section */ 362 | 363 | /* Begin XCConfigurationList section */ 364 | BE09FBDC20FFCF06002BA501 /* Build configuration list for PBXProject "SourceEditor" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | BE09FBE820FFCF06002BA501 /* Debug */, 368 | BE09FBE920FFCF06002BA501 /* Release */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | BE09FBEA20FFCF06002BA501 /* Build configuration list for PBXNativeTarget "SourceEditor" */ = { 374 | isa = XCConfigurationList; 375 | buildConfigurations = ( 376 | BE09FBEB20FFCF06002BA501 /* Debug */, 377 | BE09FBEC20FFCF06002BA501 /* Release */, 378 | ); 379 | defaultConfigurationIsVisible = 0; 380 | defaultConfigurationName = Release; 381 | }; 382 | /* End XCConfigurationList section */ 383 | }; 384 | rootObject = BE09FBD920FFCF06002BA501 /* Project object */; 385 | } 386 | -------------------------------------------------------------------------------- /SourceEditor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SourceEditor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SourceEditor.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Latest 7 | 8 | 9 | -------------------------------------------------------------------------------- /SourceEditor.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SourceEditor.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | -------------------------------------------------------------------------------- /Sources/Languages/Python3Lexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Python3Lexer.swift 3 | // SourceEditor 4 | // 5 | // Created by Stefan Wijnja on 27/07/2018. 6 | // Based on SwiftLexer.swift by Louis D'hauwe. 7 | // Copyright © 2018 Silver Fox. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | import SavannaKit 12 | 13 | public class Python3Lexer: SourceCodeRegexLexer { 14 | 15 | public init() { 16 | 17 | } 18 | 19 | lazy var generators: [TokenGenerator] = { 20 | 21 | var generators = [TokenGenerator?]() 22 | // Functions 23 | generators.append(regexGenerator("\\bprint(?=\\()", tokenType: .identifier)) 24 | 25 | generators.append(regexGenerator("(?<=[^a-zA-Z])\\d+", tokenType: .number)) 26 | 27 | generators.append(regexGenerator("\\.\\w+", tokenType: .identifier)) 28 | 29 | let keywords = "False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield".components(separatedBy: " ") 30 | 31 | generators.append(keywordGenerator(keywords, tokenType: .keyword)) 32 | 33 | // Line comment 34 | generators.append(regexGenerator("#(.*)", tokenType: .comment)) 35 | 36 | // Block comment or multi-line string literal 37 | generators.append(regexGenerator("(\"\"\")(.*?)(\"\"\")", options: [.dotMatchesLineSeparators], tokenType: .string)) 38 | generators.append(regexGenerator("(\'\'\')(.*?)(\'\'\')", options: [.dotMatchesLineSeparators], tokenType: .string)) 39 | 40 | // Single-line string literal 41 | generators.append(regexGenerator("(\"|@\")[^\"\\n]*(@\"|\")", tokenType: .string)) 42 | generators.append(regexGenerator("('|@')[^'\\n]*(@'|')", tokenType: .string)) 43 | 44 | // Editor placeholder 45 | var editorPlaceholderPattern = "(<#)[^\"\\n]*" 46 | editorPlaceholderPattern += "(#>)" 47 | generators.append(regexGenerator(editorPlaceholderPattern, tokenType: .editorPlaceholder)) 48 | 49 | return generators.compactMap( { $0 }) 50 | }() 51 | 52 | public func generators(source: String) -> [TokenGenerator] { 53 | return generators 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Sources/Languages/SwiftLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftLexer.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SavannaKit 11 | 12 | public class SwiftLexer: SourceCodeRegexLexer { 13 | 14 | public init() { 15 | 16 | } 17 | 18 | lazy var generators: [TokenGenerator] = { 19 | 20 | var generators = [TokenGenerator?]() 21 | 22 | // UI/App Kit 23 | generators.append(regexGenerator("\\b(NS|UI)[A-Z][a-zA-Z]+\\b", tokenType: .identifier)) 24 | 25 | // Functions 26 | 27 | generators.append(regexGenerator("\\b(println|print)(?=\\()", tokenType: .identifier)) 28 | 29 | generators.append(regexGenerator("(?<=(\\s|\\[|,|:))\\d+", tokenType: .number)) 30 | 31 | generators.append(regexGenerator("\\.\\w+", tokenType: .identifier)) 32 | 33 | let keywords = "as associatedtype break case catch class continue convenience default defer deinit else enum extension fallthrough false fileprivate final for func get guard if import in init inout internal is lazy let mutating nil nonmutating open operator override private protocol public repeat required rethrows return required self set static struct subscript super switch throw throws true try typealias unowned var weak where while".components(separatedBy: " ") 34 | 35 | generators.append(keywordGenerator(keywords, tokenType: .keyword)) 36 | 37 | let stdlibIdentifiers = "Any Array AutoreleasingUnsafePointer BidirectionalReverseView Bit Bool CFunctionPointer COpaquePointer CVaListPointer Character CollectionOfOne ConstUnsafePointer ContiguousArray Data Dictionary DictionaryGenerator DictionaryIndex Double EmptyCollection EmptyGenerator EnumerateGenerator FilterCollectionView FilterCollectionViewIndex FilterGenerator FilterSequenceView Float Float80 FloatingPointClassification GeneratorOf GeneratorOfOne GeneratorSequence HeapBuffer HeapBuffer HeapBufferStorage HeapBufferStorageBase ImplicitlyUnwrappedOptional IndexingGenerator Int Int16 Int32 Int64 Int8 IntEncoder LazyBidirectionalCollection LazyForwardCollection LazyRandomAccessCollection LazySequence Less MapCollectionView MapSequenceGenerator MapSequenceView MirrorDisposition ObjectIdentifier OnHeap Optional PermutationGenerator QuickLookObject RandomAccessReverseView Range RangeGenerator RawByte Repeat ReverseBidirectionalIndex Printable ReverseRandomAccessIndex SequenceOf SinkOf Slice StaticString StrideThrough StrideThroughGenerator StrideTo StrideToGenerator String Index UTF8View Index UnicodeScalarView IndexType GeneratorType UTF16View UInt UInt16 UInt32 UInt64 UInt8 UTF16 UTF32 UTF8 UnicodeDecodingResult UnicodeScalar Unmanaged UnsafeArray UnsafeArrayGenerator UnsafeMutableArray UnsafePointer VaListBuilder Header Zip2 ZipGenerator2".components(separatedBy: " ") 38 | 39 | generators.append(keywordGenerator(stdlibIdentifiers, tokenType: .identifier)) 40 | 41 | // Line comment 42 | generators.append(regexGenerator("//(.*)", tokenType: .comment)) 43 | 44 | // Block comment 45 | generators.append(regexGenerator("/\\*([^*]|\\*+[^/])*\\*+/", options: [.dotMatchesLineSeparators], tokenType: .comment)) 46 | 47 | // Single-line string literal 48 | generators.append(regexGenerator("(\"|@\")[^\"\\n]*(@\"|\")", tokenType: .string)) 49 | 50 | // Multi-line string literal 51 | generators.append(regexGenerator("(\"\"\")(.*?)(\"\"\")", options: [.dotMatchesLineSeparators], tokenType: .string)) 52 | 53 | // Editor placeholder 54 | var editorPlaceholderPattern = "(<#)[^\"\\n]*" 55 | editorPlaceholderPattern += "(#>)" 56 | generators.append(regexGenerator(editorPlaceholderPattern, tokenType: .editorPlaceholder)) 57 | 58 | return generators.compactMap( { $0 }) 59 | }() 60 | 61 | public func generators(source: String) -> [TokenGenerator] { 62 | return generators 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Sources/SourceCodeRegexLexer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SavannaKit+Swift.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SavannaKit 11 | 12 | public protocol SourceCodeRegexLexer: RegexLexer { 13 | 14 | 15 | } 16 | 17 | extension RegexLexer { 18 | 19 | public func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], transformer: @escaping TokenTransformer) -> TokenGenerator? { 20 | 21 | guard let regex = try? NSRegularExpression(pattern: pattern, options: options) else { 22 | return nil 23 | } 24 | 25 | return .regex(RegexTokenGenerator(regularExpression: regex, tokenTransformer: transformer)) 26 | } 27 | 28 | } 29 | 30 | extension SourceCodeRegexLexer { 31 | 32 | public func regexGenerator(_ pattern: String, options: NSRegularExpression.Options = [], tokenType: SourceCodeTokenType) -> TokenGenerator? { 33 | 34 | return regexGenerator(pattern, options: options, transformer: { (range) -> Token in 35 | return SimpleSourceCodeToken(type: tokenType, range: range) 36 | }) 37 | } 38 | 39 | public func keywordGenerator(_ words: [String], tokenType: SourceCodeTokenType) -> TokenGenerator { 40 | 41 | return .keywords(KeywordTokenGenerator(keywords: words, tokenTransformer: { (range) -> Token in 42 | return SimpleSourceCodeToken(type: tokenType, range: range) 43 | })) 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Sources/SourceCodeTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeTheme.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SavannaKit 11 | 12 | public protocol SourceCodeTheme: SyntaxColorTheme { 13 | 14 | func color(for syntaxColorType: SourceCodeTokenType) -> Color 15 | 16 | } 17 | 18 | extension SourceCodeTheme { 19 | 20 | public func globalAttributes() -> [NSAttributedStringKey: Any] { 21 | 22 | var attributes = [NSAttributedStringKey: Any]() 23 | 24 | attributes[.font] = font 25 | attributes[.foregroundColor] = Color.white 26 | 27 | return attributes 28 | } 29 | 30 | public func attributes(for token: SavannaKit.Token) -> [NSAttributedStringKey: Any] { 31 | var attributes = [NSAttributedStringKey: Any]() 32 | 33 | if let token = token as? SimpleSourceCodeToken { 34 | attributes[.foregroundColor] = color(for: token.type) 35 | } 36 | 37 | return attributes 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Sources/SourceCodeToken.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceCodeToken.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SavannaKit 11 | 12 | public enum SourceCodeTokenType { 13 | case plain 14 | case number 15 | case string 16 | case identifier 17 | case builtin 18 | case keyword 19 | case comment 20 | case editorPlaceholder 21 | } 22 | 23 | protocol SourceCodeToken: Token { 24 | 25 | var type: SourceCodeTokenType { get } 26 | 27 | } 28 | 29 | extension SourceCodeToken { 30 | 31 | var isEditorPlaceholder: Bool { 32 | return type == .editorPlaceholder 33 | } 34 | 35 | var isPlain: Bool { 36 | return type == .plain 37 | } 38 | 39 | } 40 | 41 | struct SimpleSourceCodeToken: SourceCodeToken { 42 | 43 | let type: SourceCodeTokenType 44 | 45 | let range: Range 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Sources/SourceEditor.h: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditor.h 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 18/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | -------------------------------------------------------------------------------- /Sources/Themes/DefaultSourceCodeTheme.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultSourceCodeTheme.swift 3 | // SourceEditor 4 | // 5 | // Created by Louis D'hauwe on 24/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SavannaKit 11 | 12 | public struct DefaultSourceCodeTheme: SourceCodeTheme { 13 | 14 | public init() { 15 | 16 | } 17 | 18 | private static var lineNumbersColor: Color { 19 | return Color(red: 100/255, green: 100/255, blue: 100/255, alpha: 1.0) 20 | } 21 | 22 | public let lineNumbersStyle: LineNumbersStyle? = LineNumbersStyle(font: Font(name: "Menlo", size: 16)!, textColor: lineNumbersColor) 23 | 24 | public let gutterStyle: GutterStyle = GutterStyle(backgroundColor: Color(red: 21/255.0, green: 22/255, blue: 31/255, alpha: 1.0), minimumWidth: 32) 25 | 26 | public let font = Font(name: "Menlo", size: 15)! 27 | 28 | public let backgroundColor = Color(red: 31/255.0, green: 32/255, blue: 41/255, alpha: 1.0) 29 | 30 | public func color(for syntaxColorType: SourceCodeTokenType) -> Color { 31 | 32 | switch syntaxColorType { 33 | case .plain: 34 | return .white 35 | 36 | case .number: 37 | return Color(red: 116/255, green: 109/255, blue: 176/255, alpha: 1.0) 38 | 39 | case .string: 40 | return Color(red: 211/255, green: 35/255, blue: 46/255, alpha: 1.0) 41 | 42 | case .identifier: 43 | return Color(red: 20/255, green: 156/255, blue: 146/255, alpha: 1.0) 44 | 45 | case .builtin: 46 | return Color(red: 20/255, green: 156/255, blue: 146/255, alpha: 1.0) 47 | 48 | case .keyword: 49 | return Color(red: 215/255, green: 0, blue: 143/255, alpha: 1.0) 50 | 51 | case .comment: 52 | return Color(red: 69.0/255.0, green: 187.0/255.0, blue: 62.0/255.0, alpha: 1.0) 53 | 54 | case .editorPlaceholder: 55 | return backgroundColor 56 | } 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /iOS Example/iOS Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE44E42B21086C6800EA7BBD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE44E42A21086C6800EA7BBD /* AppDelegate.swift */; }; 11 | BE44E42D21086C6800EA7BBD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE44E42C21086C6800EA7BBD /* ViewController.swift */; }; 12 | BE44E43021086C6800EA7BBD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE44E42E21086C6800EA7BBD /* Main.storyboard */; }; 13 | BE44E43221086C6900EA7BBD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE44E43121086C6900EA7BBD /* Assets.xcassets */; }; 14 | BE44E43521086C6900EA7BBD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE44E43321086C6900EA7BBD /* LaunchScreen.storyboard */; }; 15 | BE44E43D21086DB000EA7BBD /* SavannaKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE44E43C21086DB000EA7BBD /* SavannaKit.framework */; }; 16 | BE44E43E21086DB000EA7BBD /* SavannaKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE44E43C21086DB000EA7BBD /* SavannaKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | BE44E44021086DB000EA7BBD /* SourceEditor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE44E43F21086DB000EA7BBD /* SourceEditor.framework */; }; 18 | BE44E44121086DB000EA7BBD /* SourceEditor.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE44E43F21086DB000EA7BBD /* SourceEditor.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | BE44E44221086DB100EA7BBD /* Embed Frameworks */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = ""; 26 | dstSubfolderSpec = 10; 27 | files = ( 28 | BE44E44121086DB000EA7BBD /* SourceEditor.framework in Embed Frameworks */, 29 | BE44E43E21086DB000EA7BBD /* SavannaKit.framework in Embed Frameworks */, 30 | ); 31 | name = "Embed Frameworks"; 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXCopyFilesBuildPhase section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | BE44E42721086C6800EA7BBD /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | BE44E42A21086C6800EA7BBD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | BE44E42C21086C6800EA7BBD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 40 | BE44E42F21086C6800EA7BBD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | BE44E43121086C6900EA7BBD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | BE44E43421086C6900EA7BBD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 43 | BE44E43621086C6900EA7BBD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | BE44E43C21086DB000EA7BBD /* SavannaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SavannaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | BE44E43F21086DB000EA7BBD /* SourceEditor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SourceEditor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | BE44E42421086C6800EA7BBD /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | BE44E44021086DB000EA7BBD /* SourceEditor.framework in Frameworks */, 54 | BE44E43D21086DB000EA7BBD /* SavannaKit.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | BE44E41E21086C6800EA7BBD = { 62 | isa = PBXGroup; 63 | children = ( 64 | BE44E43F21086DB000EA7BBD /* SourceEditor.framework */, 65 | BE44E43C21086DB000EA7BBD /* SavannaKit.framework */, 66 | BE44E42921086C6800EA7BBD /* iOS Example */, 67 | BE44E42821086C6800EA7BBD /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | BE44E42821086C6800EA7BBD /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | BE44E42721086C6800EA7BBD /* iOS Example.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | BE44E42921086C6800EA7BBD /* iOS Example */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | BE44E42A21086C6800EA7BBD /* AppDelegate.swift */, 83 | BE44E42C21086C6800EA7BBD /* ViewController.swift */, 84 | BE44E42E21086C6800EA7BBD /* Main.storyboard */, 85 | BE44E43121086C6900EA7BBD /* Assets.xcassets */, 86 | BE44E43321086C6900EA7BBD /* LaunchScreen.storyboard */, 87 | BE44E43621086C6900EA7BBD /* Info.plist */, 88 | ); 89 | path = "iOS Example"; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXNativeTarget section */ 95 | BE44E42621086C6800EA7BBD /* iOS Example */ = { 96 | isa = PBXNativeTarget; 97 | buildConfigurationList = BE44E43921086C6900EA7BBD /* Build configuration list for PBXNativeTarget "iOS Example" */; 98 | buildPhases = ( 99 | BE44E42321086C6800EA7BBD /* Sources */, 100 | BE44E42421086C6800EA7BBD /* Frameworks */, 101 | BE44E42521086C6800EA7BBD /* Resources */, 102 | BE44E44221086DB100EA7BBD /* Embed Frameworks */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = "iOS Example"; 109 | productName = "iOS Example"; 110 | productReference = BE44E42721086C6800EA7BBD /* iOS Example.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | BE44E41F21086C6800EA7BBD /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastSwiftUpdateCheck = 0940; 120 | LastUpgradeCheck = 0940; 121 | ORGANIZATIONNAME = "Silver Fox"; 122 | TargetAttributes = { 123 | BE44E42621086C6800EA7BBD = { 124 | CreatedOnToolsVersion = 9.4.1; 125 | }; 126 | }; 127 | }; 128 | buildConfigurationList = BE44E42221086C6800EA7BBD /* Build configuration list for PBXProject "iOS Example" */; 129 | compatibilityVersion = "Xcode 9.3"; 130 | developmentRegion = en; 131 | hasScannedForEncodings = 0; 132 | knownRegions = ( 133 | en, 134 | Base, 135 | ); 136 | mainGroup = BE44E41E21086C6800EA7BBD; 137 | productRefGroup = BE44E42821086C6800EA7BBD /* Products */; 138 | projectDirPath = ""; 139 | projectRoot = ""; 140 | targets = ( 141 | BE44E42621086C6800EA7BBD /* iOS Example */, 142 | ); 143 | }; 144 | /* End PBXProject section */ 145 | 146 | /* Begin PBXResourcesBuildPhase section */ 147 | BE44E42521086C6800EA7BBD /* Resources */ = { 148 | isa = PBXResourcesBuildPhase; 149 | buildActionMask = 2147483647; 150 | files = ( 151 | BE44E43521086C6900EA7BBD /* LaunchScreen.storyboard in Resources */, 152 | BE44E43221086C6900EA7BBD /* Assets.xcassets in Resources */, 153 | BE44E43021086C6800EA7BBD /* Main.storyboard in Resources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXResourcesBuildPhase section */ 158 | 159 | /* Begin PBXSourcesBuildPhase section */ 160 | BE44E42321086C6800EA7BBD /* Sources */ = { 161 | isa = PBXSourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | BE44E42D21086C6800EA7BBD /* ViewController.swift in Sources */, 165 | BE44E42B21086C6800EA7BBD /* AppDelegate.swift in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin PBXVariantGroup section */ 172 | BE44E42E21086C6800EA7BBD /* Main.storyboard */ = { 173 | isa = PBXVariantGroup; 174 | children = ( 175 | BE44E42F21086C6800EA7BBD /* Base */, 176 | ); 177 | name = Main.storyboard; 178 | sourceTree = ""; 179 | }; 180 | BE44E43321086C6900EA7BBD /* LaunchScreen.storyboard */ = { 181 | isa = PBXVariantGroup; 182 | children = ( 183 | BE44E43421086C6900EA7BBD /* Base */, 184 | ); 185 | name = LaunchScreen.storyboard; 186 | sourceTree = ""; 187 | }; 188 | /* End PBXVariantGroup section */ 189 | 190 | /* Begin XCBuildConfiguration section */ 191 | BE44E43721086C6900EA7BBD /* Debug */ = { 192 | isa = XCBuildConfiguration; 193 | buildSettings = { 194 | ALWAYS_SEARCH_USER_PATHS = NO; 195 | CLANG_ANALYZER_NONNULL = YES; 196 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 197 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 198 | CLANG_CXX_LIBRARY = "libc++"; 199 | CLANG_ENABLE_MODULES = YES; 200 | CLANG_ENABLE_OBJC_ARC = YES; 201 | CLANG_ENABLE_OBJC_WEAK = YES; 202 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 203 | CLANG_WARN_BOOL_CONVERSION = YES; 204 | CLANG_WARN_COMMA = YES; 205 | CLANG_WARN_CONSTANT_CONVERSION = YES; 206 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 207 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 208 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 209 | CLANG_WARN_EMPTY_BODY = YES; 210 | CLANG_WARN_ENUM_CONVERSION = YES; 211 | CLANG_WARN_INFINITE_RECURSION = YES; 212 | CLANG_WARN_INT_CONVERSION = YES; 213 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 214 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 215 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 216 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 217 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 218 | CLANG_WARN_STRICT_PROTOTYPES = YES; 219 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 220 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | CODE_SIGN_IDENTITY = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | DEBUG_INFORMATION_FORMAT = dwarf; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | ENABLE_TESTABILITY = YES; 228 | GCC_C_LANGUAGE_STANDARD = gnu11; 229 | GCC_DYNAMIC_NO_PIC = NO; 230 | GCC_NO_COMMON_BLOCKS = YES; 231 | GCC_OPTIMIZATION_LEVEL = 0; 232 | GCC_PREPROCESSOR_DEFINITIONS = ( 233 | "DEBUG=1", 234 | "$(inherited)", 235 | ); 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_UNDECLARED_SELECTOR = YES; 239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 240 | GCC_WARN_UNUSED_FUNCTION = YES; 241 | GCC_WARN_UNUSED_VARIABLE = YES; 242 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 243 | MTL_ENABLE_DEBUG_INFO = YES; 244 | ONLY_ACTIVE_ARCH = YES; 245 | SDKROOT = iphoneos; 246 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 247 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 248 | }; 249 | name = Debug; 250 | }; 251 | BE44E43821086C6900EA7BBD /* Release */ = { 252 | isa = XCBuildConfiguration; 253 | buildSettings = { 254 | ALWAYS_SEARCH_USER_PATHS = NO; 255 | CLANG_ANALYZER_NONNULL = YES; 256 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 257 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 258 | CLANG_CXX_LIBRARY = "libc++"; 259 | CLANG_ENABLE_MODULES = YES; 260 | CLANG_ENABLE_OBJC_ARC = YES; 261 | CLANG_ENABLE_OBJC_WEAK = YES; 262 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 263 | CLANG_WARN_BOOL_CONVERSION = YES; 264 | CLANG_WARN_COMMA = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 268 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INFINITE_RECURSION = YES; 272 | CLANG_WARN_INT_CONVERSION = YES; 273 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 275 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 278 | CLANG_WARN_STRICT_PROTOTYPES = YES; 279 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 280 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | CODE_SIGN_IDENTITY = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu11; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | SWIFT_COMPILATION_MODE = wholemodule; 300 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Release; 304 | }; 305 | BE44E43A21086C6900EA7BBD /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | CODE_SIGN_STYLE = Automatic; 310 | DEVELOPMENT_TEAM = 6G5LMQ72D8; 311 | INFOPLIST_FILE = "iOS Example/Info.plist"; 312 | LD_RUNPATH_SEARCH_PATHS = ( 313 | "$(inherited)", 314 | "@executable_path/Frameworks", 315 | ); 316 | PRODUCT_BUNDLE_IDENTIFIER = "be.silverfox.iOS-Example"; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 4.0; 319 | TARGETED_DEVICE_FAMILY = "1,2"; 320 | }; 321 | name = Debug; 322 | }; 323 | BE44E43B21086C6900EA7BBD /* Release */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 327 | CODE_SIGN_STYLE = Automatic; 328 | DEVELOPMENT_TEAM = 6G5LMQ72D8; 329 | INFOPLIST_FILE = "iOS Example/Info.plist"; 330 | LD_RUNPATH_SEARCH_PATHS = ( 331 | "$(inherited)", 332 | "@executable_path/Frameworks", 333 | ); 334 | PRODUCT_BUNDLE_IDENTIFIER = "be.silverfox.iOS-Example"; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | SWIFT_VERSION = 4.0; 337 | TARGETED_DEVICE_FAMILY = "1,2"; 338 | }; 339 | name = Release; 340 | }; 341 | /* End XCBuildConfiguration section */ 342 | 343 | /* Begin XCConfigurationList section */ 344 | BE44E42221086C6800EA7BBD /* Build configuration list for PBXProject "iOS Example" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | BE44E43721086C6900EA7BBD /* Debug */, 348 | BE44E43821086C6900EA7BBD /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | BE44E43921086C6900EA7BBD /* Build configuration list for PBXNativeTarget "iOS Example" */ = { 354 | isa = XCConfigurationList; 355 | buildConfigurations = ( 356 | BE44E43A21086C6900EA7BBD /* Debug */, 357 | BE44E43B21086C6900EA7BBD /* Release */, 358 | ); 359 | defaultConfigurationIsVisible = 0; 360 | defaultConfigurationName = Release; 361 | }; 362 | /* End XCConfigurationList section */ 363 | }; 364 | rootObject = BE44E41F21086C6800EA7BBD /* Project object */; 365 | } 366 | -------------------------------------------------------------------------------- /iOS Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.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 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // iOS Example 4 | // 5 | // Created by Louis D'hauwe on 25/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iOS Example/iOS Example/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 | -------------------------------------------------------------------------------- /iOS Example/iOS 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 | Hello world 29 | */ 30 | 31 | let name = <#my name#> 32 | 33 | // Multi-line strings are awesome! 34 | """ 35 | { 36 | "isAwesome": true 37 | } 38 | """ 39 | 40 | guard !name.isEmpty else { 41 | return 42 | } 43 | 44 | print("My name is " + name) 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 95 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /iOS Example/iOS Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // iOS Example 4 | // 5 | // Created by Louis D'hauwe on 25/07/2018. 6 | // Copyright © 2018 Silver Fox. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SavannaKit 11 | import SourceEditor 12 | 13 | class ViewController: UIViewController { 14 | 15 | let lexer = SwiftLexer() 16 | 17 | @IBOutlet weak var syntaxTextView: SyntaxTextView! 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | syntaxTextView.theme = DefaultSourceCodeTheme() 23 | syntaxTextView.delegate = self 24 | 25 | } 26 | 27 | 28 | } 29 | 30 | extension ViewController: SyntaxTextViewDelegate { 31 | 32 | func didChangeText(_ syntaxTextView: SyntaxTextView) { 33 | 34 | 35 | } 36 | 37 | func didChangeSelectedRange(_ syntaxTextView: SyntaxTextView, selectedRange: NSRange) { 38 | 39 | 40 | } 41 | 42 | func lexerForSource(_ source: String) -> Lexer { 43 | return lexer 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /readme-resources/ios-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ColdGrub1384/source-editor/66812125b988d6593d601df53e472073776e7809/readme-resources/ios-example.png --------------------------------------------------------------------------------