Compare commits

..

No commits in common. "master" and "2.0" have entirely different histories.
master ... 2.0

17 changed files with 280 additions and 367 deletions

View File

@ -30,13 +30,13 @@
### Your Environment ### Your Environment
- Version of the component: _insert here_ - [ ] Version of the component: _insert here_
- Swift version: _insert here_ - [ ] Swift version: _insert here_
- iOS version: _insert here_ - [ ] iOS version: _insert here_
- Device: _insert here_ - [ ] Device: _insert here_
- Xcode version: _insert here_ - [ ] Xcode version: _insert here_
- If you use Cocoapods: _run `pod env | pbcopy` and insert here_ - [ ] If you use Cocoapods: _run `pod env | pbcopy` and insert here_
- If you use Carthage: _run `carthage version | pbcopy` and insert here_ - [ ] If you use Carthage: _run `carthage version | pbcopy` and insert here_
### Project that demonstrates the bug ### Project that demonstrates the bug

View File

@ -24,7 +24,6 @@
327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CB1D1ABEC100534355 /* HomeViewController.swift */; }; 327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CB1D1ABEC100534355 /* HomeViewController.swift */; };
327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CC1D1ABEC100534355 /* SideMenuViewController.swift */; }; 327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CC1D1ABEC100534355 /* SideMenuViewController.swift */; };
327AF6041D1AC0FE00534355 /* ColorPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF6031D1AC0FE00534355 /* ColorPalette.swift */; }; 327AF6041D1AC0FE00534355 /* ColorPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF6031D1AC0FE00534355 /* ColorPalette.swift */; };
32C3706C1DD9C4FA001A39CB /* SegmentioBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C3706B1DD9C4FA001A39CB /* SegmentioBuilder.swift */; };
5B9491B14F42A77448746E9B /* Pods_Segmentio_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74E8553D39ECFE4883F1D2CA /* Pods_Segmentio_Example.framework */; }; 5B9491B14F42A77448746E9B /* Pods_Segmentio_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74E8553D39ECFE4883F1D2CA /* Pods_Segmentio_Example.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -50,7 +49,6 @@
327AF5CB1D1ABEC100534355 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; }; 327AF5CB1D1ABEC100534355 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
327AF5CC1D1ABEC100534355 /* SideMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideMenuViewController.swift; sourceTree = "<group>"; }; 327AF5CC1D1ABEC100534355 /* SideMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideMenuViewController.swift; sourceTree = "<group>"; };
327AF6031D1AC0FE00534355 /* ColorPalette.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorPalette.swift; sourceTree = "<group>"; }; 327AF6031D1AC0FE00534355 /* ColorPalette.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorPalette.swift; sourceTree = "<group>"; };
32C3706B1DD9C4FA001A39CB /* SegmentioBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegmentioBuilder.swift; sourceTree = "<group>"; };
32C3A9241D2BB3B5004C0FC9 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; 32C3A9241D2BB3B5004C0FC9 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* Segmentio_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Segmentio_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD01AFB9204008FA782 /* Segmentio_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Segmentio_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -138,14 +136,6 @@
path = ViewControllers; path = ViewControllers;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
32C3706A1DD9C4EC001A39CB /* Builders */ = {
isa = PBXGroup;
children = (
32C3706B1DD9C4FA001A39CB /* SegmentioBuilder.swift */,
);
path = Builders;
sourceTree = "<group>";
};
45CA913E13914443DB2552B6 /* Pods */ = { 45CA913E13914443DB2552B6 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -179,7 +169,6 @@
607FACD21AFB9204008FA782 /* Example for Segmentio */ = { 607FACD21AFB9204008FA782 /* Example for Segmentio */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
32C3706A1DD9C4EC001A39CB /* Builders */,
327AF5A71D1ABEC100534355 /* Application */, 327AF5A71D1ABEC100534355 /* Application */,
327AF5A91D1ABEC100534355 /* Extensions */, 327AF5A91D1ABEC100534355 /* Extensions */,
327AF5AD1D1ABEC100534355 /* Helpers */, 327AF5AD1D1ABEC100534355 /* Helpers */,
@ -250,7 +239,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0720; LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0810; LastUpgradeCheck = 0720;
ORGANIZATIONNAME = CocoaPods; ORGANIZATIONNAME = CocoaPods;
TargetAttributes = { TargetAttributes = {
607FACCF1AFB9204008FA782 = { 607FACCF1AFB9204008FA782 = {
@ -348,7 +337,6 @@
327AF5CF1D1ABEC100534355 /* AppDelegate.swift in Sources */, 327AF5CF1D1ABEC100534355 /* AppDelegate.swift in Sources */,
327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */, 327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */,
327AF5E81D1ABEC100534355 /* EmbedContainerViewController.swift in Sources */, 327AF5E81D1ABEC100534355 /* EmbedContainerViewController.swift in Sources */,
32C3706C1DD9C4FA001A39CB /* SegmentioBuilder.swift in Sources */,
327AF5D41D1ABEC100534355 /* Disaster.swift in Sources */, 327AF5D41D1ABEC100534355 /* Disaster.swift in Sources */,
327AF5D31D1ABEC100534355 /* AppearanceConfigurator.swift in Sources */, 327AF5D31D1ABEC100534355 /* AppearanceConfigurator.swift in Sources */,
327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */, 327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */,
@ -377,10 +365,8 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -424,10 +410,8 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -446,7 +430,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
name = Release; name = Release;
@ -455,7 +438,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 031FB43EDAB25B02B2FB7406 /* Pods-Segmentio_Example.debug.xcconfig */; baseConfigurationReference = 031FB43EDAB25B02B2FB7406 /* Pods-Segmentio_Example.debug.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -478,7 +460,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 1667ACAF5594F75E244C8E1B /* Pods-Segmentio_Example.release.xcconfig */; baseConfigurationReference = 1667ACAF5594F75E244C8E1B /* Pods-Segmentio_Example.release.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0810" LastUpgradeVersion = "0720"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

View File

@ -1,118 +0,0 @@
//
// SegmentioBuilder.swift
// Segmentio
//
// Created by Dmitriy Demchenko on 11/14/16.
// Copyright © 2016 CocoaPods. All rights reserved.
//
import Segmentio
import UIKit
struct SegmentioBuilder {
static func setupBadgeCountForIndex(_ segmentioView: Segmentio, index: Int) {
segmentioView.addBadge(
at: index,
count: 10,
color: ColorPalette.coral
)
}
static func buildSegmentioView(segmentioView: Segmentio, segmentioStyle: SegmentioStyle) {
segmentioView.setup(
content: segmentioContent(),
style: segmentioStyle,
options: segmentioOptions(segmentioStyle: segmentioStyle)
)
}
private static func segmentioContent() -> [SegmentioItem] {
return [
SegmentioItem(title: "Tornado", image: UIImage(named: "tornado")),
SegmentioItem(title: "Earthquakes", image: UIImage(named: "earthquakes")),
SegmentioItem(title: "Extreme heat", image: UIImage(named: "heat")),
SegmentioItem(title: "Eruption", image: UIImage(named: "eruption")),
SegmentioItem(title: "Floods", image: UIImage(named: "floods")),
SegmentioItem(title: "Wildfires", image: UIImage(named: "wildfires"))
]
}
private static func segmentioOptions(segmentioStyle: SegmentioStyle) -> SegmentioOptions {
var imageContentMode = UIViewContentMode.center
switch segmentioStyle {
case .imageBeforeLabel, .imageAfterLabel:
imageContentMode = .scaleAspectFit
default:
break
}
return SegmentioOptions(
backgroundColor: ColorPalette.white,
maxVisibleItems: 3,
scrollEnabled: true,
indicatorOptions: segmentioIndicatorOptions(),
horizontalSeparatorOptions: segmentioHorizontalSeparatorOptions(),
verticalSeparatorOptions: segmentioVerticalSeparatorOptions(),
imageContentMode: imageContentMode,
labelTextAlignment: .center,
labelTextNumberOfLines: 1,
segmentStates: segmentioStates(),
animationDuration: 0.3
)
}
private static func segmentioStates() -> SegmentioStates {
let font = UIFont.exampleAvenirMedium(ofSize: 13)
return SegmentioStates(
defaultState: segmentioState(
backgroundColor: .clear,
titleFont: font,
titleTextColor: ColorPalette.grayChateau
),
selectedState: segmentioState(
backgroundColor: .cyan,
titleFont: font,
titleTextColor: ColorPalette.black
),
highlightedState: segmentioState(
backgroundColor: ColorPalette.whiteSmoke,
titleFont: font,
titleTextColor: ColorPalette.grayChateau
)
)
}
private static func segmentioState(backgroundColor: UIColor, titleFont: UIFont, titleTextColor: UIColor) -> SegmentioState {
return SegmentioState(
backgroundColor: backgroundColor,
titleFont: titleFont,
titleTextColor: titleTextColor
)
}
private static func segmentioIndicatorOptions() -> SegmentioIndicatorOptions {
return SegmentioIndicatorOptions(
type: .bottom,
ratio: 1,
height: 5,
color: ColorPalette.coral
)
}
private static func segmentioHorizontalSeparatorOptions() -> SegmentioHorizontalSeparatorOptions {
return SegmentioHorizontalSeparatorOptions(
type: .topAndBottom,
height: 1,
color: ColorPalette.whiteSmoke
)
}
private static func segmentioVerticalSeparatorOptions() -> SegmentioVerticalSeparatorOptions {
return SegmentioVerticalSeparatorOptions(
ratio: 1,
color: ColorPalette.whiteSmoke
)
}
}

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.1</string> <string>0.1.5</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>26</string> <string>25</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>

View File

@ -1,12 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
@ -18,21 +14,21 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Y" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zdV-II-bEc"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Y" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zdV-II-bEc">
<rect key="frame" x="157.5" y="288.5" width="60" height="90"/> <rect key="frame" x="270" y="255" width="60" height="90"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="60" id="15m-sK-BMc"/> <constraint firstAttribute="width" constant="60" id="15m-sK-BMc"/>
<constraint firstAttribute="height" constant="90" id="pHT-4Q-Z9L"/> <constraint firstAttribute="height" constant="90" id="pHT-4Q-Z9L"/>
</constraints> </constraints>
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="90"/> <fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="90"/>
<color key="textColor" red="0.95294117647058818" green="0.40000000000000002" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.95294117647058818" green="0.40000000000000002" blue="0.33333333333333331" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
</subviews> </subviews>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstItem="zdV-II-bEc" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="7C2-HE-YjU"/> <constraint firstItem="zdV-II-bEc" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="7C2-HE-YjU"/>
<constraint firstItem="zdV-II-bEc" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Eur-FL-asR"/> <constraint firstItem="zdV-II-bEc" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Eur-FL-asR"/>
@ -41,7 +37,7 @@
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-36" y="268"/> <point key="canvasLocation" x="53" y="375"/>
</scene> </scene>
</scenes> </scenes>
</document> </document>

View File

@ -1,12 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Sgi-ow-Mpv"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Sgi-ow-Mpv">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Disaster's guide--> <!--Disaster's guide-->
@ -18,17 +14,17 @@
<viewControllerLayoutGuide type="bottom" id="Cxz-xC-i78"/> <viewControllerLayoutGuide type="bottom" id="Cxz-xC-i78"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="6th-V5-ZMU"> <view key="view" contentMode="scaleToFill" id="6th-V5-ZMU">
<rect key="frame" x="0.0" y="64" width="375" height="603"/> <rect key="frame" x="0.0" y="64" width="600" height="536"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="j4J-17-RS0"> <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="j4J-17-RS0">
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/> <rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<connections> <connections>
<segue destination="nnH-xc-bez" kind="embed" identifier="EmbedContainerViewController" id="39a-pg-Pje"/> <segue destination="nnH-xc-bez" kind="embed" identifier="EmbedContainerViewController" id="39a-pg-Pje"/>
</connections> </connections>
</containerView> </containerView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="j4J-17-RS0" firstAttribute="top" secondItem="RuD-xI-nzV" secondAttribute="bottom" id="6TL-ta-XXo"/> <constraint firstItem="j4J-17-RS0" firstAttribute="top" secondItem="RuD-xI-nzV" secondAttribute="bottom" id="6TL-ta-XXo"/>
<constraint firstAttribute="trailing" secondItem="j4J-17-RS0" secondAttribute="trailing" id="7vA-9i-p0o"/> <constraint firstAttribute="trailing" secondItem="j4J-17-RS0" secondAttribute="trailing" id="7vA-9i-p0o"/>
@ -58,46 +54,46 @@
<viewControllerLayoutGuide type="bottom" id="d6b-iV-EUm"/> <viewControllerLayoutGuide type="bottom" id="d6b-iV-EUm"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="aho-PV-db8" userLabel="Content View"> <view key="view" contentMode="scaleToFill" id="aho-PV-db8" userLabel="Content View">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cards" translatesAutoresizingMaskIntoConstraints="NO" id="EGM-zw-1hI"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cards" translatesAutoresizingMaskIntoConstraints="NO" id="EGM-zw-1hI">
<rect key="frame" x="25" y="24" width="325" height="620"/> <rect key="frame" x="25" y="24" width="550" height="553"/>
<constraints> <constraints>
<constraint firstAttribute="height" priority="900" constant="553" id="ffK-Ju-lZo"/> <constraint firstAttribute="height" priority="900" constant="553" id="ffK-Ju-lZo"/>
</constraints> </constraints>
</imageView> </imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyy-sw-hGC" userLabel="Separator"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyy-sw-hGC" userLabel="Separator">
<rect key="frame" x="32" y="101" width="311" height="1"/> <rect key="frame" x="32" y="101" width="536" height="1"/>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="1" id="89l-q6-tQe"/> <constraint firstAttribute="height" constant="1" id="89l-q6-tQe"/>
</constraints> </constraints>
</view> </view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Before" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-p7-Csf"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Before" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoy-p7-Csf">
<rect key="frame" x="32" y="75" width="311" height="19"/> <rect key="frame" x="32" y="75" width="536" height="19"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="19" id="x6o-JU-9JP"/> <constraint firstAttribute="height" constant="19" id="x6o-JU-9JP"/>
</constraints> </constraints>
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="18"/> <fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="f8N-44-bJn"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="f8N-44-bJn">
<rect key="frame" x="32" y="160" width="311" height="467"/> <rect key="frame" x="32" y="160" width="536" height="400"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="separatorColor" red="0.96078431606292725" green="0.96078431606292725" blue="0.96078431606292725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="separatorColor" red="0.96078431606292725" green="0.96078431606292725" blue="0.96078431606292725" alpha="1" colorSpace="calibratedRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" id="C9g-Ij-gNT" customClass="ExampleTableViewCell" customModule="Segmentio_Example" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" id="C9g-Ij-gNT" customClass="ExampleTableViewCell" customModule="Segmentio_Example" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="311" height="44"/> <rect key="frame" x="0.0" y="28" width="536" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C9g-Ij-gNT" id="3tu-UK-HZb"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C9g-Ij-gNT" id="3tu-UK-HZb">
<rect key="frame" x="0.0" y="0.0" width="311" height="44"/> <rect key="frame" x="0.0" y="0.0" width="536" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uyX-0h-rHd"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uyX-0h-rHd">
<rect key="frame" x="25" y="10" width="261" height="24"/> <rect key="frame" x="25" y="10" width="486" height="24"/>
<fontDescription key="fontDescription" name="Avenir-Light" family="Avenir" pointSize="13"/> <fontDescription key="fontDescription" name="Avenir-Light" family="Avenir" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
@ -122,14 +118,14 @@
</connections> </connections>
</tableView> </tableView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="oval" translatesAutoresizingMaskIntoConstraints="NO" id="t46-Uj-4Ci"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="oval" translatesAutoresizingMaskIntoConstraints="NO" id="t46-Uj-4Ci">
<rect key="frame" x="178.5" y="122" width="18" height="18"/> <rect key="frame" x="291" y="122" width="18" height="18"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="18" id="Gki-L9-gmb"/> <constraint firstAttribute="height" constant="18" id="Gki-L9-gmb"/>
<constraint firstAttribute="width" constant="18" id="HcY-Je-7ti"/> <constraint firstAttribute="width" constant="18" id="HcY-Je-7ti"/>
</constraints> </constraints>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" red="0.85490196078431369" green="0.85490196078431369" blue="0.85490196078431369" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.85490196078431369" green="0.85490196078431369" blue="0.85490196078431369" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstItem="d6b-iV-EUm" firstAttribute="top" secondItem="EGM-zw-1hI" secondAttribute="bottom" constant="23" id="5uZ-0s-poK"/> <constraint firstItem="d6b-iV-EUm" firstAttribute="top" secondItem="EGM-zw-1hI" secondAttribute="bottom" constant="23" id="5uZ-0s-poK"/>
<constraint firstItem="f8N-44-bJn" firstAttribute="trailing" secondItem="EGM-zw-1hI" secondAttribute="trailing" constant="-7" id="961-ZU-5yh"/> <constraint firstItem="f8N-44-bJn" firstAttribute="trailing" secondItem="EGM-zw-1hI" secondAttribute="trailing" constant="-7" id="961-ZU-5yh"/>
@ -169,7 +165,7 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="A36-fE-w8g"> <navigationBar key="navigationBar" contentMode="scaleToFill" id="A36-fE-w8g">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/> <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="barTintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="flat" value="YES"/> <userDefinedRuntimeAttribute type="boolean" keyPath="flat" value="YES"/>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
@ -192,43 +188,43 @@
<viewControllerLayoutGuide type="bottom" id="Lh0-b2-Lg9"/> <viewControllerLayoutGuide type="bottom" id="Lh0-b2-Lg9"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="3on-2h-KRG"> <view key="view" contentMode="scaleToFill" id="3on-2h-KRG">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dwd-YU-7oV" userLabel="Shadow View"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dwd-YU-7oV" userLabel="Shadow View">
<rect key="frame" x="262" y="0.0" width="113" height="667"/> <rect key="frame" x="420" y="0.0" width="180" height="600"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view> </view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Ufo-LN-tbg"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Ufo-LN-tbg">
<rect key="frame" x="0.0" y="0.0" width="262" height="667"/> <rect key="frame" x="0.0" y="0.0" width="420" height="600"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="262" id="1Fe-0J-akh"/> <constraint firstAttribute="width" constant="420" id="1Fe-0J-akh"/>
</constraints> </constraints>
<color key="separatorColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="separatorColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="Jjd-1j-efW" userLabel="Header"> <view key="tableHeaderView" contentMode="scaleToFill" id="Jjd-1j-efW" userLabel="Header">
<rect key="frame" x="0.0" y="0.0" width="262" height="66"/> <rect key="frame" x="0.0" y="0.0" width="420" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IOF-iR-GOe" userLabel="Separator View"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IOF-iR-GOe" userLabel="Separator View">
<rect key="frame" x="0.0" y="65" width="262" height="1"/> <rect key="frame" x="0.0" y="65" width="420" height="1"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.43529411764705883" blue="0.37647058823529411" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.95686274509803915" green="0.43529411764705883" blue="0.37647058823529411" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="1" id="ipJ-LO-nfb"/> <constraint firstAttribute="height" constant="1" id="ipJ-LO-nfb"/>
</constraints> </constraints>
</view> </view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Segmentio" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ON6-SS-qxO"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Segmentio" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ON6-SS-qxO">
<rect key="frame" x="16" y="35" width="230" height="22"/> <rect key="frame" x="16" y="35" width="388" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="22" id="2GY-JW-I97"/> <constraint firstAttribute="height" constant="22" id="2GY-JW-I97"/>
</constraints> </constraints>
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="17"/> <fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="17"/>
<color key="textColor" red="0.95686274510000002" green="0.43529411759999997" blue="0.37647058820000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.95686274510000002" green="0.43529411759999997" blue="0.37647058820000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="ON6-SS-qxO" firstAttribute="leading" secondItem="Jjd-1j-efW" secondAttribute="leading" constant="16" id="1dw-Yl-bgI"/> <constraint firstItem="ON6-SS-qxO" firstAttribute="leading" secondItem="Jjd-1j-efW" secondAttribute="leading" constant="16" id="1dw-Yl-bgI"/>
<constraint firstAttribute="trailing" secondItem="IOF-iR-GOe" secondAttribute="trailing" id="AQi-XF-2bn"/> <constraint firstAttribute="trailing" secondItem="IOF-iR-GOe" secondAttribute="trailing" id="AQi-XF-2bn"/>
@ -240,17 +236,17 @@
</view> </view>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="bIG-dp-uan" imageView="f8N-oJ-egW" style="IBUITableViewCellStyleDefault" id="k0c-n4-4H9"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="bIG-dp-uan" imageView="f8N-oJ-egW" style="IBUITableViewCellStyleDefault" id="k0c-n4-4H9">
<rect key="frame" x="0.0" y="94" width="262" height="44"/> <rect key="frame" x="0.0" y="94" width="420" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="k0c-n4-4H9" id="9bd-UY-udW"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="k0c-n4-4H9" id="9bd-UY-udW">
<rect key="frame" x="0.0" y="0.0" width="262" height="43"/> <rect key="frame" x="0.0" y="0.0" width="420" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bIG-dp-uan"> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bIG-dp-uan">
<rect key="frame" x="42" y="0.0" width="205" height="43"/> <rect key="frame" x="42" y="0.0" width="363" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="13"/> <fontDescription key="fontDescription" name="Avenir-Medium" family="Avenir" pointSize="13"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="defaultCheckbox" id="f8N-oJ-egW"> <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="defaultCheckbox" id="f8N-oJ-egW">
@ -268,7 +264,7 @@
</connections> </connections>
</tableView> </tableView>
</subviews> </subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="dwd-YU-7oV" firstAttribute="leading" secondItem="Ufo-LN-tbg" secondAttribute="trailing" id="STr-vP-7id"/> <constraint firstItem="dwd-YU-7oV" firstAttribute="leading" secondItem="Ufo-LN-tbg" secondAttribute="trailing" id="STr-vP-7id"/>
<constraint firstItem="Lh0-b2-Lg9" firstAttribute="top" secondItem="Ufo-LN-tbg" secondAttribute="bottom" id="ap0-3r-aiS"/> <constraint firstItem="Lh0-b2-Lg9" firstAttribute="top" secondItem="Ufo-LN-tbg" secondAttribute="bottom" id="ap0-3r-aiS"/>
@ -279,6 +275,8 @@
<constraint firstAttribute="trailing" secondItem="dwd-YU-7oV" secondAttribute="trailing" id="tIN-F6-Jaf"/> <constraint firstAttribute="trailing" secondItem="dwd-YU-7oV" secondAttribute="trailing" id="tIN-F6-Jaf"/>
</constraints> </constraints>
</view> </view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="600" height="600"/>
<connections> <connections>
<outlet property="menuTableView" destination="Ufo-LN-tbg" id="MLh-5f-jgM"/> <outlet property="menuTableView" destination="Ufo-LN-tbg" id="MLh-5f-jgM"/>
<outlet property="menuTableViewWidthConstraint" destination="1Fe-0J-akh" id="m5l-sp-fm3"/> <outlet property="menuTableViewWidthConstraint" destination="1Fe-0J-akh" id="m5l-sp-fm3"/>
@ -298,27 +296,27 @@
<viewControllerLayoutGuide type="bottom" id="qlN-Ul-M6a"/> <viewControllerLayoutGuide type="bottom" id="qlN-Ul-M6a"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="cqi-F1-zxi"> <view key="view" contentMode="scaleToFill" id="cqi-F1-zxi">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vkr-KO-SOm" customClass="Segmentio" customModule="Segmentio"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vkr-KO-SOm" customClass="Segmentio" customModule="Segmentio">
<rect key="frame" x="0.0" y="0.0" width="375" height="125"/> <rect key="frame" x="0.0" y="0.0" width="600" height="125"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="125" id="MbU-cC-j02"/> <constraint firstAttribute="height" constant="125" id="MbU-cC-j02"/>
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aMO-Fm-zcR" userLabel="Container"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aMO-Fm-zcR" userLabel="Container">
<rect key="frame" x="0.0" y="125" width="375" height="542"/> <rect key="frame" x="0.0" y="125" width="600" height="475"/>
<subviews> <subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bPK-CN-TXA"> <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bPK-CN-TXA">
<rect key="frame" x="0.0" y="0.0" width="375" height="542"/> <rect key="frame" x="0.0" y="0.0" width="600" height="475"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<connections> <connections>
<outlet property="delegate" destination="hoe-Iv-t0i" id="tIm-r4-G4D"/> <outlet property="delegate" destination="hoe-Iv-t0i" id="tIm-r4-G4D"/>
</connections> </connections>
</scrollView> </scrollView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="bPK-CN-TXA" firstAttribute="top" secondItem="aMO-Fm-zcR" secondAttribute="top" id="83n-Aq-y36"/> <constraint firstItem="bPK-CN-TXA" firstAttribute="top" secondItem="aMO-Fm-zcR" secondAttribute="top" id="83n-Aq-y36"/>
<constraint firstAttribute="trailing" secondItem="bPK-CN-TXA" secondAttribute="trailing" id="AzX-r5-bQP"/> <constraint firstAttribute="trailing" secondItem="bPK-CN-TXA" secondAttribute="trailing" id="AzX-r5-bQP"/>
@ -327,13 +325,13 @@
</constraints> </constraints>
</view> </view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="shadow" translatesAutoresizingMaskIntoConstraints="NO" id="i1Z-h8-Bjj"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="shadow" translatesAutoresizingMaskIntoConstraints="NO" id="i1Z-h8-Bjj">
<rect key="frame" x="0.0" y="125" width="375" height="9"/> <rect key="frame" x="0.0" y="125" width="600" height="9"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="9" id="2DA-Ym-fL4"/> <constraint firstAttribute="height" constant="9" id="2DA-Ym-fL4"/>
</constraints> </constraints>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="aMO-Fm-zcR" firstAttribute="top" secondItem="Vkr-KO-SOm" secondAttribute="bottom" id="ABa-Nj-ipD"/> <constraint firstItem="aMO-Fm-zcR" firstAttribute="top" secondItem="Vkr-KO-SOm" secondAttribute="bottom" id="ABa-Nj-ipD"/>
<constraint firstItem="aMO-Fm-zcR" firstAttribute="leading" secondItem="cqi-F1-zxi" secondAttribute="leading" id="VS6-Ut-9kj"/> <constraint firstItem="aMO-Fm-zcR" firstAttribute="leading" secondItem="cqi-F1-zxi" secondAttribute="leading" id="VS6-Ut-9kj"/>
@ -377,19 +375,19 @@
<viewControllerLayoutGuide type="bottom" id="riu-eD-uzK"/> <viewControllerLayoutGuide type="bottom" id="riu-eD-uzK"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="8VE-5b-uC6"> <view key="view" contentMode="scaleToFill" id="8VE-5b-uC6">
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/> <rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/> <extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Caz-AG-AcN" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="Caz-AG-AcN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="2084" y="287"/> <point key="canvasLocation" x="2084" y="285"/>
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="cards" width="125" height="53"/> <image name="cards" width="126" height="54"/>
<image name="defaultCheckbox" width="12" height="12"/> <image name="defaultCheckbox" width="12" height="12"/>
<image name="menu" width="28" height="14"/> <image name="menu" width="28" height="14"/>
<image name="oval" width="18" height="18"/> <image name="oval" width="18" height="18"/>

View File

@ -46,65 +46,122 @@ class ExampleViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) { override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) super.viewDidAppear(animated)
setupSegmentioView()
setupScrollView() setupScrollView()
setupBadgeCountForIndex(1)
SegmentioBuilder.buildSegmentioView( }
segmentioView: segmentioView,
segmentioStyle: segmentioStyle fileprivate func setupSegmentioView() {
segmentioView.setup(
content: segmentioContent(),
style: segmentioStyle,
options: segmentioOptions()
) )
SegmentioBuilder.setupBadgeCountForIndex(segmentioView, index: 1)
segmentioView.selectedSegmentioIndex = selectedSegmentioIndex() segmentioView.selectedSegmentioIndex = selectedSegmentioIndex()
segmentioView.valueDidChange = { [weak self] _, segmentIndex in segmentioView.valueDidChange = { [weak self] _, segmentIndex in
if let scrollViewWidth = self?.scrollView.frame.width { if let scrollViewWidth = self?.scrollView.frame.width {
let contentOffsetX = scrollViewWidth * CGFloat(segmentIndex) let contentOffsetX = scrollViewWidth * CGFloat(segmentIndex)
self?.scrollView.setContentOffset( self?.scrollView.setContentOffset(CGPoint(x: contentOffsetX, y: 0), animated: true)
CGPoint(x: contentOffsetX, y: 0),
animated: true
)
} }
} }
} }
fileprivate func setupBadgeCountForIndex(_ index: Int) {
segmentioView.addBadge(at: index, count: 10, color: ColorPalette.coral)
}
fileprivate func segmentioContent() -> [SegmentioItem] {
return [
SegmentioItem(title: "Tornado", image: UIImage(named: "tornado")),
SegmentioItem(title: "Earthquakes", image: UIImage(named: "earthquakes")),
SegmentioItem(title: "Extreme heat", image: UIImage(named: "heat")),
SegmentioItem(title: "Eruption", image: UIImage(named: "eruption")),
SegmentioItem(title: "Floods", image: UIImage(named: "floods")),
SegmentioItem(title: "Wildfires", image: UIImage(named: "wildfires"))
]
}
fileprivate func segmentioOptions() -> SegmentioOptions {
var imageContentMode = UIViewContentMode.center
switch segmentioStyle {
case .imageBeforeLabel, .imageAfterLabel:
imageContentMode = .scaleAspectFit
default:
break
}
return SegmentioOptions(
backgroundColor: ColorPalette.white,
maxVisibleItems: 3,
scrollEnabled: true,
indicatorOptions: segmentioIndicatorOptions(),
horizontalSeparatorOptions: segmentioHorizontalSeparatorOptions(),
verticalSeparatorOptions: segmentioVerticalSeparatorOptions(),
imageContentMode: imageContentMode,
labelTextAlignment: .center,
segmentStates: segmentioStates()
)
}
fileprivate func segmentioStates() -> SegmentioStates {
let font = UIFont.exampleAvenirMedium(ofSize: 13)
return SegmentioStates(
defaultState: segmentioState(
backgroundColor: .clear,
titleFont: font,
titleTextColor: ColorPalette.grayChateau
),
selectedState: segmentioState(
backgroundColor: .clear,
titleFont: font,
titleTextColor: ColorPalette.black
),
highlightedState: segmentioState(
backgroundColor: ColorPalette.whiteSmoke,
titleFont: font,
titleTextColor: ColorPalette.grayChateau
)
)
}
fileprivate func segmentioState(backgroundColor: UIColor, titleFont: UIFont, titleTextColor: UIColor) -> SegmentioState {
return SegmentioState(backgroundColor: backgroundColor, titleFont: titleFont, titleTextColor: titleTextColor)
}
fileprivate func segmentioIndicatorOptions() -> SegmentioIndicatorOptions {
return SegmentioIndicatorOptions(type: .bottom, ratio: 1, height: 5, color: ColorPalette.coral)
}
fileprivate func segmentioHorizontalSeparatorOptions() -> SegmentioHorizontalSeparatorOptions {
return SegmentioHorizontalSeparatorOptions(type: .topAndBottom, height: 1, color: ColorPalette.whiteSmoke)
}
fileprivate func segmentioVerticalSeparatorOptions() -> SegmentioVerticalSeparatorOptions {
return SegmentioVerticalSeparatorOptions(ratio: 1, color: ColorPalette.whiteSmoke)
}
// Example viewControllers // Example viewControllers
fileprivate func preparedViewControllers() -> [ContentViewController] { fileprivate func preparedViewControllers() -> [ContentViewController] {
let tornadoController = ContentViewController.create() let tornadoController = ContentViewController.create()
tornadoController.disaster = Disaster( tornadoController.disaster = Disaster(cardName: "Before tornado", hints: Hints.tornado)
cardName: "Before tornado",
hints: Hints.tornado
)
let earthquakesController = ContentViewController.create() let earthquakesController = ContentViewController.create()
earthquakesController.disaster = Disaster( earthquakesController.disaster = Disaster(cardName: "Before earthquakes", hints: Hints.earthquakes)
cardName: "Before earthquakes",
hints: Hints.earthquakes
)
let extremeHeatController = ContentViewController.create() let extremeHeatController = ContentViewController.create()
extremeHeatController.disaster = Disaster( extremeHeatController.disaster = Disaster(cardName: "Before extreme heat", hints: Hints.extremeHeat)
cardName: "Before extreme heat",
hints: Hints.extremeHeat
)
let eruptionController = ContentViewController.create() let eruptionController = ContentViewController.create()
eruptionController.disaster = Disaster( eruptionController.disaster = Disaster(cardName: "Before eruption", hints: Hints.eruption)
cardName: "Before eruption",
hints: Hints.eruption
)
let floodsController = ContentViewController.create() let floodsController = ContentViewController.create()
floodsController.disaster = Disaster( floodsController.disaster = Disaster(cardName: "Before floods", hints: Hints.floods)
cardName: "Before floods",
hints: Hints.floods
)
let wildfiresController = ContentViewController.create() let wildfiresController = ContentViewController.create()
wildfiresController.disaster = Disaster( wildfiresController.disaster = Disaster(cardName: "Before wildfires", hints: Hints.wildfires)
cardName: "Before wildfires",
hints: Hints.wildfires
)
return [ return [
tornadoController, tornadoController,

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright © 2017 Yalantis Copyright © 2015 Yalantis
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.

View File

@ -1,5 +1,5 @@
##Segmentio ##Segmentio
[![Platform](http://img.shields.io/badge/platform-iOS-blue.svg?style=flat)](https://cocoapods.org/?q=segmentio) [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/Yalantis/Segmentio/blob/master/LICENSE) ![Swift 3.x](https://img.shields.io/badge/Swift-3.0-orange.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](http://img.shields.io/badge/platform-iOS-blue.svg?style=flat)](https://cocoapods.org/?q=segmentio) [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/Yalantis/Segmentio/blob/master/LICENSE) ![Swift 2.2.x](https://img.shields.io/badge/Swift-2.2.x-orange.svg) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
Animated top/bottom segmented control written in Swift. Animated top/bottom segmented control written in Swift.
@ -19,14 +19,14 @@ Check this <a href="https://dribbble.com/shots/2820372-Segmentio-Component">proj
```ruby ```ruby
use_frameworks! use_frameworks!
pod 'Segmentio', '~> 2.1' pod 'Segmentio', '~> 2.0'
``` ```
*CocoaPods v1.1.0 or later required* *CocoaPods v1.1.0 or later required*
####[Carthage](http://github.com/Carthage/Carthage) ####[Carthage](http://github.com/Carthage/Carthage)
```ruby ```ruby
github "Yalantis/Segmentio" ~> 2.1 github "Yalantis/Segmentio" ~> 2.0
``` ```
##Usage ##Usage
@ -41,7 +41,7 @@ You can initialize a `Segmentio` instance from code:
```swift ```swift
var segmentioView: Segmentio! var segmentioView: Segmentio!
let segmentioViewRect = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 125) let segmentioViewRect = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 125)
segmentioView = Segmentio(frame: segmentioViewRect) segmentioView = Segmentio(frame: segmentioViewRect)
view.addSubview(segmentioView) view.addSubview(segmentioView)
``` ```
@ -56,7 +56,7 @@ add a `UIView` instance in your .storyboard or .xib, set `Segmentio` class and c
####Setup `Segmentio` ####Setup `Segmentio`
```swift ```swift
segmentioView.setup( segmentioView.setupContent(
content: [SegmentioItem], content: [SegmentioItem],
style: SegmentioStyle, style: SegmentioStyle,
options: SegmentioOptions? options: SegmentioOptions?
@ -66,7 +66,7 @@ segmentioView.setup(
To start with default options you can just pass `nil` to the `options` parameter. To start with default options you can just pass `nil` to the `options` parameter.
```swift ```swift
segmentioView.setup( segmentioView.setupContent(
content: [SegmentioItem], content: [SegmentioItem],
style: SegmentioStyle, style: SegmentioStyle,
options: nil options: nil
@ -91,7 +91,7 @@ content.append(tornadoItem)
You can specify selected item manually: You can specify selected item manually:
```swift ```swift
segmentioView.selectedSegmentioIndex = 0 segmentioView.selectedSegmentIndex = 0
``` ```
####Handling callback ####Handling callback
@ -107,15 +107,15 @@ segmentioView.valueDidChange = { segmentio, segmentIndex in
```swift ```swift
SegmentioOptions( SegmentioOptions(
backgroundColor: .white, backgroundColor: UIColor.whiteColor(),
maxVisibleItems: 3, maxVisibleItems: 3,
scrollEnabled: true, scrollEnabled: true,
indicatorOptions: SegmentioIndicatorOptions, indicatorOptions: SegmentioIndicatorOptions,
horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions, horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions,
verticalSeparatorOptions: SegmentioVerticalSeparatorOptions, verticalSeparatorOptions: SegmentioVerticalSeparatorOptions,
imageContentMode: .center, imageContentMode: UIViewContentMode.Center,
labelTextAlignment: .center, labelTextAlignment: NSTextAlignment.Center,
segmentStates: SegmentioStates segmentStates: SegmentioStates // tuple of SegmentioState (defaultState, selectState, highlightedState)
) )
``` ```
@ -123,10 +123,10 @@ Selection indicator can be customized by passing an instance of `SegmentioIndica
```swift ```swift
SegmentioIndicatorOptions( SegmentioIndicatorOptions(
type: .bottom, type: .Bottom,
ratio: 1, ratio: 1,
height: 5, height: 5,
color: .orange color: UIColor.orangeColor()
) )
``` ```
@ -134,9 +134,9 @@ Horizontal borders can be customized by passing an instance of `SegmentioHorizon
```swift ```swift
SegmentioHorizontalSeparatorOptions( SegmentioHorizontalSeparatorOptions(
type: SegmentioHorizontalSeparatorType.topAndBottom, // Top, Bottom, TopAndBottom type: SegmentioHorizontalSeparatorType.TopAndBottom, // Top, Bottom, TopAndBottom
height: 1, height: 1,
color: .gray color: UIColor.grayColor()
) )
``` ```
@ -144,8 +144,8 @@ Separators between segments can be customized by passing an instance of `Segmen
```swift ```swift
SegmentioVerticalSeparatorOptions( SegmentioVerticalSeparatorOptions(
ratio: 0.6, // from 0.1 to 1 ratio: 0.6 // from 0.1 to 1
color: .gray color: UIColor.grayColor()
) )
``` ```
@ -153,21 +153,21 @@ In order to set `SegmentioStates` you need to create a tuple of `SegmentioState`
```swift ```swift
SegmentioStates( SegmentioStates(
defaultState: SegmentioState( defaultState: segmentioState(
backgroundColor: .clear, backgroundColor: UIColor.clearColor(),
titleFont: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize), titleFont: UIFont.systemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: .black titleTextColor: UIColor.blackColor()
), ),
selectedState: SegmentioState( selectState: segmentioState(
backgroundColor: .orange, backgroundColor: UIColor.orangeColor(),
titleFont: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize), titleFont: UIFont.systemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: .white titleTextColor: UIColor.whiteColor()
), ),
highlightedState: SegmentioState( highlightedState: segmentioState(
backgroundColor: UIColor.lightGray.withAlphaComponent(0.6), backgroundColor: UIColor.lightGrayColor().colorWithAlphaComponent(0.6),
titleFont: UIFont.boldSystemFont(ofSize: UIFont.smallSystemFontSize), titleFont: UIFont.boldSystemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: .black titleTextColor: UIColor.blackColor()
) )
) )
``` ```
@ -180,7 +180,7 @@ P.S. Were going to publish more awesomeness wrapped in code and a tutorial on
The MIT License (MIT) The MIT License (MIT)
Copyright © 2017 Yalantis Copyright © 2016 Yalantis
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -198,4 +198,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |spec| Pod::Spec.new do |spec|
spec.name = "Segmentio" spec.name = "Segmentio"
spec.version = "2.1.2" spec.version = "2.0"
spec.homepage = "https://github.com/Yalantis/Segmentio" spec.homepage = "https://github.com/Yalantis/Segmentio"
spec.summary = "Animated top/bottom segmented control written in Swift!" spec.summary = "Animated top/bottom segmented control written in Swift!"

View File

@ -272,7 +272,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@ -312,7 +312,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.1</string> <string>0.1.5</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>

View File

@ -173,43 +173,35 @@ class SegmentioCell: UICollectionViewCell {
// MARK: - Private functions // MARK: - Private functions
fileprivate func setupContainerConstraints() { fileprivate func setupContainerConstraints() {
guard let segmentTitleLabel = segmentTitleLabel, let containerView = containerView else { guard let segmentTitleLabel = segmentTitleLabel else {
return
}
guard let containerView = containerView else {
return return
} }
let segmentTitleLabelVerticalCenterConstraint = NSLayoutConstraint( let segmentTitleLabelHorizontalCenterConstraint =
item: segmentTitleLabel, NSLayoutConstraint(
attribute: .centerY, item: segmentTitleLabel,
relatedBy: .equal, attribute: .centerX,
toItem: containerView, relatedBy: .equal,
attribute: .centerY, toItem: containerView,
multiplier: 1, attribute: .centerX,
constant: 0 multiplier: 1,
) constant: 0.0
let segmentTitleLabelTrailingConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .trailing,
relatedBy: .equal,
toItem: containerView,
attribute: .trailing, //changed from .trailingMargin. remove std margin 8pt
multiplier: 1.0,
constant: 0
)
let segmentTitleLabelLeadingConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .leading,
relatedBy: .equal,
toItem: containerView,
attribute: .leading, //changed from .leadingMargin. remove std margin 8pt
multiplier: 1.0,
constant: 0
) )
addConstraints([ let segmentTitleLabelVerticalCenterConstraint =
segmentTitleLabelTrailingConstraint, NSLayoutConstraint(
segmentTitleLabelVerticalCenterConstraint, item: segmentTitleLabel,
segmentTitleLabelLeadingConstraint attribute: .centerY,
]) relatedBy: .equal,
toItem: containerView,
attribute: .centerY,
multiplier: 1,
constant: 0.0
)
addConstraints([segmentTitleLabelHorizontalCenterConstraint, segmentTitleLabelVerticalCenterConstraint])
} }
fileprivate func setupImageContainerConstraints() { fileprivate func setupImageContainerConstraints() {
@ -228,7 +220,7 @@ class SegmentioCell: UICollectionViewCell {
toItem: imageContainerView, toItem: imageContainerView,
attribute: .top, attribute: .top,
multiplier: 1, multiplier: 1,
constant: 0 constant: 0.0
) )
let segmentImageViewLeadingConstraint = let segmentImageViewLeadingConstraint =
@ -239,7 +231,7 @@ class SegmentioCell: UICollectionViewCell {
toItem: imageContainerView, toItem: imageContainerView,
attribute: .leading, attribute: .leading,
multiplier: 1, multiplier: 1,
constant: 0 constant: 0.0
) )
let segmentImageViewTrailingConstraint = let segmentImageViewTrailingConstraint =
@ -250,7 +242,7 @@ class SegmentioCell: UICollectionViewCell {
toItem: imageContainerView, toItem: imageContainerView,
attribute: .trailing, attribute: .trailing,
multiplier: 1, multiplier: 1,
constant: 0 constant: 0.0
) )
let segmentImageViewBottomConstraint = let segmentImageViewBottomConstraint =
@ -261,14 +253,9 @@ class SegmentioCell: UICollectionViewCell {
toItem: imageContainerView, toItem: imageContainerView,
attribute: .bottom, attribute: .bottom,
multiplier: 1, multiplier: 1,
constant: 0 constant: 0.0
) )
addConstraints([ addConstraints([segmentImageViewBottomConstraint, segmentImageViewTrailingConstraint, segmentImageViewLeadingConstraint, segmentImageViewTopConstraint])
segmentImageViewBottomConstraint,
segmentImageViewTrailingConstraint,
segmentImageViewLeadingConstraint,
segmentImageViewTopConstraint
])
} }
@ -280,7 +267,6 @@ class SegmentioCell: UICollectionViewCell {
if style.isWithText() { if style.isWithText() {
segmentTitleLabel?.textAlignment = options.labelTextAlignment segmentTitleLabel?.textAlignment = options.labelTextAlignment
segmentTitleLabel?.numberOfLines = options.labelTextNumberOfLines
let defaultState = options.states.defaultState let defaultState = options.states.defaultState
segmentTitleLabel?.textColor = defaultState.titleTextColor segmentTitleLabel?.textColor = defaultState.titleTextColor
segmentTitleLabel?.font = defaultState.titleFont segmentTitleLabel?.font = defaultState.titleFont

View File

@ -22,7 +22,7 @@ final class SegmentioCellWithLabel: SegmentioCell {
// main constraints // main constraints
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraints( let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|[containerView]|", //changed from |-[containerView]-|. remove standard space withVisualFormat: "|-[containerView]-|",
options: [.alignAllCenterX], options: [.alignAllCenterX],
metrics: nil, metrics: nil,
views: views views: views

View File

@ -11,6 +11,8 @@ import QuartzCore
public typealias SegmentioSelectionCallback = ((_ segmentio: Segmentio, _ selectedSegmentioIndex: Int) -> Void) public typealias SegmentioSelectionCallback = ((_ segmentio: Segmentio, _ selectedSegmentioIndex: Int) -> Void)
private let animationDuration: CFTimeInterval = 0.3
open class Segmentio: UIView { open class Segmentio: UIView {
internal struct Points { internal struct Points {
@ -43,9 +45,9 @@ open class Segmentio: UIView {
} }
} }
} }
open fileprivate(set) var segmentioItems = [SegmentioItem]()
fileprivate var segmentioCollectionView: UICollectionView? fileprivate var segmentioCollectionView: UICollectionView?
fileprivate var segmentioItems = [SegmentioItem]()
fileprivate var segmentioOptions = SegmentioOptions() fileprivate var segmentioOptions = SegmentioOptions()
fileprivate var segmentioStyle = SegmentioStyle.imageOverLabel fileprivate var segmentioStyle = SegmentioStyle.imageOverLabel
fileprivate var isPerformingScrollAnimation = false fileprivate var isPerformingScrollAnimation = false
@ -55,8 +57,20 @@ open class Segmentio: UIView {
fileprivate var indicatorLayer: CAShapeLayer? fileprivate var indicatorLayer: CAShapeLayer?
fileprivate var selectedLayer: CAShapeLayer? fileprivate var selectedLayer: CAShapeLayer?
fileprivate var cachedOrientation: UIInterfaceOrientation? = UIApplication.shared.statusBarOrientation {
didSet {
if cachedOrientation != oldValue {
reloadSegmentio()
}
}
}
// MARK: - Lifecycle // MARK: - Lifecycle
deinit {
NotificationCenter.default.removeObserver(self)
}
required public init?(coder aDecoder: NSCoder) { required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
commonInit() commonInit()
@ -67,13 +81,14 @@ open class Segmentio: UIView {
commonInit() commonInit()
} }
open override func layoutSubviews() {
super.layoutSubviews()
reloadSegmentio()
}
fileprivate func commonInit() { fileprivate func commonInit() {
setupSegmentedCollectionView() setupSegmentedCollectionView()
NotificationCenter.default.addObserver(
self,
selector: #selector(Segmentio.handleOrientationNotification),
name: NSNotification.Name.UIDeviceOrientationDidChange,
object: nil
)
} }
fileprivate func setupSegmentedCollectionView() { fileprivate func setupSegmentedCollectionView() {
@ -131,6 +146,12 @@ open class Segmentio: UIView {
) )
} }
// MARK: - Handle orientation notification
@objc fileprivate func handleOrientationNotification() {
cachedOrientation = UIApplication.shared.statusBarOrientation
}
// MARK: - Setups: // MARK: - Setups:
// MARK: Main setup // MARK: Main setup
@ -321,8 +342,7 @@ open class Segmentio: UIView {
// MARK: - Actions: // MARK: - Actions:
// MARK: Reload segmentio // MARK: Reload segmentio
public func reloadSegmentio() { fileprivate func reloadSegmentio() {
segmentioCollectionView?.collectionViewLayout.invalidateLayout()
segmentioCollectionView?.reloadData() segmentioCollectionView?.reloadData()
scrollToItemAtContext() scrollToItemAtContext()
moveShapeLayerAtContext() moveShapeLayerAtContext()
@ -388,10 +408,9 @@ open class Segmentio: UIView {
) )
} }
if context.isFirstOrSecondVisibleCell == true && selectedSegmentioIndex != -1 { if context.isFirstOrSecondVisibleCell == true {
let newIndex = selectedSegmentioIndex - (context.isFirstIndex ? 1 : 0) let newIndex = selectedSegmentioIndex - (context.isFirstIndex ? 1 : 0)
let newIndexPath = IndexPath(item: newIndex, section: numberOfSections - 1) let newIndexPath = IndexPath(item: newIndex, section: numberOfSections - 1)
segmentioCollectionView?.scrollToItem( segmentioCollectionView?.scrollToItem(
at: newIndexPath, at: newIndexPath,
at: UICollectionViewScrollPosition(), at: UICollectionViewScrollPosition(),
@ -419,7 +438,7 @@ open class Segmentio: UIView {
let animation = CABasicAnimation(keyPath: "path") let animation = CABasicAnimation(keyPath: "path")
animation.fromValue = shapeLayer.path animation.fromValue = shapeLayer.path
animation.toValue = shapeLayerPath.cgPath animation.toValue = shapeLayerPath.cgPath
animation.duration = segmentioOptions.animationDuration animation.duration = animationDuration
CATransaction.setCompletionBlock() { CATransaction.setCompletionBlock() {
self.isPerformingScrollAnimation = false self.isPerformingScrollAnimation = false
self.isUserInteractionEnabled = true self.isUserInteractionEnabled = true

View File

@ -12,11 +12,11 @@ import UIKit
public struct SegmentioItem { public struct SegmentioItem {
public var title: String? var title: String?
public var image: UIImage? var image: UIImage?
public var badgeCount: Int? var badgeCount: Int?
public var badgeColor: UIColor? var badgeColor: UIColor?
public init(title: String?, image: UIImage?) { public init(title: String?, image: UIImage?) {
self.title = title self.title = title
self.image = image self.image = image
@ -84,7 +84,7 @@ public struct SegmentioVerticalSeparatorOptions {
var ratio: CGFloat var ratio: CGFloat
var color: UIColor var color: UIColor
public init(ratio: CGFloat = 1, color: UIColor = .darkGray) { public init(ratio: CGFloat = 1.0, color: UIColor = .darkGray) {
self.ratio = ratio self.ratio = ratio
self.color = color self.color = color
} }
@ -107,7 +107,7 @@ public struct SegmentioIndicatorOptions {
var height: CGFloat var height: CGFloat
var color: UIColor var color: UIColor
public init(type: SegmentioIndicatorType = .bottom, ratio: CGFloat = 1, height: CGFloat = 2, color: UIColor = .orange) { public init(type: SegmentioIndicatorType = .bottom, ratio: CGFloat = 1.0, height: CGFloat = 2.0, color: UIColor = .orange) {
self.type = type self.type = type
self.ratio = ratio self.ratio = ratio
self.height = height self.height = height
@ -162,9 +162,7 @@ public struct SegmentioOptions {
var indicatorOptions: SegmentioIndicatorOptions? var indicatorOptions: SegmentioIndicatorOptions?
var imageContentMode: UIViewContentMode var imageContentMode: UIViewContentMode
var labelTextAlignment: NSTextAlignment var labelTextAlignment: NSTextAlignment
var labelTextNumberOfLines: Int
var states: SegmentioStates var states: SegmentioStates
var animationDuration: CFTimeInterval
public init() { public init() {
self.backgroundColor = .lightGray self.backgroundColor = .lightGray
@ -178,17 +176,15 @@ public struct SegmentioOptions {
self.imageContentMode = .center self.imageContentMode = .center
self.labelTextAlignment = .center self.labelTextAlignment = .center
self.labelTextNumberOfLines = 0
self.states = SegmentioStates( self.states = SegmentioStates(
defaultState: SegmentioState(), defaultState: SegmentioState(),
selectedState: SegmentioState(), selectedState: SegmentioState(),
highlightedState: SegmentioState() highlightedState: SegmentioState()
) )
self.animationDuration = 0.1
} }
public init(backgroundColor: UIColor, maxVisibleItems: Int, scrollEnabled: Bool, indicatorOptions: SegmentioIndicatorOptions?, horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions?, verticalSeparatorOptions: SegmentioVerticalSeparatorOptions?, imageContentMode: UIViewContentMode, labelTextAlignment: NSTextAlignment, labelTextNumberOfLines: Int, segmentStates: SegmentioStates, animationDuration: CFTimeInterval) { public init(backgroundColor: UIColor, maxVisibleItems: Int, scrollEnabled: Bool, indicatorOptions: SegmentioIndicatorOptions?, horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions?, verticalSeparatorOptions: SegmentioVerticalSeparatorOptions?, imageContentMode: UIViewContentMode, labelTextAlignment: NSTextAlignment, segmentStates: SegmentioStates) {
self.backgroundColor = backgroundColor self.backgroundColor = backgroundColor
self.maxVisibleItems = maxVisibleItems self.maxVisibleItems = maxVisibleItems
self.scrollEnabled = scrollEnabled self.scrollEnabled = scrollEnabled
@ -197,9 +193,7 @@ public struct SegmentioOptions {
self.verticalSeparatorOptions = verticalSeparatorOptions self.verticalSeparatorOptions = verticalSeparatorOptions
self.imageContentMode = imageContentMode self.imageContentMode = imageContentMode
self.labelTextAlignment = labelTextAlignment self.labelTextAlignment = labelTextAlignment
self.labelTextNumberOfLines = labelTextNumberOfLines
self.states = segmentStates self.states = segmentStates
self.animationDuration = animationDuration
} }
} }