Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
B4285D6A1E77D4830008466D /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4285D691E77D4830008466D /* ScratchCard.framework */; };
B4285D6B1E77D4830008466D /* ScratchCard.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B4285D691E77D4830008466D /* ScratchCard.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
94A8FA4C2B022E0100C776DA /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94A8FA4B2B022E0100C776DA /* ScratchCard.framework */; };
94A8FA4D2B022E0100C776DA /* ScratchCard.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 94A8FA4B2B022E0100C776DA /* ScratchCard.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B4389DAD1DFFF7B100B3DDE4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4389DAC1DFFF7B100B3DDE4 /* AppDelegate.swift */; };
B4389DAF1DFFF7B100B3DDE4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4389DAE1DFFF7B100B3DDE4 /* ViewController.swift */; };
B4389DB21DFFF7B100B3DDE4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B4389DB01DFFF7B100B3DDE4 /* Main.storyboard */; };
Expand All @@ -30,21 +30,21 @@
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
B45007D01E07EFB000AB92E2 /* Embed Frameworks */ = {
94A8FA4E2B022E0100C776DA /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B4285D6B1E77D4830008466D /* ScratchCard.framework in Embed Frameworks */,
94A8FA4D2B022E0100C776DA /* ScratchCard.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
B4285D691E77D4830008466D /* ScratchCard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ScratchCard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
94A8FA4B2B022E0100C776DA /* ScratchCard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ScratchCard.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B4389DA91DFFF7B100B3DDE4 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
B4389DAC1DFFF7B100B3DDE4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B4389DAE1DFFF7B100B3DDE4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand All @@ -64,7 +64,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B4285D6A1E77D4830008466D /* ScratchCard.framework in Frameworks */,
94A8FA4C2B022E0100C776DA /* ScratchCard.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -78,13 +78,21 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
94A8FA4A2B022E0100C776DA /* Frameworks */ = {
isa = PBXGroup;
children = (
94A8FA4B2B022E0100C776DA /* ScratchCard.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
B4389DA01DFFF7B100B3DDE4 = {
isa = PBXGroup;
children = (
B4285D691E77D4830008466D /* ScratchCard.framework */,
B4389DAB1DFFF7B100B3DDE4 /* Example */,
B4389DC01DFFF7B100B3DDE4 /* ExampleTests */,
B4389DAA1DFFF7B100B3DDE4 /* Products */,
94A8FA4A2B022E0100C776DA /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -131,7 +139,7 @@
B4389DA51DFFF7B100B3DDE4 /* Sources */,
B4389DA61DFFF7B100B3DDE4 /* Frameworks */,
B4389DA71DFFF7B100B3DDE4 /* Resources */,
B45007D01E07EFB000AB92E2 /* Embed Frameworks */,
94A8FA4E2B022E0100C776DA /* Embed Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -190,6 +198,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -314,12 +323,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -357,10 +367,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -376,11 +387,11 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = Scratch.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -395,11 +406,11 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = Scratch.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -413,7 +424,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = joe.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Debug;
Expand All @@ -428,7 +439,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = joe.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Requirements
----------

- iOS 8.0+
- Xcode 8.0+ Swift 3
- iOS 12.0+
- Xcode 15.0+ Swift 5


## Installation
Expand Down
17 changes: 9 additions & 8 deletions ScratchCard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = B4FDC4B11CC0C1FB00D6B52C;
Expand Down Expand Up @@ -237,12 +238,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -282,11 +283,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -307,14 +308,14 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ScratchCard/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = joe.ScratchCard;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -331,13 +332,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = ScratchCard/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = joe.ScratchCard;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ScratchCard/ScratchUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ open class ScratchUIView: UIView, ScratchViewDelegate {
scratchView.delegate = self
self.addSubview(maskImage)
self.addSubview(scratchView)
self.bringSubview(toFront: scratchView)
self.bringSubviewToFront(scratchView)

}

Expand Down
4 changes: 2 additions & 2 deletions ScratchCard/ScratchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var scratchWidth: CGFloat!
var contentLayer: CALayer!
var maskLayer: CAShapeLayer!

internal protocol ScratchViewDelegate: class {
internal protocol ScratchViewDelegate: AnyObject {
func began(_ view: ScratchView)
func moved(_ view: ScratchView)
func ended(_ view: ScratchView)
Expand Down Expand Up @@ -179,7 +179,7 @@ open class ScratchView: UIView {
line.path = linePath.cgPath
line.opacity = 1
line.strokeColor = UIColor.white.cgColor
line.lineCap = "round"
line.lineCap = .init(rawValue: "round")
layer.addSublayer(line)
}

Expand Down