Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Import project to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
george-lim committed Feb 16, 2021
0 parents commit aa70e4f
Show file tree
Hide file tree
Showing 21 changed files with 975 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 George Lim

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
SpriteKit Smooth Sketch
<br>
![GitHub downloads](https://img.shields.io/github/downloads/george-lim/smooth-sketch/total.svg)
[![GitHub release](https://img.shields.io/github/release/george-lim/smooth-sketch.svg)](https://github.com/george-lim/smooth-sketch/releases)
[![GitHub issues](https://img.shields.io/github/issues/george-lim/smooth-sketch.svg)](https://github.com/george-lim/smooth-sketch/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/george-lim/smooth-sketch.svg)](https://github.com/george-lim/smooth-sketch/pulls)
[![license](https://img.shields.io/github/license/george-lim/smooth-sketch.svg)](https://github.com/george-lim/smooth-sketch/blob/master/LICENSE)
===============

This project minimizes lag with free hand drawing SpriteKit apps by optimizing to decrease the number of nodes that are drawn on the screen from finger movement and eliminating the use of SKShapeNodes to output the lines. It uses bezier curves to calculate the movement of your sketch lines to produce the streaks that follow your finger.

1. [Inspiration](#inspiration)
1. [Demo](#demo)

# Inspiration

Freehand drawing is surprisingly difficult to implement properly on SpriteKit. That's because SKShapeNode is currently plagued with memory leaking bugs, meaning your overall game performance will degrade exponentially as the user continues drawing, until their device inevitably crashes.

I came across this issue when developing my [Traffic Pal](https://itunes.apple.com/ca/app/traffic-pal/id1265505042?mt=8) app for iOS, which required free hand drawing. After developing this framework to maximize freehand drawing performance in my app, I decided to open source my work so that nobody has to spend countless hours researching and optimizing freehand drawing anymore.

# Demo
![Demo](demo.gif)
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
328 changes: 328 additions & 0 deletions sketch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
5E56E77F1E38F33A00EFE334 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E56E77E1E38F33A00EFE334 /* AppDelegate.swift */; };
5E56E7811E38F33A00EFE334 /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 5E56E7801E38F33A00EFE334 /* GameScene.sks */; };
5E56E7831E38F33A00EFE334 /* Actions.sks in Resources */ = {isa = PBXBuildFile; fileRef = 5E56E7821E38F33A00EFE334 /* Actions.sks */; };
5E56E7851E38F33A00EFE334 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E56E7841E38F33A00EFE334 /* GameScene.swift */; };
5E56E7871E38F33B00EFE334 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E56E7861E38F33B00EFE334 /* GameViewController.swift */; };
5E56E78A1E38F33B00EFE334 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E56E7881E38F33B00EFE334 /* Main.storyboard */; };
5E56E78C1E38F33B00EFE334 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E56E78B1E38F33B00EFE334 /* Assets.xcassets */; };
5E56E78F1E38F33B00EFE334 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E56E78D1E38F33B00EFE334 /* LaunchScreen.storyboard */; };
5E56E7971E38F35100EFE334 /* Sketch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E56E7961E38F35100EFE334 /* Sketch.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
5E56E77B1E38F33A00EFE334 /* sketch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sketch.app; sourceTree = BUILT_PRODUCTS_DIR; };
5E56E77E1E38F33A00EFE334 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5E56E7801E38F33A00EFE334 /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = "<group>"; };
5E56E7821E38F33A00EFE334 /* Actions.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = Actions.sks; sourceTree = "<group>"; };
5E56E7841E38F33A00EFE334 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = "<group>"; };
5E56E7861E38F33B00EFE334 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = "<group>"; };
5E56E7891E38F33B00EFE334 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5E56E78B1E38F33B00EFE334 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5E56E78E1E38F33B00EFE334 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5E56E7901E38F33B00EFE334 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5E56E7961E38F35100EFE334 /* Sketch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sketch.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
5E56E7781E38F33A00EFE334 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
5E56E7721E38F33A00EFE334 = {
isa = PBXGroup;
children = (
5E56E77D1E38F33A00EFE334 /* sketch */,
5E56E77C1E38F33A00EFE334 /* Products */,
);
sourceTree = "<group>";
};
5E56E77C1E38F33A00EFE334 /* Products */ = {
isa = PBXGroup;
children = (
5E56E77B1E38F33A00EFE334 /* sketch.app */,
);
name = Products;
sourceTree = "<group>";
};
5E56E77D1E38F33A00EFE334 /* sketch */ = {
isa = PBXGroup;
children = (
5E56E77E1E38F33A00EFE334 /* AppDelegate.swift */,
5E56E7801E38F33A00EFE334 /* GameScene.sks */,
5E56E7821E38F33A00EFE334 /* Actions.sks */,
5E56E7841E38F33A00EFE334 /* GameScene.swift */,
5E56E7861E38F33B00EFE334 /* GameViewController.swift */,
5E56E7961E38F35100EFE334 /* Sketch.swift */,
5E56E7881E38F33B00EFE334 /* Main.storyboard */,
5E56E78B1E38F33B00EFE334 /* Assets.xcassets */,
5E56E78D1E38F33B00EFE334 /* LaunchScreen.storyboard */,
5E56E7901E38F33B00EFE334 /* Info.plist */,
);
path = sketch;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
5E56E77A1E38F33A00EFE334 /* sketch */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5E56E7931E38F33B00EFE334 /* Build configuration list for PBXNativeTarget "sketch" */;
buildPhases = (
5E56E7771E38F33A00EFE334 /* Sources */,
5E56E7781E38F33A00EFE334 /* Frameworks */,
5E56E7791E38F33A00EFE334 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = sketch;
productName = sketch;
productReference = 5E56E77B1E38F33A00EFE334 /* sketch.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
5E56E7731E38F33A00EFE334 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = "George Lim";
TargetAttributes = {
5E56E77A1E38F33A00EFE334 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 84GR68BEJA;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 5E56E7761E38F33A00EFE334 /* Build configuration list for PBXProject "sketch" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5E56E7721E38F33A00EFE334;
productRefGroup = 5E56E77C1E38F33A00EFE334 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5E56E77A1E38F33A00EFE334 /* sketch */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
5E56E7791E38F33A00EFE334 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E56E78A1E38F33B00EFE334 /* Main.storyboard in Resources */,
5E56E7811E38F33A00EFE334 /* GameScene.sks in Resources */,
5E56E78C1E38F33B00EFE334 /* Assets.xcassets in Resources */,
5E56E78F1E38F33B00EFE334 /* LaunchScreen.storyboard in Resources */,
5E56E7831E38F33A00EFE334 /* Actions.sks in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
5E56E7771E38F33A00EFE334 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5E56E7851E38F33A00EFE334 /* GameScene.swift in Sources */,
5E56E7971E38F35100EFE334 /* Sketch.swift in Sources */,
5E56E7871E38F33B00EFE334 /* GameViewController.swift in Sources */,
5E56E77F1E38F33A00EFE334 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
5E56E7881E38F33B00EFE334 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
5E56E7891E38F33B00EFE334 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
5E56E78D1E38F33B00EFE334 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
5E56E78E1E38F33B00EFE334 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
5E56E7911E38F33B00EFE334 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
5E56E7921E38F33B00EFE334 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5E56E7941E38F33B00EFE334 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 84GR68BEJA;
INFOPLIST_FILE = sketch/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.georgelim.sketch;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
5E56E7951E38F33B00EFE334 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 84GR68BEJA;
INFOPLIST_FILE = sketch/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.georgelim.sketch;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
5E56E7761E38F33A00EFE334 /* Build configuration list for PBXProject "sketch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E56E7911E38F33B00EFE334 /* Debug */,
5E56E7921E38F33B00EFE334 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5E56E7931E38F33B00EFE334 /* Build configuration list for PBXNativeTarget "sketch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5E56E7941E38F33B00EFE334 /* Debug */,
5E56E7951E38F33B00EFE334 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5E56E7731E38F33A00EFE334 /* Project object */;
}
7 changes: 7 additions & 0 deletions sketch.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Loading

0 comments on commit aa70e4f

Please sign in to comment.