Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted SMPageControl to Swift #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions Example/SMPageControl-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

29 changes: 23 additions & 6 deletions Example/SMPageControl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
3D8496D2162A4849001ECE62 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3D8496D0162A4849001ECE62 /* [email protected] */; };
3D8496D3162A4849001ECE62 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3D8496D1162A4849001ECE62 /* [email protected] */; };
3D8496D7162A4911001ECE62 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3D8496D6162A4911001ECE62 /* [email protected] */; };
3D8496DE162A73A5001ECE62 /* SMPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D8496DD162A73A5001ECE62 /* SMPageControl.m */; };
3D9CDA921629EA9100B95512 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9CDA911629EA9100B95512 /* UIKit.framework */; };
3D9CDA941629EA9100B95512 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9CDA931629EA9100B95512 /* Foundation.framework */; };
3D9CDA961629EA9100B95512 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9CDA951629EA9100B95512 /* CoreGraphics.framework */; };
Expand All @@ -31,6 +30,7 @@
3D9CDAAB1629EA9100B95512 /* SMViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CDAAA1629EA9100B95512 /* SMViewController.m */; };
3D9CDAAE1629EA9100B95512 /* SMViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D9CDAAC1629EA9100B95512 /* SMViewController_iPhone.xib */; };
3D9CDAB11629EA9100B95512 /* SMViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D9CDAAF1629EA9100B95512 /* SMViewController_iPad.xib */; };
4E84A19222D20A8F00008376 /* SMPageControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E84A19122D20A8F00008376 /* SMPageControl.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -45,8 +45,6 @@
3D8496D0162A4849001ECE62 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
3D8496D1162A4849001ECE62 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
3D8496D6162A4911001ECE62 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
3D8496DC162A73A5001ECE62 /* SMPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMPageControl.h; path = ../../SMPageControl.h; sourceTree = "<group>"; };
3D8496DD162A73A5001ECE62 /* SMPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SMPageControl.m; path = ../../SMPageControl.m; sourceTree = "<group>"; };
3D9CDA8D1629EA9100B95512 /* SMPageControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SMPageControl.app; sourceTree = BUILT_PRODUCTS_DIR; };
3D9CDA911629EA9100B95512 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
3D9CDA931629EA9100B95512 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand All @@ -64,6 +62,8 @@
3D9CDAAA1629EA9100B95512 /* SMViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SMViewController.m; sourceTree = "<group>"; };
3D9CDAAD1629EA9100B95512 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SMViewController_iPhone.xib; sourceTree = "<group>"; };
3D9CDAB01629EA9100B95512 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SMViewController_iPad.xib; sourceTree = "<group>"; };
4E84A19022D20A8F00008376 /* SMPageControl-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SMPageControl-Bridging-Header.h"; sourceTree = "<group>"; };
4E84A19122D20A8F00008376 /* SMPageControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SMPageControl.swift; path = ../SMPageControl.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -84,8 +84,10 @@
isa = PBXGroup;
children = (
3D9CDA971629EA9100B95512 /* SMPageControl */,
4E84A19122D20A8F00008376 /* SMPageControl.swift */,
3D9CDA901629EA9100B95512 /* Frameworks */,
3D9CDA8E1629EA9100B95512 /* Products */,
4E84A19022D20A8F00008376 /* SMPageControl-Bridging-Header.h */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -117,8 +119,6 @@
3D9CDAAC1629EA9100B95512 /* SMViewController_iPhone.xib */,
3D9CDAAF1629EA9100B95512 /* SMViewController_iPad.xib */,
3D9CDA981629EA9100B95512 /* Supporting Files */,
3D8496DC162A73A5001ECE62 /* SMPageControl.h */,
3D8496DD162A73A5001ECE62 /* SMPageControl.m */,
);
path = SMPageControl;
sourceTree = "<group>";
Expand Down Expand Up @@ -177,12 +177,18 @@
CLASSPREFIX = SM;
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Spaceman Labs";
TargetAttributes = {
3D9CDA8C1629EA9100B95512 = {
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 3D9CDA871629EA9100B95512 /* Build configuration list for PBXProject "SMPageControl" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 3D9CDA821629EA9100B95512;
Expand Down Expand Up @@ -227,10 +233,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4E84A19222D20A8F00008376 /* SMPageControl.swift in Sources */,
3D9CDA9E1629EA9100B95512 /* main.m in Sources */,
3D9CDAA21629EA9100B95512 /* SMAppDelegate.m in Sources */,
3D9CDAAB1629EA9100B95512 /* SMViewController.m in Sources */,
3D8496DE162A73A5001ECE62 /* SMPageControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -319,21 +325,32 @@
3D9CDAB51629EA9100B95512 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SMPageControl/SMPageControl-Prefix.pch";
INFOPLIST_FILE = "SMPageControl/SMPageControl-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SMPageControl-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
3D9CDAB61629EA9100B95512 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SMPageControl/SMPageControl-Prefix.pch";
INFOPLIST_FILE = "SMPageControl/SMPageControl-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SMPageControl-Bridging-Header.h";
SWIFT_VERSION = 5.0;
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
9 changes: 0 additions & 9 deletions Example/SMPageControl/SMViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@
//

#import <UIKit/UIKit.h>
#import "SMPageControl.h"

@interface SMViewController : UIViewController

@property (nonatomic, weak) IBOutlet UIPageControl *pageControl;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl1;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl2;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl3;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl4;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl5;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl6;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl7;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl8;

@end
18 changes: 14 additions & 4 deletions Example/SMPageControl/SMViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
//

#import "SMViewController.h"
#import "SMPageControl-Swift.h"

@interface SMViewController ()

@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl1;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl2;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl3;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl4;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl5;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl6;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl7;
@property (nonatomic, weak) IBOutlet SMPageControl *spacePageControl8;

@end

@implementation SMViewController
Expand All @@ -34,8 +44,8 @@ - (void)viewDidLoad
self.spacePageControl2.indicatorMargin = 20.0f;
self.spacePageControl2.indicatorDiameter = 10.0f;

self.spacePageControl3.alignment = SMPageControlAlignmentLeft;
self.spacePageControl4.alignment = SMPageControlAlignmentRight;
self.spacePageControl3.alignment = SMPageControlHorizontalAlignmentLeft;
self.spacePageControl4.alignment = SMPageControlHorizontalAlignmentRight;

[self.spacePageControl5 setPageIndicatorImage:[UIImage imageNamed:@"pageDot"]];
[self.spacePageControl5 setCurrentPageIndicatorImage:[UIImage imageNamed:@"currentPageDot"]];
Expand Down Expand Up @@ -73,12 +83,12 @@ - (void)viewDidLoad

- (void)pageControl:(id)sender
{
NSLog(@"Current Page (UIPageControl) : %i", self.pageControl.currentPage);
NSLog(@"Current Page (UIPageControl) : %li", (long)self.pageControl.currentPage);
}

- (void)spacePageControl:(SMPageControl *)sender
{
NSLog(@"Current Page (SMPageControl): %i", sender.currentPage);
NSLog(@"Current Page (SMPageControl): %li", (long)sender.currentPage);
}

@end
Loading