Skip to content

Commit 53c4a0e

Browse files
committed
Updated podspec, README, example
1 parent f58fba2 commit 53c4a0e

File tree

7 files changed

+48
-50
lines changed

7 files changed

+48
-50
lines changed

BetterSegmentedControl.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = "BetterSegmentedControl"
3-
s.version = "0.8"
3+
s.version = "0.9"
44
s.summary = "An easy to use, customizable replacement for UISegmentedControl & UISwitch."
55
s.description = <<-DESC
66
BetterSegmentedControl is an easy to use, customizable replacement for UISegmentedControl and UISwitch written in Swift.
77
DESC
88
s.homepage = "https://github.com/gmarm/BetterSegmentedControl"
99
s.license = 'MIT'
1010
s.author = { "George Marmaridis" => "[email protected]" }
11-
s.source = { :git => "https://github.com/gmarm/BetterSegmentedControl.git", :tag => "0.8" }
11+
s.source = { :git => "https://github.com/gmarm/BetterSegmentedControl.git", :tag => "0.9" }
1212
s.social_media_url = 'https://twitter.com/gmarmas'
1313
s.platform = :ios, '8.0'
1414
s.requires_arc = true

Example/BetterSegmentedControl.xcodeproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
isa = PBXProject;
217217
attributes = {
218218
LastSwiftUpdateCheck = 0720;
219-
LastUpgradeCheck = 0820;
219+
LastUpgradeCheck = 0900;
220220
ORGANIZATIONNAME = CocoaPods;
221221
TargetAttributes = {
222222
607FACCF1AFB9204008FA782 = {
@@ -436,14 +436,20 @@
436436
CLANG_CXX_LIBRARY = "libc++";
437437
CLANG_ENABLE_MODULES = YES;
438438
CLANG_ENABLE_OBJC_ARC = YES;
439+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
439440
CLANG_WARN_BOOL_CONVERSION = YES;
441+
CLANG_WARN_COMMA = YES;
440442
CLANG_WARN_CONSTANT_CONVERSION = YES;
441443
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
442444
CLANG_WARN_EMPTY_BODY = YES;
443445
CLANG_WARN_ENUM_CONVERSION = YES;
444446
CLANG_WARN_INFINITE_RECURSION = YES;
445447
CLANG_WARN_INT_CONVERSION = YES;
448+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
449+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
446450
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
451+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
452+
CLANG_WARN_STRICT_PROTOTYPES = YES;
447453
CLANG_WARN_SUSPICIOUS_MOVE = YES;
448454
CLANG_WARN_UNREACHABLE_CODE = YES;
449455
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -483,14 +489,20 @@
483489
CLANG_CXX_LIBRARY = "libc++";
484490
CLANG_ENABLE_MODULES = YES;
485491
CLANG_ENABLE_OBJC_ARC = YES;
492+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
486493
CLANG_WARN_BOOL_CONVERSION = YES;
494+
CLANG_WARN_COMMA = YES;
487495
CLANG_WARN_CONSTANT_CONVERSION = YES;
488496
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
489497
CLANG_WARN_EMPTY_BODY = YES;
490498
CLANG_WARN_ENUM_CONVERSION = YES;
491499
CLANG_WARN_INFINITE_RECURSION = YES;
492500
CLANG_WARN_INT_CONVERSION = YES;
501+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
502+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
493503
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
504+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
505+
CLANG_WARN_STRICT_PROTOTYPES = YES;
494506
CLANG_WARN_SUSPICIOUS_MOVE = YES;
495507
CLANG_WARN_UNREACHABLE_CODE = YES;
496508
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

Example/BetterSegmentedControl/AppDelegate.swift

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

16-
1716
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1817
// Override point for customization after application launch.
1918
return true
2019
}
21-
22-
func applicationWillResignActive(_ application: UIApplication) {
23-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24-
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25-
}
26-
27-
func applicationDidEnterBackground(_ application: UIApplication) {
28-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29-
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30-
}
31-
32-
func applicationWillEnterForeground(_ application: UIApplication) {
33-
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34-
}
35-
36-
func applicationDidBecomeActive(_ application: UIApplication) {
37-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38-
}
39-
40-
func applicationWillTerminate(_ application: UIApplication) {
41-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42-
}
43-
44-
4520
}
46-

Example/BetterSegmentedControl/Base.lproj/Main.storyboard

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="oBL-AA-ynO">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="oBL-AA-ynO">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
99
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>
@@ -126,7 +126,7 @@
126126
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="oBL-AA-ynO" sceneMemberID="viewController">
127127
<toolbarItems/>
128128
<navigationBar key="navigationBar" contentMode="scaleToFill" id="dU3-Cw-iOr">
129-
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
129+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
130130
<autoresizingMask key="autoresizingMask"/>
131131
</navigationBar>
132132
<nil name="viewControllers"/>

Example/BetterSegmentedControl/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ViewController: UIViewController {
5858

5959
// Control 4: Added as a subview
6060
let viewSegmentedControl = BetterSegmentedControl(
61-
frame: CGRect(x: 0.0, y: 302.0, width: view.bounds.width, height: 50.0),
61+
frame: CGRect(x: 0.0, y: 332.0, width: view.bounds.width, height: 50.0),
6262
titles: ["Artists", "Albums"],
6363
index: 1,
6464
options: [.backgroundColor(UIColor(red:0.11, green:0.12, blue:0.13, alpha:1.00)),
@@ -74,7 +74,7 @@ class ViewController: UIViewController {
7474

7575
// Control 5: Adding custom subview to Indicator
7676
let indicatorControl = BetterSegmentedControl(
77-
frame: CGRect(x: 0.0, y: 375.0, width: view.bounds.width, height: 50.0),
77+
frame: CGRect(x: 0.0, y: 405.0, width: view.bounds.width, height: 50.0),
7878
titles: ["Hello", "Goodbye"],
7979
index: 0, options: [.backgroundColor(.lightGray),
8080
.titleColor(.white),

Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BetterSegmentedControl.xcscheme

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BetterSegmentedControl
22

3-
![](https://img.shields.io/badge/Swift-3.0-blue.svg?style=flat)
3+
![](https://img.shields.io/badge/Swift-4.0-blue.svg?style=flat)
44
[![Version](https://img.shields.io/cocoapods/v/BetterSegmentedControl.svg?style=flat)](http://cocoapods.org/pods/BetterSegmentedControl)
55
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
66
[![License](https://img.shields.io/cocoapods/l/BetterSegmentedControl.svg?style=flat)](http://cocoapods.org/pods/BetterSegmentedControl)
@@ -30,9 +30,14 @@ BetterSegmentedControl is an easy to use, customizable replacement for UISegment
3030
BetterSegmentedControl is available through [CocoaPods](http://cocoapods.org). To install
3131
it, simply add the following line to your Podfile:
3232

33+
_Swift 4.0_
34+
```ruby
35+
pod 'BetterSegmentedControl', '~> 0.9'
36+
```
37+
3338
_Swift 3.0_
3439
```ruby
35-
pod 'BetterSegmentedControl', '~> 0.8'
40+
pod 'BetterSegmentedControl', '0.8'
3641
```
3742

3843
_Swift 2.x_
@@ -44,9 +49,14 @@ pod 'BetterSegmentedControl', '0.4'
4449

4550
If you prefer using [Carthage](https://github.com/Carthage/Carthage), simply add BetterSegmentedControl to your `Cartfile`:
4651

52+
_Swift 4.0_
53+
```ruby
54+
github "gmarm/BetterSegmentedControl" ~> 0.9
55+
```
56+
4757
_Swift 3.0_
4858
```ruby
49-
github "gmarm/BetterSegmentedControl" ~> 0.8
59+
github "gmarm/BetterSegmentedControl" 0.8
5060
```
5161

5262
_Swift 2.x_
@@ -65,24 +75,24 @@ let control = BetterSegmentedControl(
6575
frame: CGRect(x: 0.0, y: 100.0, width: view.bounds.width, height: 44.0),
6676
titles: ["One", "Two", "Three"],
6777
index: 1,
68-
backgroundColor: UIColor(red:0.11, green:0.12, blue:0.13, alpha:1.00),
69-
titleColor: .white,
70-
indicatorViewBackgroundColor: UIColor(red:0.55, green:0.26, blue:0.86, alpha:1.00),
71-
selectedTitleColor: .black)
72-
control.titleFont = UIFont(name: "HelveticaNeue", size: 14.0)!
73-
control.selectedTitleFont = UIFont(name: "HelveticaNeue-Medium", size: 14.0)!
78+
options: [.backgroundColor(UIColor(red:0.11, green:0.12, blue:0.13, alpha:1.00)),
79+
.titleColor(.white),
80+
.indicatorViewBackgroundColor(UIColor(red:0.55, green:0.26, blue:0.86, alpha:1.00)),
81+
.selectedTitleColor(.black),
82+
.titleFont(UIFont(name: "HelveticaNeue", size: 14.0)!),
83+
.selectedTitleFont(UIFont(name: "HelveticaNeue-Medium", size: 14.0)!)]
84+
)
7485
control.addTarget(self, action: #selector(ViewController.controlValueChanged(_:)), for: .valueChanged)
7586
view.addSubview(control)
7687
```
7788
You can find different ways of using it (such as by designing it in a Storyboard file) in the example project. To run the example project, clone the repo, and run `pod install` from the Example directory first.
7889

7990
## Todos
8091

81-
- [ ] Make initializer throwing if not enough titles are passed.
82-
- [ ] Set titles via method that throws.
92+
- [ ] Get rid of error unnecessary handling.
93+
- [ ] Add snapshot tests.
8394
- [ ] Allow the control to have no selected index.
8495
- [ ] Allow UIViews that implement a protocol to be used as options.
85-
- [ ] Add moar tests!
8696
- [ ] ~~Try to take over the world!~~ Uh, what?
8797

8898
## Contribution

0 commit comments

Comments
 (0)