Skip to content

Commit

Permalink
Updated project for Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
akashgupta88 committed May 5, 2016
1 parent c9c7aa2 commit 0303025
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions AGSpriteButton/Classes/AGSpriteButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef NS_OPTIONS(NSInteger, AGButtonControlEvent)
AGButtonControlEventAllEvents //Convenience event for deletion of selector, block or action.
};

NS_ASSUME_NONNULL_BEGIN

@interface AGSpriteButton : SKSpriteNode

Expand All @@ -38,12 +39,12 @@ typedef NS_OPTIONS(NSInteger, AGButtonControlEvent)

//LABEL METHOD

-(void)setLabelWithText:(NSString*)text andFont:(UIFont*)font withColor:(SKColor*)fontColor;
-(void)setLabelWithText:(nullable NSString*)text andFont:(nullable UIFont*)font withColor:(nullable SKColor*)fontColor;


//TARGET HANDLER METHODS (Similar to UIButton)

-(void)addTarget:(id)target selector:(SEL)selector withObject:(id)object forControlEvent:(AGButtonControlEvent)controlEvent;
-(void)addTarget:(id)target selector:(SEL)selector withObject:(nullable id)object forControlEvent:(AGButtonControlEvent)controlEvent;

-(void)removeTarget:(id)target selector:(SEL)selector forControlEvent:(AGButtonControlEvent)controlEvent;

Expand Down Expand Up @@ -74,3 +75,5 @@ typedef NS_OPTIONS(NSInteger, AGButtonControlEvent)
-(void)transformForTouchUp;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion AGSpriteButton/SwiftScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SwiftScene: SKScene {

button.position = CGPoint(x: self.size.width / 2, y: self.size.height / 2)

button.addTarget(self, selector: "addSpaceship", withObject: nil, forControlEvent:AGButtonControlEvent.TouchUpInside)
button.addTarget(self, selector: #selector(SwiftScene.addSpaceship), withObject: nil, forControlEvent:AGButtonControlEvent.TouchUpInside)
button.setLabelWithText("Spaceship", andFont: nil, withColor: UIColor.blackColor())

addChild(button)
Expand Down

0 comments on commit 0303025

Please sign in to comment.