Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

Commit 81f1f75

Browse files
committed
Exposed segmentStyle to Objective C.
Added Objective C test View Controller to only test if public vars and methods are accessible and it compiles.
1 parent d65abde commit 81f1f75

5 files changed

Lines changed: 74 additions & 2 deletions

File tree

Demo/ScrollableSegmentedControlDemo/ScrollableSegmentedControlDemo.xcodeproj/project.pbxproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
CD8F9C721F8A74AF00BD826C /* ObjCTestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CD8F9C701F8A74AE00BD826C /* ObjCTestViewController.m */; };
1011
CD9A240B1DD5A64F00B580D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD9A240A1DD5A64F00B580D0 /* AppDelegate.swift */; };
1112
CD9A24101DD5A64F00B580D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD9A240E1DD5A64F00B580D0 /* Main.storyboard */; };
1213
CD9A24121DD5A64F00B580D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD9A24111DD5A64F00B580D0 /* Assets.xcassets */; };
@@ -55,6 +56,9 @@
5556
/* End PBXCopyFilesBuildPhase section */
5657

5758
/* Begin PBXFileReference section */
59+
CD8F9C6B1F8A748C00BD826C /* ScrollableSegmentedControlDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ScrollableSegmentedControlDemo-Bridging-Header.h"; sourceTree = "<group>"; };
60+
CD8F9C701F8A74AE00BD826C /* ObjCTestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjCTestViewController.m; sourceTree = "<group>"; };
61+
CD8F9C711F8A74AF00BD826C /* ObjCTestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCTestViewController.h; sourceTree = "<group>"; };
5862
CD9A24071DD5A64F00B580D0 /* ScrollableSegmentedControlDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScrollableSegmentedControlDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
5963
CD9A240A1DD5A64F00B580D0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6064
CD9A240F1DD5A64F00B580D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -103,6 +107,9 @@
103107
CD9A24111DD5A64F00B580D0 /* Assets.xcassets */,
104108
CD9A24131DD5A64F00B580D0 /* LaunchScreen.storyboard */,
105109
CD9A24161DD5A64F00B580D0 /* Info.plist */,
110+
CD8F9C6B1F8A748C00BD826C /* ScrollableSegmentedControlDemo-Bridging-Header.h */,
111+
CD8F9C711F8A74AF00BD826C /* ObjCTestViewController.h */,
112+
CD8F9C701F8A74AE00BD826C /* ObjCTestViewController.m */,
106113
);
107114
path = ScrollableSegmentedControlDemo;
108115
sourceTree = "<group>";
@@ -214,6 +221,7 @@
214221
isa = PBXSourcesBuildPhase;
215222
buildActionMask = 2147483647;
216223
files = (
224+
CD8F9C721F8A74AF00BD826C /* ObjCTestViewController.m in Sources */,
217225
CDDF9BD21DD5A7D4000B09AF /* TableViewController.swift in Sources */,
218226
CD9A240B1DD5A64F00B580D0 /* AppDelegate.swift in Sources */,
219227
);
@@ -359,10 +367,13 @@
359367
buildSettings = {
360368
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
361369
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370+
CLANG_ENABLE_MODULES = YES;
362371
INFOPLIST_FILE = ScrollableSegmentedControlDemo/Info.plist;
363372
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
364373
PRODUCT_BUNDLE_IDENTIFIER = au.com.pomarium.ScrollableSegmentedControlDemo;
365374
PRODUCT_NAME = "$(TARGET_NAME)";
375+
SWIFT_OBJC_BRIDGING_HEADER = "ScrollableSegmentedControlDemo/ScrollableSegmentedControlDemo-Bridging-Header.h";
376+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
366377
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
367378
SWIFT_VERSION = 4.0;
368379
};
@@ -373,10 +384,12 @@
373384
buildSettings = {
374385
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
375386
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
387+
CLANG_ENABLE_MODULES = YES;
376388
INFOPLIST_FILE = ScrollableSegmentedControlDemo/Info.plist;
377389
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
378390
PRODUCT_BUNDLE_IDENTIFIER = au.com.pomarium.ScrollableSegmentedControlDemo;
379391
PRODUCT_NAME = "$(TARGET_NAME)";
392+
SWIFT_OBJC_BRIDGING_HEADER = "ScrollableSegmentedControlDemo/ScrollableSegmentedControlDemo-Bridging-Header.h";
380393
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
381394
SWIFT_VERSION = 4.0;
382395
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// ObjCTestViewController.h
3+
// ScrollableSegmentedControlDemo
4+
//
5+
// Created by Goce Petrovski on 8/10/17.
6+
// Copyright © 2017 Pomarium. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface ObjCTestViewController : UIViewController
12+
13+
@end
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// ObjCTestViewController.m
3+
// ScrollableSegmentedControlDemo
4+
//
5+
// Created by Goce Petrovski on 8/10/17.
6+
// Copyright © 2017 Pomarium. All rights reserved.
7+
//
8+
9+
#import "ObjCTestViewController.h"
10+
@import ScrollableSegmentedControl;
11+
12+
@interface ObjCTestViewController ()
13+
14+
@end
15+
16+
@implementation ObjCTestViewController
17+
18+
- (void)viewDidLoad {
19+
[super viewDidLoad];
20+
21+
ScrollableSegmentedControl *segmentedControl = [[ScrollableSegmentedControl alloc] init];
22+
segmentedControl.selectedSegmentIndex = 0;
23+
segmentedControl.segmentStyle = ScrollableSegmentedControlSegmentStyleTextOnly;
24+
}
25+
26+
- (void)didReceiveMemoryWarning {
27+
[super didReceiveMemoryWarning];
28+
// Dispose of any resources that can be recreated.
29+
}
30+
31+
/*
32+
#pragma mark - Navigation
33+
34+
// In a storyboard-based application, you will often want to do a little preparation before navigation
35+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
36+
// Get the new view controller using [segue destinationViewController].
37+
// Pass the selected object to the new view controller.
38+
}
39+
*/
40+
41+
@end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+

ScrollableSegmentedControl/ScrollableSegmentedControl.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
import UIKit
1010

11-
public enum ScrollableSegmentedControlSegmentStyle {
11+
@objc
12+
public enum ScrollableSegmentedControlSegmentStyle: Int {
1213
case textOnly, imageOnly, imageOnTop, imageOnLeft
1314
}
1415

@@ -23,7 +24,7 @@ public enum ScrollableSegmentedControlSegmentStyle {
2324
private var segmentsData = [SegmentData]()
2425
private var longestTextWidth:CGFloat = 10
2526

26-
public var segmentStyle:ScrollableSegmentedControlSegmentStyle = .textOnly {
27+
@objc public var segmentStyle:ScrollableSegmentedControlSegmentStyle = .textOnly {
2728
didSet {
2829
if oldValue != segmentStyle {
2930
switch segmentStyle {

0 commit comments

Comments
 (0)