Skip to content

Commit

Permalink
update to 1.0.7; code style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeJoe authored and JoeJoe committed Dec 14, 2016
1 parent 5354087 commit 1831d8a
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 124 deletions.
18 changes: 10 additions & 8 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
B4389DC21DFFF7B100B3DDE4 /* ExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4389DC11DFFF7B100B3DDE4 /* ExampleTests.swift */; };
B4389DDB1DFFFC4C00B3DDE4 /* image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = B4389DD91DFFFC4C00B3DDE4 /* image.jpg */; };
B4389DDC1DFFFC4C00B3DDE4 /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = B4389DDA1DFFFC4C00B3DDE4 /* mask.png */; };
B4389DDE1DFFFD2300B3DDE4 /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4389DDD1DFFFD2300B3DDE4 /* ScratchCard.framework */; };
B4389DDF1DFFFD2A00B3DDE4 /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4389DDD1DFFFD2300B3DDE4 /* ScratchCard.framework */; };
B4389DE01DFFFD2A00B3DDE4 /* ScratchCard.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B4389DDD1DFFFD2300B3DDE4 /* ScratchCard.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B4A76CD91E01D9DD00A9D705 /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4A76CD81E01D9DD00A9D705 /* ScratchCard.framework */; };
B4A76CDA1E01D9E400A9D705 /* ScratchCard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4A76CD81E01D9DD00A9D705 /* ScratchCard.framework */; };
B4A76CDB1E01D9E400A9D705 /* ScratchCard.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B4A76CD81E01D9DD00A9D705 /* ScratchCard.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -37,7 +37,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
B4389DE01DFFFD2A00B3DDE4 /* ScratchCard.framework in Embed Frameworks */,
B4A76CDB1E01D9E400A9D705 /* ScratchCard.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -57,16 +57,16 @@
B4389DC31DFFF7B100B3DDE4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B4389DD91DFFFC4C00B3DDE4 /* image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image.jpg; sourceTree = "<group>"; };
B4389DDA1DFFFC4C00B3DDE4 /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; };
B4389DDD1DFFFD2300B3DDE4 /* ScratchCard.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ScratchCard.framework; sourceTree = "<group>"; };
B4A76CD81E01D9DD00A9D705 /* ScratchCard.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ScratchCard.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
B4389DA61DFFF7B100B3DDE4 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B4389DDE1DFFFD2300B3DDE4 /* ScratchCard.framework in Frameworks */,
B4389DDF1DFFFD2A00B3DDE4 /* ScratchCard.framework in Frameworks */,
B4A76CD91E01D9DD00A9D705 /* ScratchCard.framework in Frameworks */,
B4A76CDA1E01D9E400A9D705 /* ScratchCard.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -83,7 +83,7 @@
B4389DA01DFFF7B100B3DDE4 = {
isa = PBXGroup;
children = (
B4389DDD1DFFFD2300B3DDE4 /* ScratchCard.framework */,
B4A76CD81E01D9DD00A9D705 /* ScratchCard.framework */,
B4389DAB1DFFF7B100B3DDE4 /* Example */,
B4389DC01DFFF7B100B3DDE4 /* ExampleTests */,
B4389DAA1DFFF7B100B3DDE4 /* Products */,
Expand Down Expand Up @@ -450,6 +450,7 @@
B4389DC81DFFF7B100B3DDE4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B4389DC91DFFF7B100B3DDE4 /* Build configuration list for PBXNativeTarget "ExampleTests" */ = {
isa = XCConfigurationList;
Expand All @@ -458,6 +459,7 @@
B4389DCB1DFFF7B100B3DDE4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
12 changes: 5 additions & 7 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import ScratchCard

class ViewController: UIViewController {

var ScratchCard: ScratchUIView!
var scratchCard: ScratchUIView!
@IBOutlet weak var textField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

ScratchCard = ScratchUIView(frame: CGRect(x:50, y:80, width:320, height:480),Coupon: "image", MaskImage: "mask", ScratchWidth: CGFloat(40))
self.view.addSubview(ScratchCard)
scratchCard = ScratchUIView(frame: CGRect(x:50, y:80, width:320, height:480), Coupon: "image", MaskImage: "mask", ScratchWidth: CGFloat(40))
self.view.addSubview(scratchCard)

}

Expand All @@ -29,9 +29,7 @@ class ViewController: UIViewController {

@IBAction func getScratchPercent(_ sender: Any) {

let scratch_percent:Double = ScratchCard.getScratchPercent()
textField.text = String(format: "%.2f", scratch_percent*100) + "%"
let scratchPercent: Double = scratchCard.getScratchPercent()
textField.text = String(format: "%.2f", scratchPercent * 100) + "%"
}

}

Binary file modified Example/ScratchCard.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Example/ScratchCard.framework/ScratchCard
Binary file not shown.
14 changes: 7 additions & 7 deletions Example/ScratchCard.framework/_CodeSignature/CodeResources
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
</data>
<key>Info.plist</key>
<data>
tCW8babf9drEXUV5HxUafZYEhLA=
G35d0gcP6MVwAUO73V41JcU+epU=
</data>
<key>Modules/ScratchCard.swiftmodule/arm.swiftdoc</key>
<data>
bq2UxZFoAMtuhV6SAclTBDH/vpM=
</data>
<key>Modules/ScratchCard.swiftmodule/arm.swiftmodule</key>
<data>
npKnl1GO+SimssEQjkeUxVaPjgA=
ht9aeX5pECmN609Ve3zrPaBPO94=
</data>
<key>Modules/ScratchCard.swiftmodule/arm64.swiftdoc</key>
<data>
8vU9dLeMTLwI9syRh4TFikrgIN8=
</data>
<key>Modules/ScratchCard.swiftmodule/arm64.swiftmodule</key>
<data>
/V0KoI6W9NJyCU//Ot0gv+HeE4s=
UwXUCltO0KkhqoNT/xVQ4oX3eLI=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down Expand Up @@ -76,11 +76,11 @@
<dict>
<key>hash</key>
<data>
npKnl1GO+SimssEQjkeUxVaPjgA=
ht9aeX5pECmN609Ve3zrPaBPO94=
</data>
<key>hash2</key>
<data>
WxusPPh5owSTbBCgDSlU/PBlx0yPTR/2C3HBHyM7Rig=
TcePJKeJRW9hQT77fGqEMNo8E3pnG03go8+SphBLluA=
</data>
</dict>
<key>Modules/ScratchCard.swiftmodule/arm64.swiftdoc</key>
Expand All @@ -98,11 +98,11 @@
<dict>
<key>hash</key>
<data>
/V0KoI6W9NJyCU//Ot0gv+HeE4s=
UwXUCltO0KkhqoNT/xVQ4oX3eLI=
</data>
<key>hash2</key>
<data>
AOpdfH31h+QzbfsX48QwiXY8XHxM1xF19SU4H27BS9g=
DG0ZQU7D95RIrFbC1f5+UE2ZdqZTDpaZ4GKVVstkbJM=
</data>
</dict>
<key>Modules/module.modulemap</key>
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requirements
----------

- iOS 8.0+
- Xcode 8.1+ Swift 3
- Xcode 8.0+ Swift 3


## Installation
Expand All @@ -20,7 +20,7 @@ To use ScratchCard in your project add the following 'Podfile' to your project
platform :ios, '8.0'
use_frameworks!

pod 'ScratchCard', '~> 1.0.6
pod 'ScratchCard', '~> 1.0.7

Then run:

Expand Down Expand Up @@ -48,13 +48,13 @@ Usage

class ViewController: UIViewController {

var ScratchCard: ScratchUIView!
var scratchCard: ScratchUIView!
override func viewDidLoad() {
super.viewDidLoad()

ScratchCard = ScratchUIView(frame: CGRect(x:50, y:80, width:320, height:480),Coupon: "image", MaskImage: "mask", ScratchWidth: CGFloat(40))
scratchCard = ScratchUIView(frame: CGRect(x:50, y:80, width:320, height:480),Coupon: "image", MaskImage: "mask", ScratchWidth: CGFloat(40))

self.view.addSubview(ScratchCard)
self.view.addSubview(scratchCard)
}
}
```
Expand All @@ -66,7 +66,7 @@ It is easy to get the scratched percent.

* Sample:
```swift
let scratch_percent:Double = ScratchCard.getScratchPercent()
let scratchPercent: Double = scratchCard.getScratchPercent()
```

##License
Expand Down
2 changes: 1 addition & 1 deletion ScratchCard.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ScratchCard"
s.version = "1.0.6"
s.version = "1.0.7"
s.license = "MIT"
s.summary = "A ScratchCard view on iOS(swift)."
s.homepage = "https://github.com/joehour/ScratchCard"
Expand Down
9 changes: 8 additions & 1 deletion ScratchCard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
B4FDC4B21CC0C1FB00D6B52C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = JoeJoe;
TargetAttributes = {
B4FDC4BA1CC0C1FB00D6B52C = {
Expand Down Expand Up @@ -210,8 +210,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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";
Expand Down Expand Up @@ -259,8 +261,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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";
Expand All @@ -280,6 +284,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = "";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -293,6 +298,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -314,6 +320,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion ScratchCard/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
<string>1.0.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
37 changes: 16 additions & 21 deletions ScratchCard/ScratchUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,48 @@
import Foundation
import UIKit


var CouponImage: UIImageView!
var ScratchCard: ScratchView!
var couponImage: UIImageView!
var scratchCard: ScratchView!
var coupon: String!
var mask_image: String!
var scratch_width: CGFloat!
var uiScratchWidth: CGFloat!

open class ScratchUIView: UIView {

@IBOutlet fileprivate var contentView:UIView?
@IBOutlet fileprivate var contentView: UIView?

override init(frame: CGRect) {
super.init(frame: frame)
self.Init()
}

open func getScratchPercent()->Double{
return ScratchCard.getAlphaPixelPercent()
open func getScratchPercent() -> Double {
return scratchCard.getAlphaPixelPercent()
}

public init(frame: CGRect, Coupon: String, MaskImage: String, ScratchWidth:CGFloat) {
public init(frame: CGRect, Coupon: String, MaskImage: String, ScratchWidth: CGFloat) {
super.init(frame: frame)
coupon = Coupon
mask_image = MaskImage
scratch_width = ScratchWidth
maskImage = MaskImage
uiScratchWidth = ScratchWidth
self.Init()
}


required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.InitXib()
}

fileprivate func Init() {

CouponImage = UIImageView(image:UIImage(named:coupon))
ScratchCard = ScratchView(frame: self.frame, MaskImage: mask_image, ScratchWidth: scratch_width)
CouponImage.frame = CGRect(x: 0,y: 0, width: self.frame.width, height: self.frame.height)
ScratchCard.frame = CGRect(x: 0,y: 0,width: self.frame.width, height: self.frame.height)
self.addSubview(CouponImage)
self.addSubview(ScratchCard)
self.bringSubview(toFront: ScratchCard)
couponImage = UIImageView(image:UIImage(named:coupon))
scratchCard = ScratchView(frame: self.frame, MaskImage: maskImage, ScratchWidth: uiScratchWidth)
couponImage.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
scratchCard.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height)
self.addSubview(couponImage)
self.addSubview(scratchCard)
self.bringSubview(toFront: scratchCard)
}

fileprivate func InitXib() {

}

}
Loading

0 comments on commit 1831d8a

Please sign in to comment.