Compare commits

...

49 Commits

Author SHA1 Message Date
Igor Kislyuk 7473ff0b1d Fix. Add more space for label 2017-03-30 17:53:14 +03:00
Serhii Butenko 8a21e29e89 Fix word overbounds (closes #16) 2017-01-17 08:46:08 +02:00
Boris Vinogradov 51f08913fb Update README.md 2017-01-13 12:42:25 +02:00
Boris Vinogradov 8042192731 Update LICENSE 2017-01-13 12:42:00 +02:00
Serhii Butenko 80d911795c Merge pull request #36 from piechart/master
Code examples updated to Swift 3 syntax
2016-12-21 22:52:05 +02:00
Michael Galperin e14c5c0b16 Code examples updated to Swift 3 2016-12-21 23:44:54 +03:00
Serhii Butenko cf3f6aaba0 Merge pull request #32 from maxcampolo/fix/reload
Fix/reload
2016-12-09 18:20:55 +02:00
Serhii Butenko dd65378ed5 Merge pull request #30 from maxcampolo/dev
SegmentioItem public getters
2016-12-09 18:20:28 +02:00
Max Campolo 05fb10bee7 Reload collection view in reloadSegmentio method 2016-12-09 10:49:16 -05:00
Max Campolo 50ecb102e7 Remove private setter 2016-12-06 09:22:06 -05:00
Max Campolo 6b542845f3 Make getter public for SegmentioItem variables 2016-12-05 11:47:17 -05:00
Serhii Butenko 06f6b0056b Merge pull request #29 from Yalantis/feature/28
Feature/28
2016-12-01 14:52:43 +02:00
Serhii Butenko 13494d9f38
Bump version 2016-12-01 14:52:09 +02:00
Serhii Butenko 790e466868
Make items property public 2016-12-01 14:51:46 +02:00
Serhii Butenko 715b851ca0 Update ISSUE_TEMPLATE.md 2016-11-24 13:29:01 +02:00
Dmitriy Demchenko a71ab5ecca [Update] Segmentio.podspec 2016-11-24 12:29:38 +02:00
Dmitriy Demchenko 75aa08272e [Update] Carthage: info.plist, project.pbxproj 2016-11-24 12:20:05 +02:00
Dmitriy Demchenko 73e1dd3402 [Update] plist.info 2016-11-24 12:17:03 +02:00
Dmitriy Demchenko fab49af07c [Update] project.pbxproj, Segmentio-Example.xcscheme 2016-11-24 12:15:46 +02:00
Dmitriy Demchenko eeda04fffb [Update] README.md 2016-11-24 12:14:08 +02:00
Dmitriy Demchenko 07f7d884fc [Add] SegmentioBuilder
[Update] ExampleViewController: moved setup segmentioView logic to SegmentioBuilder
[Fix] Autolayout issue using Segmentio programtically
[Update] SegmentioItem, SegmentioCell: minor updates
2016-11-14 13:07:54 +02:00
Dmitriy Demchenko e85b4ccb95 [Update] LICENSE file
[Add] ExampleViewController: overrided viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
[Add] Segmentio: added function interfaceOrientationDidChange
[Remove] Segmentio: removed var cachedOrientation
2016-11-11 17:05:00 +02:00
Dmitriy Demchenko f93e6be578 [Update] LaunchScreen.storyboard: updated constraints for Xcode 8
[Update] Main.storyboard: updated constraints for Xcode 8
[Fix] ExampleViewController: fixed segmentioOptions function
2016-11-09 13:22:34 +02:00
Igor Muzyka a97be5838e Merge pull request #17 from IgorMuzyka/master
Fixes issue #1
2016-11-07 16:55:53 +02:00
Igor Muzyka ac9cf49b69 Fixes issue #1 2016-11-07 16:55:21 +02:00
Igor Muzyka 848dfe4d32 Merge pull request #13 from kobylyanets/master
Added animationDuration and numberOfLines of segmentTitleLabel to SegmentioOptions.
2016-11-07 16:52:00 +02:00
Edward Kobylyanets 2808a754eb Add animationDuration and numberOfLines of segmentTitleLabel to SegmentioOptions. Update README.md. 2016-10-19 09:56:52 +03:00
Serhii Butenko 34cf755361 Merge pull request #11 from Yalantis/swift3
Swift3
2016-10-10 08:23:15 +03:00
Serhii Butenko 20ff7d7b66 Bump version 2016-10-10 08:17:32 +03:00
Serhii Butenko 854cc9c302 Specify swift version 2016-10-10 08:17:23 +03:00
Serhii Butenko 6e640d921b Add missed files for Carthage 2016-10-10 08:16:05 +03:00
Serhii Butenko 5dae83d735 Update due to swift 3 guidelines 2016-10-10 08:13:24 +03:00
Serhii Butenko 92cbd32517 Automigration to swift 3 2016-10-05 11:32:49 +03:00
Eugene Pravda b6a1249532 Merge branch 'master' of https://github.com/Yalantis/Segmentio 2016-10-04 12:07:41 +03:00
Serhii Butenko 860f2d85f5 Create ISSUE_TEMPLATE.md 2016-10-04 08:33:38 +03:00
Eugene Pravda ff761f2d61 add container for ImageView 2016-09-30 13:32:38 +03:00
Eugene Pravda 9ff63144d1 update version 2016-09-29 14:06:56 +03:00
Eugene Pravda b4414eb712 update podspec 2016-09-29 13:59:21 +03:00
Eugene Pravda 138636651d ашч сщььутеы 2016-09-28 19:13:21 +03:00
Eugene Pravda 031d470c9a version fix 2016-09-28 18:51:00 +03:00
Eugene Pravda aaeba61117 specupdate 2016-09-28 18:48:11 +03:00
Eugene Pravda 8de3f98187 update podspec 2016-09-28 18:36:54 +03:00
Eugene Pravda ab30cc5329 fix podspec 2016-09-28 18:15:50 +03:00
Eugene Pravda cf206f8184 pod spec update 2016-09-28 18:07:44 +03:00
Eugene Pravda 621957e338 add badges 2016-09-28 17:50:32 +03:00
Eugene Pravda 6eee837927 update constraints 2016-09-28 17:42:48 +03:00
Eugene Pravda 0a537b62d9 add container for titleLable 2016-09-22 18:12:02 +03:00
Eugene Pravda 8a00fe0d90 add start logic for badges appearance 2016-09-22 16:27:21 +03:00
Eugene Pravda 8064c6d8e8 update constraints for text field 2016-09-22 16:26:14 +03:00
60 changed files with 1789 additions and 1385 deletions

43
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,43 @@
# Report
> The more information you provide, the faster we can help you.
⚠️ Select what you want - **a feature request** or **report a bug**. Please remove the section you aren't interested in.
## A feature request
### What do you want to add?
> Please describe what you want to add to the component.
### How should it look like?
> Please add images.
## Report a bug
### What did you do?
> Please replace this with what you did.
### What did you expect to happen?
> Please replace this with what you expected to happen.
### What happened instead?
> Please replace this with what happened instead.
### Your Environment
- Version of the component: _insert here_
- Swift version: _insert here_
- iOS version: _insert here_
- Device: _insert here_
- Xcode version: _insert here_
- If you use Cocoapods: _run `pod env | pbcopy` and insert here_
- If you use Carthage: _run `carthage version | pbcopy` and insert here_
### Project that demonstrates the bug
> Please add a link to a project we can download that reproduces the bug.

1
.swift-version Normal file
View File

@ -0,0 +1 @@
3.0

View File

@ -3,10 +3,4 @@ use_frameworks!
target 'Segmentio_Example' do
pod 'Segmentio', :path => '../'
target 'Segmentio_Tests' do
inherit! :search_paths
end
end

View File

@ -1,16 +1,16 @@
PODS:
- Segmentio (0.1.0)
- Segmentio (1.1.3)
DEPENDENCIES:
- Segmentio (from `../`)
EXTERNAL SOURCES:
Segmentio:
:path: ../
:path: "../"
SPEC CHECKSUMS:
Segmentio: 8a27ead74e53d7617c3130eb511ea4c965b0798f
Segmentio: f784171237bcbb4854f338aef8162e312f4ac5b8
PODFILE CHECKSUM: 191147ab57f909dd239f59b5bebde4bcab89243e
PODFILE CHECKSUM: 761653fe0a6001fe4076ba25b04e279672ecc970
COCOAPODS: 1.0.1
COCOAPODS: 1.1.0.rc.2

View File

@ -1,9 +1,9 @@
{
"name": "Segmentio",
"version": "0.1.0",
"version": "1.1.3",
"homepage": "https://github.com/Yalantis/Segmentio",
"summary": "Animated top/bottom segmented control written in Swift!",
"screenshots": "https://raw.githubusercontent.com/Yalantis/Persei/master/Assets/animation.gif",
"screenshots": "https://raw.githubusercontent.com/Yalantis/Segmentio/master/Assets/animation.gif",
"authors": "Yalantis",
"license": {
"type": "MIT",
@ -15,9 +15,13 @@
},
"source": {
"git": "https://github.com/Yalantis/Segmentio.git",
"tag": "0.1.0"
"tag": "1.1.3"
},
"source_files": "Segmentio/Source/**/*.swift",
"resources": "Segmentio/Source/Badge/Views/*.xib",
"resource_bundles": {
"Segmentio": "Segmentio/Source/Badge/Views/*.xib"
},
"module_name": "Segmentio",
"requires_arc": true
}

View File

@ -1,16 +1,16 @@
PODS:
- Segmentio (0.1.0)
- Segmentio (1.1.3)
DEPENDENCIES:
- Segmentio (from `../`)
EXTERNAL SOURCES:
Segmentio:
:path: ../
:path: "../"
SPEC CHECKSUMS:
Segmentio: 8a27ead74e53d7617c3130eb511ea4c965b0798f
Segmentio: f784171237bcbb4854f338aef8162e312f4ac5b8
PODFILE CHECKSUM: 191147ab57f909dd239f59b5bebde4bcab89243e
PODFILE CHECKSUM: 761653fe0a6001fe4076ba25b04e279672ecc970
COCOAPODS: 1.0.1
COCOAPODS: 1.1.0.rc.2

View File

@ -7,25 +7,30 @@
objects = {
/* Begin PBXBuildFile section */
08F3ADCD6D2B9007082089826E712007 /* UIView+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F88F99DAA1420A4448E3F028F0C8E7F /* UIView+Appearance.swift */; };
0BC7695D61D9046BFBE6CFD6B47FFFE1 /* Pods-Segmentio_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 556AA0B62BF4398859D56C7F281F05FD /* Pods-Segmentio_Example-dummy.m */; };
124C21C2A8B015C1BB87D30F4EEA0214 /* SegmentioCellWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42697752DA8A65CBAB3CC0BB442A8C6 /* SegmentioCellWithImage.swift */; };
1B164D4FADAAAD401CDAFB8541C7AC00 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; };
386B142514D75786C9544322094E00BB /* Pods-Segmentio_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7F52E8E5326A4E61091A05424A66750B /* Pods-Segmentio_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
5DE5F4B816F4E062B3C9278607C5E632 /* SegmentioCellWithImageUnderLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4EC586E74DCFF8232A11FFEA0592BC /* SegmentioCellWithImageUnderLabel.swift */; };
639A4D6A5BD89BFDD5ED7603F1D18262 /* SegmentioCellWithImageOverLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D491E2303B96AB5AB9AACDBDD0D96BA1 /* SegmentioCellWithImageOverLabel.swift */; };
7535676B6DAAED27C9E51F128BA31498 /* SegmentioOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E1181660922799D84A9AC7A93E4C17 /* SegmentioOptions.swift */; };
8B2E8009B9692DF362678E6FE094A084 /* SegmentioCellWithImageAfterLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89381DA5973AFCAEDD65131B6F801D80 /* SegmentioCellWithImageAfterLabel.swift */; };
8C08B2CAFA57AFB848065BA4E7CA8F27 /* Segmentio-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5720677F504FDAE0BB2FF236B2A89893 /* Segmentio-dummy.m */; };
933D56EF2ECC35F1387B739170AFE07B /* Segmentio-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 588D0BD8821CEBC9689C137D843FA812 /* Segmentio-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
9E50E7327C0F6358FC61855C0205CC8E /* Pods-Segmentio_Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EF8DA8F49FD19F4BD6429F5AA0267180 /* Pods-Segmentio_Tests-dummy.m */; };
0906DB2204F3DA0B929ED2B2FD92C3BE /* SegmentioCellWithImageOverLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71AC7FDBBA82CCF64068DC1436B7C44C /* SegmentioCellWithImageOverLabel.swift */; };
0BC7695D61D9046BFBE6CFD6B47FFFE1 /* Pods-Segmentio_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8758BAC37EDDE6390078CCD596B97C99 /* Pods-Segmentio_Example-dummy.m */; };
0BC8A81C32C10C3EB2DDF82EAD33481D /* SegmentioCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9034CEC1DC6A90954C69B5CF0A879E9D /* SegmentioCell.swift */; };
11E7945679FA0D80B96BC5DA4B1D00D0 /* SegmentioOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1224468BD5929E62BFF27E1C11853D24 /* SegmentioOptions.swift */; };
1E8DCF6AD4051E3F7CFD9B55341DD455 /* Segmentio-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C56AE5AC5779B7D4F6468D2AB474D9E7 /* Segmentio-dummy.m */; };
1F40A33F3F753FF73C5F80F006E14410 /* Segmentio.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2AAAF5E594CC994BE5AD10F8928BC48A /* Segmentio.bundle */; };
20218D2C75E1CA8E41531E94BA06C129 /* SegmentioCellWithImageUnderLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 917595D61BE778C2053B6C375292B042 /* SegmentioCellWithImageUnderLabel.swift */; };
2DA5CD5E23B0E19B8FA2F11146E4A0E5 /* SegmentioCellWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4666D5034926280B3C39CB8CA59319 /* SegmentioCellWithLabel.swift */; };
4E01C978EC149C600FF7658A6757204A /* SegmentioCellWithImageAfterLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564D3D18F6E439E721C7D49AC8379559 /* SegmentioCellWithImageAfterLabel.swift */; };
5BE82675DB7F0C7671EADA9CF99A3C1B /* Segmentio.swift in Sources */ = {isa = PBXBuildFile; fileRef = D91D0C0018887EA8F91F91162FF71F60 /* Segmentio.swift */; };
655C575E9623729978F286F79E4EAEB8 /* BadgeWithCounterViewStandardSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E90ECA263F832D2C77F806A4581AE25 /* BadgeWithCounterViewStandardSized.xib */; };
8F726950BDA00432603D2B6B01881D59 /* BadgeWithCounterViewBigSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = 11C011383E55FDF0C1CFAA8E1E01F52C /* BadgeWithCounterViewBigSized.xib */; };
933D56EF2ECC35F1387B739170AFE07B /* Segmentio-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 80BC1DC599A5ED2C131F4E6D0D020D88 /* Segmentio-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
9EE6B5FE2A8EA2C0612C11D34596B7EB /* BadgeViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3C9CACA5CC49ABD89BB5C0082B56F17 /* BadgeViewPresenter.swift */; };
BC2B9C2A1711F5583A80C1FA7F6F195F /* SegmentioCellWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BF90D3EF6772ECC6F43EF17AAB5C916 /* SegmentioCellWithImage.swift */; };
C1518E27E6C853C813006C349427A4CC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; };
C5C3FE3FCC48A1460787D130DF0CF12E /* Segmentio.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D794DA325FA95310FAD589F0A6A3BC8 /* Segmentio.swift */; };
C3DB5E9DDBA27211C6E8654A363CA0BC /* UIView+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC6E8817CCBFF23555995D47BF0848 /* UIView+Appearance.swift */; };
C4EFEC716055615A27A3D1338426807D /* BadgeWithCounterViewBigSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = 11C011383E55FDF0C1CFAA8E1E01F52C /* BadgeWithCounterViewBigSized.xib */; };
C917381BC4E7C5EFBC2CD2C898C1C8E4 /* SegmentioCellWithImageBeforeLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D84AE8DDC577C7E7499059038BABBC /* SegmentioCellWithImageBeforeLabel.swift */; };
D29DE39BAA26D8E4DA7534F05DFB78F4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; };
DC7CDA37564D49D1443EFF857FB8B794 /* SegmentioCellWithImageBeforeLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08337E1EFCACB5981A6FB8F0A5F1D05D /* SegmentioCellWithImageBeforeLabel.swift */; };
E0F68CB059B49448534FFDCF5267CCD0 /* SegmentioCellWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C30B1407F4DECA9198B795A4C2F8942 /* SegmentioCellWithLabel.swift */; };
E15160B05BBD4763B9DD87EAFA105B3B /* SegmentioCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0CCCB5EF6793D4D584AEF64499C9CC /* SegmentioCell.swift */; };
EA89BD32CAE3C825C749261B9D4A2031 /* Pods-Segmentio_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 401FE729B830FF723B647781804D1F85 /* Pods-Segmentio_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
D9EBCEA1512D4B307726BFEB5F29EF70 /* BadgeWithCounterViewStandardSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E90ECA263F832D2C77F806A4581AE25 /* BadgeWithCounterViewStandardSized.xib */; };
E6E0179AF8247CB20CB77A1E33C88C7F /* RoundImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A561B2B4C70B40E0E028301D454D3EBF /* RoundImageView.swift */; };
EA89BD32CAE3C825C749261B9D4A2031 /* Pods-Segmentio_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = FCCE72372A4C77BEF387923951E588F2 /* Pods-Segmentio_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
F6814CD90D68BE2911E97CE7F62E5DA1 /* BadgeWithCounterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BE9AEFB42AAAC25501C181FF72B653 /* BadgeWithCounterView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -36,58 +41,60 @@
remoteGlobalIDString = D69CC732EFB91EE42BE73E5030BD387C;
remoteInfo = Segmentio;
};
B485C2D39BE98A2AA0F4993CC65D306C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */;
proxyType = 1;
remoteGlobalIDString = D8AEF8C76AD2A8E5BDCDA4CC1BD107B6;
remoteInfo = "Segmentio-Segmentio";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
08337E1EFCACB5981A6FB8F0A5F1D05D /* SegmentioCellWithImageBeforeLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageBeforeLabel.swift; sourceTree = "<group>"; };
0C30B1407F4DECA9198B795A4C2F8942 /* SegmentioCellWithLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithLabel.swift; sourceTree = "<group>"; };
0F88F99DAA1420A4448E3F028F0C8E7F /* UIView+Appearance.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "UIView+Appearance.swift"; sourceTree = "<group>"; };
16922E380BC9D1F07E81271A1F0B9F27 /* Pods-Segmentio_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Tests-frameworks.sh"; sourceTree = "<group>"; };
268A02043997F7B259BA6A6642A97BFB /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2C6B3BD660EA40765EA46F0735002B06 /* Pods_Segmentio_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Segmentio_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
401FE729B830FF723B647781804D1F85 /* Pods-Segmentio_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Segmentio_Example-umbrella.h"; sourceTree = "<group>"; };
419FF94288A2110D00FAA1CE571FE9FC /* Pods-Segmentio_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Example-frameworks.sh"; sourceTree = "<group>"; };
4938DA306399C05E56EDBA62544340BE /* Pods-Segmentio_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Tests.debug.xcconfig"; sourceTree = "<group>"; };
556AA0B62BF4398859D56C7F281F05FD /* Pods-Segmentio_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Segmentio_Example-dummy.m"; sourceTree = "<group>"; };
5720677F504FDAE0BB2FF236B2A89893 /* Segmentio-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Segmentio-dummy.m"; sourceTree = "<group>"; };
588D0BD8821CEBC9689C137D843FA812 /* Segmentio-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Segmentio-umbrella.h"; sourceTree = "<group>"; };
5F0CCCB5EF6793D4D584AEF64499C9CC /* SegmentioCell.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCell.swift; sourceTree = "<group>"; };
658964FCFD27351CDFF8EBE97B8459B6 /* Pods-Segmentio_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Segmentio_Tests.modulemap"; sourceTree = "<group>"; };
67714CDF4FF7EE5C90A0F1AB1AAAD011 /* Pods-Segmentio_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Example.release.xcconfig"; sourceTree = "<group>"; };
7400982A0FA63A0BBCEAC3AC177EAD2E /* Segmentio-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Segmentio-prefix.pch"; sourceTree = "<group>"; };
78A7E87C7803313F0A7310B468DFFCEA /* Segmentio.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Segmentio.xcconfig; sourceTree = "<group>"; };
7F52E8E5326A4E61091A05424A66750B /* Pods-Segmentio_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Segmentio_Tests-umbrella.h"; sourceTree = "<group>"; };
89381DA5973AFCAEDD65131B6F801D80 /* SegmentioCellWithImageAfterLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageAfterLabel.swift; sourceTree = "<group>"; };
8D794DA325FA95310FAD589F0A6A3BC8 /* Segmentio.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Segmentio.swift; sourceTree = "<group>"; };
052C95F5D6DA625FB41DB8135B2A4DE1 /* Pods-Segmentio_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Example-frameworks.sh"; sourceTree = "<group>"; };
11C011383E55FDF0C1CFAA8E1E01F52C /* BadgeWithCounterViewBigSized.xib */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file.xib; path = BadgeWithCounterViewBigSized.xib; sourceTree = "<group>"; };
1224468BD5929E62BFF27E1C11853D24 /* SegmentioOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioOptions.swift; sourceTree = "<group>"; };
1BF90D3EF6772ECC6F43EF17AAB5C916 /* SegmentioCellWithImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImage.swift; sourceTree = "<group>"; };
2AAAF5E594CC994BE5AD10F8928BC48A /* Segmentio.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Segmentio.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
37602088D7DDBEBF54BCE7CAF18CB105 /* Pods-Segmentio_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Example.debug.xcconfig"; sourceTree = "<group>"; };
38BC6E8817CCBFF23555995D47BF0848 /* UIView+Appearance.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "UIView+Appearance.swift"; sourceTree = "<group>"; };
39CC3133DEC50AE996B30883B4A76CFC /* Segmentio-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Segmentio-prefix.pch"; sourceTree = "<group>"; };
428DB76E87B8795FDAD056914F0EB8BD /* Pods-Segmentio_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Segmentio_Example-acknowledgements.markdown"; sourceTree = "<group>"; };
4DA45A534C62C7379DB6EF50F3B4DBFA /* Segmentio.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Segmentio.modulemap; sourceTree = "<group>"; };
5152D5684BA571B16D3CBB78B9F81B75 /* Pods-Segmentio_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Segmentio_Example-acknowledgements.plist"; sourceTree = "<group>"; };
564D3D18F6E439E721C7D49AC8379559 /* SegmentioCellWithImageAfterLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageAfterLabel.swift; sourceTree = "<group>"; };
56D84AE8DDC577C7E7499059038BABBC /* SegmentioCellWithImageBeforeLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageBeforeLabel.swift; sourceTree = "<group>"; };
5D4E8D49DE85EE73865F0FFAE93ACDA8 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
64BE9AEFB42AAAC25501C181FF72B653 /* BadgeWithCounterView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BadgeWithCounterView.swift; sourceTree = "<group>"; };
6A4666D5034926280B3C39CB8CA59319 /* SegmentioCellWithLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithLabel.swift; sourceTree = "<group>"; };
6E90ECA263F832D2C77F806A4581AE25 /* BadgeWithCounterViewStandardSized.xib */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file.xib; path = BadgeWithCounterViewStandardSized.xib; sourceTree = "<group>"; };
71AC7FDBBA82CCF64068DC1436B7C44C /* SegmentioCellWithImageOverLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageOverLabel.swift; sourceTree = "<group>"; };
808E8A2F66FEF9BFA423C8B51FEB3FD3 /* Pods-Segmentio_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Example.release.xcconfig"; sourceTree = "<group>"; };
80BC1DC599A5ED2C131F4E6D0D020D88 /* Segmentio-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Segmentio-umbrella.h"; sourceTree = "<group>"; };
8758BAC37EDDE6390078CCD596B97C99 /* Pods-Segmentio_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Segmentio_Example-dummy.m"; sourceTree = "<group>"; };
9034CEC1DC6A90954C69B5CF0A879E9D /* SegmentioCell.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCell.swift; sourceTree = "<group>"; };
917595D61BE778C2053B6C375292B042 /* SegmentioCellWithImageUnderLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageUnderLabel.swift; sourceTree = "<group>"; };
93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
982EB7C450661AE87828BC4011C51E5B /* Pods-Segmentio_Tests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Segmentio_Tests-acknowledgements.plist"; sourceTree = "<group>"; };
9E0F52B6EE035F8DC32250C8800B6878 /* Pods_Segmentio_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Segmentio_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9E292B4C29D95C54CEC5B8BC3C6C9189 /* Pods-Segmentio_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Example-resources.sh"; sourceTree = "<group>"; };
A0A2FACDEADFA4A30C47F0C37BCE0211 /* Pods-Segmentio_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Segmentio_Tests-acknowledgements.markdown"; sourceTree = "<group>"; };
ADC48C4E9F258114BD508838EF31778D /* Pods-Segmentio_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Segmentio_Example-acknowledgements.plist"; sourceTree = "<group>"; };
AF767C5305A74E237D044DB939285A7E /* Pods-Segmentio_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Tests.release.xcconfig"; sourceTree = "<group>"; };
C332BBDBF329D75B42E3D4DFBC367750 /* Segmentio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Segmentio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D06B7FD5EDA771583A3CF08D0F68DE9 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A561B2B4C70B40E0E028301D454D3EBF /* RoundImageView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = RoundImageView.swift; sourceTree = "<group>"; };
AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Segmentio.xcconfig; sourceTree = "<group>"; };
AE666A58F4294719B8B89D33423889C4 /* Pods-Segmentio_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Example-resources.sh"; sourceTree = "<group>"; };
B07FA81FE6C58F8096D157CF2D32550A /* Pods_Segmentio_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Segmentio_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B2527411739A24C97909490FC5C54F10 /* Pods-Segmentio_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Segmentio_Example.modulemap"; sourceTree = "<group>"; };
B5ED1F4A55A82441D24099184B5077B5 /* ResourceBundle-Segmentio-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-Segmentio-Info.plist"; sourceTree = "<group>"; };
C373AAC9C68346B42AC567AD943825F7 /* Segmentio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Segmentio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C56AE5AC5779B7D4F6468D2AB474D9E7 /* Segmentio-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Segmentio-dummy.m"; sourceTree = "<group>"; };
CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
D173F1BEABAEE16C03D2454763755F7F /* Pods-Segmentio_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Segmentio_Tests-resources.sh"; sourceTree = "<group>"; };
D39DD292AD471BA3FE7A27E198143BD8 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D491E2303B96AB5AB9AACDBDD0D96BA1 /* SegmentioCellWithImageOverLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageOverLabel.swift; sourceTree = "<group>"; };
DC4EC586E74DCFF8232A11FFEA0592BC /* SegmentioCellWithImageUnderLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImageUnderLabel.swift; sourceTree = "<group>"; };
E1E1181660922799D84A9AC7A93E4C17 /* SegmentioOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioOptions.swift; sourceTree = "<group>"; };
ED9CA87F92ABA496B1E37F56B1948C95 /* Pods-Segmentio_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Segmentio_Example.modulemap"; sourceTree = "<group>"; };
EF8DA8F49FD19F4BD6429F5AA0267180 /* Pods-Segmentio_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Segmentio_Tests-dummy.m"; sourceTree = "<group>"; };
F14C0898393B1E9176017283D91269D8 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F19F298463BD01E9E89AB6CF25EA81A5 /* Pods-Segmentio_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Segmentio_Example.debug.xcconfig"; sourceTree = "<group>"; };
F3B2A210AED19F381858EA69A5588808 /* Segmentio.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Segmentio.modulemap; sourceTree = "<group>"; };
F42697752DA8A65CBAB3CC0BB442A8C6 /* SegmentioCellWithImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SegmentioCellWithImage.swift; sourceTree = "<group>"; };
F4C7373D0CC433083738F6FFB0808DDD /* Pods-Segmentio_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Segmentio_Example-acknowledgements.markdown"; sourceTree = "<group>"; };
D91D0C0018887EA8F91F91162FF71F60 /* Segmentio.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Segmentio.swift; sourceTree = "<group>"; };
E3C9CACA5CC49ABD89BB5C0082B56F17 /* BadgeViewPresenter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BadgeViewPresenter.swift; sourceTree = "<group>"; };
FCCE72372A4C77BEF387923951E588F2 /* Pods-Segmentio_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Segmentio_Example-umbrella.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
99B28BB930C96B4D06CABF8D3B8832D5 /* Frameworks */ = {
CF0100512E0E927F05DB406E0E01DF38 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1B164D4FADAAAD401CDAFB8541C7AC00 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -110,25 +117,42 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
262CA74000605615391CA6EC4293E986 /* Segmentio */ = {
00A2FBBF1263542044856398E75BAA76 /* Extensions */ = {
isa = PBXGroup;
children = (
E3C287FD31CE5425024C393185997E3E /* Segmentio */,
B301CE3581EA441B88CE7A4817B8D17E /* Support Files */,
A561B2B4C70B40E0E028301D454D3EBF /* RoundImageView.swift */,
38BC6E8817CCBFF23555995D47BF0848 /* UIView+Appearance.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
093352DB8919FB70FCBB908FAD994FCF /* Resources */ = {
isa = PBXGroup;
children = (
D99857A2684E0E97D1E32D0B130B5366 /* Segmentio */,
);
name = Resources;
sourceTree = "<group>";
};
1C2ABA084F34F1E71EB56C0EA2DD4699 /* Badge */ = {
isa = PBXGroup;
children = (
C65C2B1DCC149D19571A5F7FAE3D31AF /* Views */,
);
path = Badge;
sourceTree = "<group>";
};
31B6F91EE13CA09F760DFFB67BF7137A /* Segmentio */ = {
isa = PBXGroup;
children = (
093352DB8919FB70FCBB908FAD994FCF /* Resources */,
AF8947D7DBED0C96C3826FC2B0ED8A3A /* Segmentio */,
413F9187DDE34CC36B0E06866BC84500 /* Support Files */,
);
name = Segmentio;
path = ../..;
sourceTree = "<group>";
};
31FE64FF9D2E3D0D88D47DB5DEFE398A /* Targets Support Files */ = {
isa = PBXGroup;
children = (
545652130C56132D6876397F52E283C4 /* Pods-Segmentio_Example */,
9FD684E4FD33C116E64DE188DB108EB9 /* Pods-Segmentio_Tests */,
);
name = "Targets Support Files";
sourceTree = "<group>";
};
3DCAB2B7CDE207B3958B6CB957FCC758 /* iOS */ = {
isa = PBXGroup;
children = (
@ -137,60 +161,65 @@
name = iOS;
sourceTree = "<group>";
};
47DD221E11AD5E3ABBE22D1B01521963 /* Extensions */ = {
413F9187DDE34CC36B0E06866BC84500 /* Support Files */ = {
isa = PBXGroup;
children = (
0F88F99DAA1420A4448E3F028F0C8E7F /* UIView+Appearance.swift */,
5D4E8D49DE85EE73865F0FFAE93ACDA8 /* Info.plist */,
B5ED1F4A55A82441D24099184B5077B5 /* ResourceBundle-Segmentio-Info.plist */,
4DA45A534C62C7379DB6EF50F3B4DBFA /* Segmentio.modulemap */,
AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */,
C56AE5AC5779B7D4F6468D2AB474D9E7 /* Segmentio-dummy.m */,
39CC3133DEC50AE996B30883B4A76CFC /* Segmentio-prefix.pch */,
80BC1DC599A5ED2C131F4E6D0D020D88 /* Segmentio-umbrella.h */,
);
path = Extensions;
name = "Support Files";
path = "Example/Pods/Target Support Files/Segmentio";
sourceTree = "<group>";
};
545652130C56132D6876397F52E283C4 /* Pods-Segmentio_Example */ = {
635B6B346CBAAB1DB0593E0D25A25ED9 /* Views */ = {
isa = PBXGroup;
children = (
268A02043997F7B259BA6A6642A97BFB /* Info.plist */,
ED9CA87F92ABA496B1E37F56B1948C95 /* Pods-Segmentio_Example.modulemap */,
F4C7373D0CC433083738F6FFB0808DDD /* Pods-Segmentio_Example-acknowledgements.markdown */,
ADC48C4E9F258114BD508838EF31778D /* Pods-Segmentio_Example-acknowledgements.plist */,
556AA0B62BF4398859D56C7F281F05FD /* Pods-Segmentio_Example-dummy.m */,
419FF94288A2110D00FAA1CE571FE9FC /* Pods-Segmentio_Example-frameworks.sh */,
9E292B4C29D95C54CEC5B8BC3C6C9189 /* Pods-Segmentio_Example-resources.sh */,
401FE729B830FF723B647781804D1F85 /* Pods-Segmentio_Example-umbrella.h */,
F19F298463BD01E9E89AB6CF25EA81A5 /* Pods-Segmentio_Example.debug.xcconfig */,
67714CDF4FF7EE5C90A0F1AB1AAAD011 /* Pods-Segmentio_Example.release.xcconfig */,
64BE9AEFB42AAAC25501C181FF72B653 /* BadgeWithCounterView.swift */,
);
path = Views;
sourceTree = "<group>";
};
6706DE9909DD65117E2381108D4EC33E /* Pods-Segmentio_Example */ = {
isa = PBXGroup;
children = (
9D06B7FD5EDA771583A3CF08D0F68DE9 /* Info.plist */,
B2527411739A24C97909490FC5C54F10 /* Pods-Segmentio_Example.modulemap */,
428DB76E87B8795FDAD056914F0EB8BD /* Pods-Segmentio_Example-acknowledgements.markdown */,
5152D5684BA571B16D3CBB78B9F81B75 /* Pods-Segmentio_Example-acknowledgements.plist */,
8758BAC37EDDE6390078CCD596B97C99 /* Pods-Segmentio_Example-dummy.m */,
052C95F5D6DA625FB41DB8135B2A4DE1 /* Pods-Segmentio_Example-frameworks.sh */,
AE666A58F4294719B8B89D33423889C4 /* Pods-Segmentio_Example-resources.sh */,
FCCE72372A4C77BEF387923951E588F2 /* Pods-Segmentio_Example-umbrella.h */,
37602088D7DDBEBF54BCE7CAF18CB105 /* Pods-Segmentio_Example.debug.xcconfig */,
808E8A2F66FEF9BFA423C8B51FEB3FD3 /* Pods-Segmentio_Example.release.xcconfig */,
);
name = "Pods-Segmentio_Example";
path = "Target Support Files/Pods-Segmentio_Example";
sourceTree = "<group>";
};
5938CEA6F620530E483550DA66B62AC9 /* Products */ = {
6D3F4095995BEF98F4DD0129A4F3C3E6 /* Development Pods */ = {
isa = PBXGroup;
children = (
9E0F52B6EE035F8DC32250C8800B6878 /* Pods_Segmentio_Example.framework */,
2C6B3BD660EA40765EA46F0735002B06 /* Pods_Segmentio_Tests.framework */,
C332BBDBF329D75B42E3D4DFBC367750 /* Segmentio.framework */,
);
name = Products;
sourceTree = "<group>";
};
5F203D3D23230D83E76F47D6F1912013 /* Development Pods */ = {
isa = PBXGroup;
children = (
262CA74000605615391CA6EC4293E986 /* Segmentio */,
31B6F91EE13CA09F760DFFB67BF7137A /* Segmentio */,
);
name = "Development Pods";
sourceTree = "<group>";
};
6A17966A17091F11F4DC34B63A2A4ED4 /* Cells */ = {
71680BC21E0B1ABC000B38795FC22CBC /* Cells */ = {
isa = PBXGroup;
children = (
5F0CCCB5EF6793D4D584AEF64499C9CC /* SegmentioCell.swift */,
F42697752DA8A65CBAB3CC0BB442A8C6 /* SegmentioCellWithImage.swift */,
89381DA5973AFCAEDD65131B6F801D80 /* SegmentioCellWithImageAfterLabel.swift */,
08337E1EFCACB5981A6FB8F0A5F1D05D /* SegmentioCellWithImageBeforeLabel.swift */,
D491E2303B96AB5AB9AACDBDD0D96BA1 /* SegmentioCellWithImageOverLabel.swift */,
DC4EC586E74DCFF8232A11FFEA0592BC /* SegmentioCellWithImageUnderLabel.swift */,
0C30B1407F4DECA9198B795A4C2F8942 /* SegmentioCellWithLabel.swift */,
9034CEC1DC6A90954C69B5CF0A879E9D /* SegmentioCell.swift */,
1BF90D3EF6772ECC6F43EF17AAB5C916 /* SegmentioCellWithImage.swift */,
564D3D18F6E439E721C7D49AC8379559 /* SegmentioCellWithImageAfterLabel.swift */,
56D84AE8DDC577C7E7499059038BABBC /* SegmentioCellWithImageBeforeLabel.swift */,
71AC7FDBBA82CCF64068DC1436B7C44C /* SegmentioCellWithImageOverLabel.swift */,
917595D61BE778C2053B6C375292B042 /* SegmentioCellWithImageUnderLabel.swift */,
6A4666D5034926280B3C39CB8CA59319 /* SegmentioCellWithLabel.swift */,
);
path = Cells;
sourceTree = "<group>";
@ -199,43 +228,39 @@
isa = PBXGroup;
children = (
93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */,
5F203D3D23230D83E76F47D6F1912013 /* Development Pods */,
6D3F4095995BEF98F4DD0129A4F3C3E6 /* Development Pods */,
BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */,
5938CEA6F620530E483550DA66B62AC9 /* Products */,
31FE64FF9D2E3D0D88D47DB5DEFE398A /* Targets Support Files */,
CA35ACABAF7AD76B04DF424D7DFFDD0A /* Products */,
8AFABA1177FBDA07E425A37E906123B5 /* Targets Support Files */,
);
sourceTree = "<group>";
};
9FD684E4FD33C116E64DE188DB108EB9 /* Pods-Segmentio_Tests */ = {
8AFABA1177FBDA07E425A37E906123B5 /* Targets Support Files */ = {
isa = PBXGroup;
children = (
F14C0898393B1E9176017283D91269D8 /* Info.plist */,
658964FCFD27351CDFF8EBE97B8459B6 /* Pods-Segmentio_Tests.modulemap */,
A0A2FACDEADFA4A30C47F0C37BCE0211 /* Pods-Segmentio_Tests-acknowledgements.markdown */,
982EB7C450661AE87828BC4011C51E5B /* Pods-Segmentio_Tests-acknowledgements.plist */,
EF8DA8F49FD19F4BD6429F5AA0267180 /* Pods-Segmentio_Tests-dummy.m */,
16922E380BC9D1F07E81271A1F0B9F27 /* Pods-Segmentio_Tests-frameworks.sh */,
D173F1BEABAEE16C03D2454763755F7F /* Pods-Segmentio_Tests-resources.sh */,
7F52E8E5326A4E61091A05424A66750B /* Pods-Segmentio_Tests-umbrella.h */,
4938DA306399C05E56EDBA62544340BE /* Pods-Segmentio_Tests.debug.xcconfig */,
AF767C5305A74E237D044DB939285A7E /* Pods-Segmentio_Tests.release.xcconfig */,
6706DE9909DD65117E2381108D4EC33E /* Pods-Segmentio_Example */,
);
name = "Pods-Segmentio_Tests";
path = "Target Support Files/Pods-Segmentio_Tests";
name = "Targets Support Files";
sourceTree = "<group>";
};
B301CE3581EA441B88CE7A4817B8D17E /* Support Files */ = {
A4FF14891748501365A9790ED2BDF024 /* Source */ = {
isa = PBXGroup;
children = (
D39DD292AD471BA3FE7A27E198143BD8 /* Info.plist */,
F3B2A210AED19F381858EA69A5588808 /* Segmentio.modulemap */,
78A7E87C7803313F0A7310B468DFFCEA /* Segmentio.xcconfig */,
5720677F504FDAE0BB2FF236B2A89893 /* Segmentio-dummy.m */,
7400982A0FA63A0BBCEAC3AC177EAD2E /* Segmentio-prefix.pch */,
588D0BD8821CEBC9689C137D843FA812 /* Segmentio-umbrella.h */,
D91D0C0018887EA8F91F91162FF71F60 /* Segmentio.swift */,
1224468BD5929E62BFF27E1C11853D24 /* SegmentioOptions.swift */,
C9D021905A86A0FDCE4747A23BF6ADE4 /* Badge */,
71680BC21E0B1ABC000B38795FC22CBC /* Cells */,
00A2FBBF1263542044856398E75BAA76 /* Extensions */,
);
name = "Support Files";
path = "Example/Pods/Target Support Files/Segmentio";
path = Source;
sourceTree = "<group>";
};
AF8947D7DBED0C96C3826FC2B0ED8A3A /* Segmentio */ = {
isa = PBXGroup;
children = (
A4FF14891748501365A9790ED2BDF024 /* Source */,
);
path = Segmentio;
sourceTree = "<group>";
};
BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = {
@ -246,21 +271,46 @@
name = Frameworks;
sourceTree = "<group>";
};
E3C287FD31CE5425024C393185997E3E /* Segmentio */ = {
C65C2B1DCC149D19571A5F7FAE3D31AF /* Views */ = {
isa = PBXGroup;
children = (
E7168896F6A0EF9FBB759CB16C1ED3C5 /* Source */,
11C011383E55FDF0C1CFAA8E1E01F52C /* BadgeWithCounterViewBigSized.xib */,
6E90ECA263F832D2C77F806A4581AE25 /* BadgeWithCounterViewStandardSized.xib */,
);
path = Views;
sourceTree = "<group>";
};
C9D021905A86A0FDCE4747A23BF6ADE4 /* Badge */ = {
isa = PBXGroup;
children = (
E3C9CACA5CC49ABD89BB5C0082B56F17 /* BadgeViewPresenter.swift */,
635B6B346CBAAB1DB0593E0D25A25ED9 /* Views */,
);
path = Badge;
sourceTree = "<group>";
};
CA35ACABAF7AD76B04DF424D7DFFDD0A /* Products */ = {
isa = PBXGroup;
children = (
B07FA81FE6C58F8096D157CF2D32550A /* Pods_Segmentio_Example.framework */,
2AAAF5E594CC994BE5AD10F8928BC48A /* Segmentio.bundle */,
C373AAC9C68346B42AC567AD943825F7 /* Segmentio.framework */,
);
name = Products;
sourceTree = "<group>";
};
D99857A2684E0E97D1E32D0B130B5366 /* Segmentio */ = {
isa = PBXGroup;
children = (
F1249F9ED37CBEF49B81DE98EA2709C1 /* Source */,
);
path = Segmentio;
sourceTree = "<group>";
};
E7168896F6A0EF9FBB759CB16C1ED3C5 /* Source */ = {
F1249F9ED37CBEF49B81DE98EA2709C1 /* Source */ = {
isa = PBXGroup;
children = (
8D794DA325FA95310FAD589F0A6A3BC8 /* Segmentio.swift */,
E1E1181660922799D84A9AC7A93E4C17 /* SegmentioOptions.swift */,
6A17966A17091F11F4DC34B63A2A4ED4 /* Cells */,
47DD221E11AD5E3ABBE22D1B01521963 /* Extensions */,
1C2ABA084F34F1E71EB56C0EA2DD4699 /* Badge */,
);
path = Source;
sourceTree = "<group>";
@ -268,14 +318,6 @@
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
1CABCEA6C1BC88EB07B535ECF534A9AD /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
386B142514D75786C9544322094E00BB /* Pods-Segmentio_Tests-umbrella.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5ADAE197C16A9C5A10D0C5F779D181D8 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@ -310,42 +352,44 @@
);
name = "Pods-Segmentio_Example";
productName = "Pods-Segmentio_Example";
productReference = 9E0F52B6EE035F8DC32250C8800B6878 /* Pods_Segmentio_Example.framework */;
productReference = B07FA81FE6C58F8096D157CF2D32550A /* Pods_Segmentio_Example.framework */;
productType = "com.apple.product-type.framework";
};
D69CC732EFB91EE42BE73E5030BD387C /* Segmentio */ = {
isa = PBXNativeTarget;
buildConfigurationList = 785D3215E776BE829EB1D98F89F1A8C1 /* Build configuration list for PBXNativeTarget "Segmentio" */;
buildPhases = (
BF3D1C157A9652275CB130825D8E7120 /* Sources */,
F9B7581237D6E81DE197B72773B36420 /* Sources */,
FD59EF5B4845512C0FE01CF908756FB5 /* Frameworks */,
F167B0867D416B414A778DE5486644A6 /* Resources */,
5ADAE197C16A9C5A10D0C5F779D181D8 /* Headers */,
);
buildRules = (
);
dependencies = (
7EE0160D6232AE6A93308C253B5E48D6 /* PBXTargetDependency */,
);
name = Segmentio;
productName = Segmentio;
productReference = C332BBDBF329D75B42E3D4DFBC367750 /* Segmentio.framework */;
productReference = C373AAC9C68346B42AC567AD943825F7 /* Segmentio.framework */;
productType = "com.apple.product-type.framework";
};
E4CEDB3D980134198684315F99D1F345 /* Pods-Segmentio_Tests */ = {
D8AEF8C76AD2A8E5BDCDA4CC1BD107B6 /* Segmentio-Segmentio */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1796B5A3A489231D28C16CDA0DBD7F52 /* Build configuration list for PBXNativeTarget "Pods-Segmentio_Tests" */;
buildConfigurationList = BD0B4F1676768CCD5A8C4B0E5B53427F /* Build configuration list for PBXNativeTarget "Segmentio-Segmentio" */;
buildPhases = (
A579A79AB96EA13266CB18A28A23753F /* Sources */,
99B28BB930C96B4D06CABF8D3B8832D5 /* Frameworks */,
1CABCEA6C1BC88EB07B535ECF534A9AD /* Headers */,
BECDA7466A3F2048BD0D16982C6C441A /* Sources */,
CF0100512E0E927F05DB406E0E01DF38 /* Frameworks */,
2DA0271DF525DE03AD9084DEC244781A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Pods-Segmentio_Tests";
productName = "Pods-Segmentio_Tests";
productReference = 2C6B3BD660EA40765EA46F0735002B06 /* Pods_Segmentio_Tests.framework */;
productType = "com.apple.product-type.framework";
name = "Segmentio-Segmentio";
productName = "Segmentio-Segmentio";
productReference = 2AAAF5E594CC994BE5AD10F8928BC48A /* Segmentio.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
@ -364,17 +408,39 @@
en,
);
mainGroup = 7DB346D0F39D3F0E887471402A8071AB;
productRefGroup = 5938CEA6F620530E483550DA66B62AC9 /* Products */;
productRefGroup = CA35ACABAF7AD76B04DF424D7DFFDD0A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
1773C65AAC9F8837BB8142660D7320E0 /* Pods-Segmentio_Example */,
E4CEDB3D980134198684315F99D1F345 /* Pods-Segmentio_Tests */,
D69CC732EFB91EE42BE73E5030BD387C /* Segmentio */,
D8AEF8C76AD2A8E5BDCDA4CC1BD107B6 /* Segmentio-Segmentio */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
2DA0271DF525DE03AD9084DEC244781A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8F726950BDA00432603D2B6B01881D59 /* BadgeWithCounterViewBigSized.xib in Resources */,
655C575E9623729978F286F79E4EAEB8 /* BadgeWithCounterViewStandardSized.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F167B0867D416B414A778DE5486644A6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C4EFEC716055615A27A3D1338426807D /* BadgeWithCounterViewBigSized.xib in Resources */,
D9EBCEA1512D4B307726BFEB5F29EF70 /* BadgeWithCounterViewStandardSized.xib in Resources */,
1F40A33F3F753FF73C5F80F006E14410 /* Segmentio.bundle in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5B2B601769FDD1B81F6ECD3FBC7CAF20 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@ -384,35 +450,43 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A579A79AB96EA13266CB18A28A23753F /* Sources */ = {
BECDA7466A3F2048BD0D16982C6C441A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9E50E7327C0F6358FC61855C0205CC8E /* Pods-Segmentio_Tests-dummy.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BF3D1C157A9652275CB130825D8E7120 /* Sources */ = {
F9B7581237D6E81DE197B72773B36420 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8C08B2CAFA57AFB848065BA4E7CA8F27 /* Segmentio-dummy.m in Sources */,
C5C3FE3FCC48A1460787D130DF0CF12E /* Segmentio.swift in Sources */,
7535676B6DAAED27C9E51F128BA31498 /* SegmentioOptions.swift in Sources */,
08F3ADCD6D2B9007082089826E712007 /* UIView+Appearance.swift in Sources */,
E15160B05BBD4763B9DD87EAFA105B3B /* SegmentioCell.swift in Sources */,
124C21C2A8B015C1BB87D30F4EEA0214 /* SegmentioCellWithImage.swift in Sources */,
8B2E8009B9692DF362678E6FE094A084 /* SegmentioCellWithImageAfterLabel.swift in Sources */,
DC7CDA37564D49D1443EFF857FB8B794 /* SegmentioCellWithImageBeforeLabel.swift in Sources */,
639A4D6A5BD89BFDD5ED7603F1D18262 /* SegmentioCellWithImageOverLabel.swift in Sources */,
5DE5F4B816F4E062B3C9278607C5E632 /* SegmentioCellWithImageUnderLabel.swift in Sources */,
E0F68CB059B49448534FFDCF5267CCD0 /* SegmentioCellWithLabel.swift in Sources */,
9EE6B5FE2A8EA2C0612C11D34596B7EB /* BadgeViewPresenter.swift in Sources */,
F6814CD90D68BE2911E97CE7F62E5DA1 /* BadgeWithCounterView.swift in Sources */,
E6E0179AF8247CB20CB77A1E33C88C7F /* RoundImageView.swift in Sources */,
1E8DCF6AD4051E3F7CFD9B55341DD455 /* Segmentio-dummy.m in Sources */,
5BE82675DB7F0C7671EADA9CF99A3C1B /* Segmentio.swift in Sources */,
0BC8A81C32C10C3EB2DDF82EAD33481D /* SegmentioCell.swift in Sources */,
BC2B9C2A1711F5583A80C1FA7F6F195F /* SegmentioCellWithImage.swift in Sources */,
4E01C978EC149C600FF7658A6757204A /* SegmentioCellWithImageAfterLabel.swift in Sources */,
C917381BC4E7C5EFBC2CD2C898C1C8E4 /* SegmentioCellWithImageBeforeLabel.swift in Sources */,
0906DB2204F3DA0B929ED2B2FD92C3BE /* SegmentioCellWithImageOverLabel.swift in Sources */,
20218D2C75E1CA8E41531E94BA06C129 /* SegmentioCellWithImageUnderLabel.swift in Sources */,
2DA5CD5E23B0E19B8FA2F11146E4A0E5 /* SegmentioCellWithLabel.swift in Sources */,
11E7945679FA0D80B96BC5DA4B1D00D0 /* SegmentioOptions.swift in Sources */,
C3DB5E9DDBA27211C6E8654A363CA0BC /* UIView+Appearance.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
7EE0160D6232AE6A93308C253B5E48D6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "Segmentio-Segmentio";
target = D8AEF8C76AD2A8E5BDCDA4CC1BD107B6 /* Segmentio-Segmentio */;
targetProxy = B485C2D39BE98A2AA0F4993CC65D306C /* PBXContainerItemProxy */;
};
D49BEB0E5AAF16F8BE48EA55C820C1A4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Segmentio;
@ -422,40 +496,7 @@
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
34F3882D28F8CE61245C5A12E47EE64E /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4938DA306399C05E56EDBA62544340BE /* Pods-Segmentio_Tests.debug.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Tests/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Tests/Pods-Segmentio_Tests.modulemap";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Tests;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
47BEF9D903506B003EA5C2B249729489 /* Debug */ = {
015A368F878AC3E2CEAE21DDE8026304 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@ -473,6 +514,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -492,112 +534,13 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/;
STRIP_INSTALLED_PRODUCT = NO;
SYMROOT = "${SRCROOT}/../build";
};
name = Debug;
};
6A27E340E24D615063AB597774F259B4 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AF767C5305A74E237D044DB939285A7E /* Pods-Segmentio_Tests.release.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Tests/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Tests/Pods-Segmentio_Tests.modulemap";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Tests;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
6A88DE4855BF46A99DED1138AC50611B /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = F19F298463BD01E9E89AB6CF25EA81A5 /* Pods-Segmentio_Example.debug.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Example/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Example/Pods-Segmentio_Example.modulemap";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Example;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
847944553F66C9C9C8CF5EA5A12838E5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 67714CDF4FF7EE5C90A0F1AB1AAAD011 /* Pods-Segmentio_Example.release.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Example/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Example/Pods-Segmentio_Example.modulemap";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Example;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
AAF678CED40D3499169D10F63CA0719E /* Release */ = {
44CDBB6D11DE06DB64D6268622BDC47E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@ -615,6 +558,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -629,17 +573,20 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/;
STRIP_INSTALLED_PRODUCT = NO;
SYMROOT = "${SRCROOT}/../build";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
B54261FEDDC960542CA187AA5E14BC7D /* Debug */ = {
6939D89BCF3CB71D8A0CB554AEAC1779 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 78A7E87C7803313F0A7310B468DFFCEA /* Segmentio.xcconfig */;
baseConfigurationReference = AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
@ -659,17 +606,125 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
F03A1D5CC9DD916A3B05610779B9C8F0 /* Release */ = {
69F41B3AE04E5DCE90065CD8E029712C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 78A7E87C7803313F0A7310B468DFFCEA /* Segmentio.xcconfig */;
baseConfigurationReference = 808E8A2F66FEF9BFA423C8B51FEB3FD3 /* Pods-Segmentio_Example.release.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Example/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Example/Pods-Segmentio_Example.modulemap";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Example;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
A6D8F8AC9425BACBC3621CFD7597790C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */;
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Segmentio";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Segmentio/ResourceBundle-Segmentio-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = Segmentio;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = bundle;
};
name = Debug;
};
B39C8A659F54F5D7007A70CE400454EA /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */;
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Segmentio";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Segmentio/ResourceBundle-Segmentio-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = Segmentio;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
BF58FEE71132386297AFD4D409190547 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 37602088D7DDBEBF54BCE7CAF18CB105 /* Pods-Segmentio_Example.debug.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Target Support Files/Pods-Segmentio_Example/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
MODULEMAP_FILE = "Target Support Files/Pods-Segmentio_Example/Pods-Segmentio_Example.modulemap";
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
PODS_ROOT = "$(SRCROOT)";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = Pods_Segmentio_Example;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
E8435E0DCC8F7A80386C452616DACB34 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AAF3441A43AA58E58A7340FA1E66271B /* Segmentio.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
@ -688,6 +743,7 @@
PRODUCT_NAME = Segmentio;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@ -697,20 +753,11 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1796B5A3A489231D28C16CDA0DBD7F52 /* Build configuration list for PBXNativeTarget "Pods-Segmentio_Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
34F3882D28F8CE61245C5A12E47EE64E /* Debug */,
6A27E340E24D615063AB597774F259B4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = {
isa = XCConfigurationList;
buildConfigurations = (
47BEF9D903506B003EA5C2B249729489 /* Debug */,
AAF678CED40D3499169D10F63CA0719E /* Release */,
015A368F878AC3E2CEAE21DDE8026304 /* Debug */,
44CDBB6D11DE06DB64D6268622BDC47E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
@ -718,8 +765,17 @@
785D3215E776BE829EB1D98F89F1A8C1 /* Build configuration list for PBXNativeTarget "Segmentio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B54261FEDDC960542CA187AA5E14BC7D /* Debug */,
F03A1D5CC9DD916A3B05610779B9C8F0 /* Release */,
6939D89BCF3CB71D8A0CB554AEAC1779 /* Debug */,
E8435E0DCC8F7A80386C452616DACB34 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BD0B4F1676768CCD5A8C4B0E5B53427F /* Build configuration list for PBXNativeTarget "Segmentio-Segmentio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A6D8F8AC9425BACBC3621CFD7597790C /* Debug */,
B39C8A659F54F5D7007A70CE400454EA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
@ -727,8 +783,8 @@
CC37EAE0F58FC2B11F123B84FE6B0FAC /* Build configuration list for PBXNativeTarget "Pods-Segmentio_Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6A88DE4855BF46A99DED1138AC50611B /* Debug */,
847944553F66C9C9C8CF5EA5A12838E5 /* Release */,
BF58FEE71132386297AFD4D409190547 /* Debug */,
69F41B3AE04E5DCE90065CD8E029712C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;

View File

@ -2,25 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -35,6 +35,8 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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
THE SOFTWARE.</string>
<key>License</key>
<string>MIT</string>
<key>Title</key>
<string>Segmentio</string>
<key>Type</key>

View File

@ -1,3 +1,4 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Segmentio"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1

View File

@ -1,3 +1,4 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Segmentio"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1

View File

@ -1,3 +0,0 @@
# Acknowledgements
This application makes use of the following third party libraries:
Generated by CocoaPods - https://cocoapods.org

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - https://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>

View File

@ -1,5 +0,0 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_Segmentio_Tests : NSObject
@end
@implementation PodsDummy_Pods_Segmentio_Tests
@end

View File

@ -1,84 +0,0 @@
#!/bin/sh
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}

View File

@ -1,102 +0,0 @@
#!/bin/sh
set -e
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"
XCASSET_FILES=()
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
TARGET_DEVICE_ARGS="--target-device iphone"
;;
2)
TARGET_DEVICE_ARGS="--target-device ipad"
;;
*)
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
realpath() {
DIRECTORY="$(cd "${1%/*}" && pwd)"
FILENAME="${1##*/}"
echo "$DIRECTORY/$FILENAME"
}
install_resource()
{
if [[ "$1" = /* ]] ; then
RESOURCE_PATH="$1"
else
RESOURCE_PATH="${PODS_ROOT}/$1"
fi
if [[ ! -e "$RESOURCE_PATH" ]] ; then
cat << EOM
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
EOM
exit 1
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.framework)
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*.xcdatamodel)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
;;
*.xcdatamodeld)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
;;
*.xcmappingmodel)
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
;;
*.xcassets)
ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
*)
echo "$RESOURCE_PATH"
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
;;
esac
}
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
rm -f "$RESOURCES_TO_COPY"
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do
if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
XCASSET_FILES+=("$line")
fi
done <<<"$OTHER_XCASSETS"
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

View File

@ -1,6 +0,0 @@
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Pods_Segmentio_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Segmentio_TestsVersionString[];

View File

@ -1,7 +0,0 @@
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Segmentio"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Segmentio/Segmentio.framework/Headers"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,6 +0,0 @@
framework module Pods_Segmentio_Tests {
umbrella header "Pods-Segmentio_Tests-umbrella.h"
export *
module * { export * }
}

View File

@ -1,7 +0,0 @@
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Segmentio"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Segmentio/Segmentio.framework/Headers"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}/Pods

View File

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

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
@ -13,13 +11,13 @@
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<string>1.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<string>1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

View File

@ -24,6 +24,7 @@
327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CB1D1ABEC100534355 /* HomeViewController.swift */; };
327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 327AF5CC1D1ABEC100534355 /* SideMenuViewController.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 */; };
/* End PBXBuildFile section */
@ -49,6 +50,7 @@
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>"; };
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>"; };
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>"; };
@ -136,6 +138,14 @@
path = ViewControllers;
sourceTree = "<group>";
};
32C3706A1DD9C4EC001A39CB /* Builders */ = {
isa = PBXGroup;
children = (
32C3706B1DD9C4FA001A39CB /* SegmentioBuilder.swift */,
);
path = Builders;
sourceTree = "<group>";
};
45CA913E13914443DB2552B6 /* Pods */ = {
isa = PBXGroup;
children = (
@ -169,6 +179,7 @@
607FACD21AFB9204008FA782 /* Example for Segmentio */ = {
isa = PBXGroup;
children = (
32C3706A1DD9C4EC001A39CB /* Builders */,
327AF5A71D1ABEC100534355 /* Application */,
327AF5A91D1ABEC100534355 /* Extensions */,
327AF5AD1D1ABEC100534355 /* Helpers */,
@ -239,11 +250,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 0800;
};
};
};
@ -321,7 +333,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -336,6 +348,7 @@
327AF5CF1D1ABEC100534355 /* AppDelegate.swift in Sources */,
327AF5EB1D1ABEC100534355 /* SideMenuViewController.swift in Sources */,
327AF5E81D1ABEC100534355 /* EmbedContainerViewController.swift in Sources */,
32C3706C1DD9C4FA001A39CB /* SegmentioBuilder.swift in Sources */,
327AF5D41D1ABEC100534355 /* Disaster.swift in Sources */,
327AF5D31D1ABEC100534355 /* AppearanceConfigurator.swift in Sources */,
327AF5EA1D1ABEC100534355 /* HomeViewController.swift in Sources */,
@ -364,8 +377,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -388,7 +403,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -409,8 +424,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -426,9 +443,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
@ -437,6 +455,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 031FB43EDAB25B02B2FB7406 /* Pods-Segmentio_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "";
FRAMEWORK_SEARCH_PATHS = (
@ -450,6 +469,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -458,6 +478,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 1667ACAF5594F75E244C8E1B /* Pods-Segmentio_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@ -472,6 +493,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;

View File

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

View File

@ -13,10 +13,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UIDevice.currentDevice().beginGeneratingDeviceOrientationNotifications()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
AppearanceConfigurator.configureNavigationBar()
return true
}
}
}

View File

@ -0,0 +1,118 @@
//
// 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

@ -12,16 +12,15 @@ extension String {
func stringFromCamelCase() -> String {
var string = self
string = string.stringByReplacingOccurrencesOfString(
"([a-z])([A-Z])",
withString: "$1 $2",
options: .RegularExpressionSearch,
range: Range<String.Index>(string.startIndex..<string.endIndex)
string = string.replacingOccurrences(
of: "([a-z])([A-Z])",
with: "$1 $2",
options: .regularExpression,
range: nil
)
string.replaceSubrange(startIndex...startIndex, with: String(self[startIndex]))
string.replaceRange(startIndex...startIndex, with: String(self[startIndex]))
return String(string.characters.prefix(1)).capitalizedString + String(string.lowercaseString.characters.dropFirst())
return String(string.characters.prefix(1)).capitalized + String(string.lowercased().characters.dropFirst())
}
}
}

View File

@ -10,12 +10,12 @@ import UIKit
extension UIFont {
class func exampleAvenirMediumWithSize(size: CGFloat) -> UIFont {
return UIFont(name: "Avenir-Book", size: size) ?? UIFont.systemFontOfSize(size)
class func exampleAvenirMedium(ofSize size: CGFloat) -> UIFont {
return UIFont(name: "Avenir-Book", size: size) ?? UIFont.systemFont(ofSize: size)
}
class func exampleAvenirLightWithSize(size: CGFloat) -> UIFont {
return UIFont(name: "Avenir-Light", size: size) ?? UIFont.systemFontOfSize(size)
class func exampleAvenirLight(ofSize size: CGFloat) -> UIFont {
return UIFont(name: "Avenir-Light", size: size) ?? UIFont.systemFont(ofSize: size)
}
}
}

View File

@ -28,15 +28,15 @@ private var flatAssociatedObjectKey: UInt8 = 0
set {
if (newValue) {
let void = UIImage()
setBackgroundImage(void, forBarPosition: .Any, barMetrics: .Default)
setBackgroundImage(void, for: .any, barMetrics: .default)
shadowImage = void
} else {
setBackgroundImage(nil, forBarPosition: .Any, barMetrics: .Default)
setBackgroundImage(nil, for: .any, barMetrics: .default)
shadowImage = nil
}
objc_setAssociatedObject(self, &flatAssociatedObjectKey, NSNumber(bool: newValue),
objc_setAssociatedObject(self, &flatAssociatedObjectKey, NSNumber(value: newValue as Bool),
objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
}

View File

@ -11,16 +11,16 @@ import UIKit
class AppearanceConfigurator {
class func configureNavigationBar() {
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
UIApplication.shared.statusBarStyle = .lightContent
UINavigationBar.appearance().barTintColor = ColorPalette.WhiteColor
UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().tintColor = ColorPalette.BlackColor
UINavigationBar.appearance().barTintColor = ColorPalette.white
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().tintColor = ColorPalette.black
let attributes = [
NSFontAttributeName : UIFont.exampleAvenirMediumWithSize(17),
NSForegroundColorAttributeName : ColorPalette.BlackColor
NSFontAttributeName : UIFont.exampleAvenirMedium(ofSize: 17),
NSForegroundColorAttributeName : ColorPalette.black
]
UINavigationBar.appearance().titleTextAttributes = attributes
}
}
}

View File

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

View File

@ -9,9 +9,11 @@
import UIKit
struct ColorPalette {
static let WhiteColor = UIColor(red: 255, green: 255, blue: 255)
static let BlackColor = UIColor(red: 3, green: 3, blue: 3)
static let CoralColor = UIColor(red: 244, green: 111, blue: 96)
static let WhiteSmokeColor = UIColor(red: 245, green: 245, blue: 245)
static let GrayChateauColor = UIColor(red: 163, green: 164, blue: 168)
}
static let white = UIColor(red: 255, green: 255, blue: 255)
static let black = UIColor(red: 3, green: 3, blue: 3)
static let coral = UIColor(red: 244, green: 111, blue: 96)
static let whiteSmoke = UIColor(red: 245, green: 245, blue: 245)
static let grayChateau = UIColor(red: 163, green: 164, blue: 168)
}

View File

@ -7,35 +7,35 @@
//
struct Hints {
static let Tornado = [
static let tornado = [
"1. Move immediately to the special underground shelter whenever possible.",
"2. If unable to go underground, stay in a windowless, interior room on the lowest possible floor.",
"3. Remain in your shelter until the danger of tornadoes has passed.",
"4. Exit your shelter carefully, and exercise caution moving around in a tornado stricken area."
]
static let Earthquakes = [
static let earthquakes = [
"1. Make sure you have a fire extinguisher, first aid kit, a battery-powered radio, a flashlight, and extra batteries at home.",
"2. Learn how to turn off the gas, water, and electricity.",
"3. Make up a plan of where to meet your family after an earthquake. Don't leave heavy objects on shelves.",
"4. Dont panic."
]
static let ExtremeHeat = [
static let extremeHeat = [
"1. Know the Terms: Heat Wave, Heat Index, Heat Cramps, Heat Exhaustion, Heat Stroke, Sun Stroke.",
"2. Install window air conditioners snugly; insulate if necessary.",
"3. Check air-conditioning ducts for proper insulation.",
"4. Install temporary window reflectors (for use between windows and drapes), such as aluminum foil-covered cardboard, to reflect heat back outside."
]
static let Eruption = [
static let eruption = [
"1. Know your community's warning system.",
"2. Get familiar with the evacuation procedures.",
"3. Develop a household evacuation plan. Figure out what you'll need to do if you hear the sirens go off.",
"4. Stock up on necessities. Store at least a three-day supply of food and portable water at your home."
]
static let Floods = [
static let floods = [
"1. Be aware of your area's flood risk before the expected rain is going to hit.",
"2. Check to see if you have insurance that covers flooding.",
"3. Keep insurance policies, documents, and other valuables in a safe-deposit box, that is located up high and out of harm's way.",
@ -43,11 +43,11 @@ struct Hints {
"5. Identify where you could go if told to evacuate."
]
static let Wildfires = [
static let wildfires = [
"1. Make a disaster supply kit and have a family plan.",
"2. Design and landscape your home with wildfire safety in mind: select materials and plants that can help contain fire rather than fuel it.",
"3. Teach each family member how to use a fire extinguisher (ABC type) and show them where it's kept.",
"4. Dont panic."
]
}
}

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
<?xml version="1.0" encoding="UTF-8"?>
<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">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@ -14,21 +18,21 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<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">
<rect key="frame" x="270" y="255" width="60" height="90"/>
<rect key="frame" x="157.5" y="288.5" width="60" height="90"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="15m-sK-BMc"/>
<constraint firstAttribute="height" constant="90" id="pHT-4Q-Z9L"/>
</constraints>
<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="calibratedRGB"/>
<color key="textColor" red="0.95294117647058818" green="0.40000000000000002" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -37,7 +41,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="-36" y="268"/>
</scene>
</scenes>
</document>

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
<?xml version="1.0" encoding="UTF-8"?>
<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">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Disaster's guide-->
@ -14,17 +18,17 @@
<viewControllerLayoutGuide type="bottom" id="Cxz-xC-i78"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="6th-V5-ZMU">
<rect key="frame" x="0.0" y="64" width="600" height="536"/>
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="j4J-17-RS0">
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<connections>
<segue destination="nnH-xc-bez" kind="embed" identifier="EmbedContainerViewController" id="39a-pg-Pje"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -54,46 +58,46 @@
<viewControllerLayoutGuide type="bottom" id="d6b-iV-EUm"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="aho-PV-db8" userLabel="Content View">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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="550" height="553"/>
<rect key="frame" x="25" y="24" width="325" height="620"/>
<constraints>
<constraint firstAttribute="height" priority="900" constant="553" id="ffK-Ju-lZo"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pyy-sw-hGC" userLabel="Separator">
<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="calibratedRGB"/>
<rect key="frame" x="32" y="101" width="311" height="1"/>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="89l-q6-tQe"/>
</constraints>
</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">
<rect key="frame" x="32" y="75" width="536" height="19"/>
<rect key="frame" x="32" y="75" width="311" height="19"/>
<constraints>
<constraint firstAttribute="height" constant="19" id="x6o-JU-9JP"/>
</constraints>
<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="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<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="536" height="400"/>
<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="calibratedRGB"/>
<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">
<rect key="frame" x="32" y="160" width="311" height="467"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<color key="separatorColor" red="0.96078431606292725" green="0.96078431606292725" blue="0.96078431606292725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<prototypes>
<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="536" height="44"/>
<rect key="frame" x="0.0" y="28" width="311" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<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="536" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="311" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<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">
<rect key="frame" x="25" y="10" width="486" height="24"/>
<rect key="frame" x="25" y="10" width="261" height="24"/>
<fontDescription key="fontDescription" name="Avenir-Light" family="Avenir" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
@ -118,14 +122,14 @@
</connections>
</tableView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="oval" translatesAutoresizingMaskIntoConstraints="NO" id="t46-Uj-4Ci">
<rect key="frame" x="291" y="122" width="18" height="18"/>
<rect key="frame" x="178.5" y="122" width="18" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="Gki-L9-gmb"/>
<constraint firstAttribute="width" constant="18" id="HcY-Je-7ti"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.85490196078431369" green="0.85490196078431369" blue="0.85490196078431369" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.85490196078431369" green="0.85490196078431369" blue="0.85490196078431369" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -165,7 +169,7 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="A36-fE-w8g">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="barTintColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="flat" value="YES"/>
</userDefinedRuntimeAttributes>
@ -188,43 +192,43 @@
<viewControllerLayoutGuide type="bottom" id="Lh0-b2-Lg9"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="3on-2h-KRG">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dwd-YU-7oV" userLabel="Shadow View">
<rect key="frame" x="420" y="0.0" width="180" height="600"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<rect key="frame" x="262" y="0.0" width="113" height="667"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</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">
<rect key="frame" x="0.0" y="0.0" width="420" height="600"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<rect key="frame" x="0.0" y="0.0" width="262" height="667"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="420" id="1Fe-0J-akh"/>
<constraint firstAttribute="width" constant="262" id="1Fe-0J-akh"/>
</constraints>
<color key="separatorColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
<color key="separatorColor" red="0.96078431369999995" green="0.96078431369999995" blue="0.96078431369999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<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">
<rect key="frame" x="0.0" y="0.0" width="420" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="262" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IOF-iR-GOe" userLabel="Separator View">
<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="calibratedRGB"/>
<rect key="frame" x="0.0" y="65" width="262" height="1"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.43529411764705883" blue="0.37647058823529411" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="ipJ-LO-nfb"/>
</constraints>
</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">
<rect key="frame" x="16" y="35" width="388" height="22"/>
<rect key="frame" x="16" y="35" width="230" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="2GY-JW-I97"/>
</constraints>
<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="calibratedRGB"/>
<color key="textColor" red="0.95686274510000002" green="0.43529411759999997" blue="0.37647058820000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -236,17 +240,17 @@
</view>
<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">
<rect key="frame" x="0.0" y="94" width="420" height="44"/>
<rect key="frame" x="0.0" y="94" width="262" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<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="420" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="262" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<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="363" height="43"/>
<rect key="frame" x="42" y="0.0" width="205" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<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="calibratedRGB"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="defaultCheckbox" id="f8N-oJ-egW">
@ -264,7 +268,7 @@
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -275,8 +279,6 @@
<constraint firstAttribute="trailing" secondItem="dwd-YU-7oV" secondAttribute="trailing" id="tIN-F6-Jaf"/>
</constraints>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="600" height="600"/>
<connections>
<outlet property="menuTableView" destination="Ufo-LN-tbg" id="MLh-5f-jgM"/>
<outlet property="menuTableViewWidthConstraint" destination="1Fe-0J-akh" id="m5l-sp-fm3"/>
@ -296,27 +298,27 @@
<viewControllerLayoutGuide type="bottom" id="qlN-Ul-M6a"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="cqi-F1-zxi">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vkr-KO-SOm" customClass="Segmentio" customModule="Segmentio">
<rect key="frame" x="0.0" y="0.0" width="600" height="125"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="125"/>
<constraints>
<constraint firstAttribute="height" constant="125" id="MbU-cC-j02"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aMO-Fm-zcR" userLabel="Container">
<rect key="frame" x="0.0" y="125" width="600" height="475"/>
<rect key="frame" x="0.0" y="125" width="375" height="542"/>
<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">
<rect key="frame" x="0.0" y="0.0" width="600" height="475"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="542"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="delegate" destination="hoe-Iv-t0i" id="tIm-r4-G4D"/>
</connections>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -325,13 +327,13 @@
</constraints>
</view>
<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="600" height="9"/>
<rect key="frame" x="0.0" y="125" width="375" height="9"/>
<constraints>
<constraint firstAttribute="height" constant="9" id="2DA-Ym-fL4"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<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"/>
@ -375,19 +377,19 @@
<viewControllerLayoutGuide type="bottom" id="riu-eD-uzK"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8VE-5b-uC6">
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Caz-AG-AcN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2084" y="285"/>
<point key="canvasLocation" x="2084" y="287"/>
</scene>
</scenes>
<resources>
<image name="cards" width="126" height="54"/>
<image name="cards" width="125" height="53"/>
<image name="defaultCheckbox" width="12" height="12"/>
<image name="menu" width="28" height="14"/>
<image name="oval" width="18" height="18"/>

View File

@ -9,29 +9,29 @@
import UIKit
private func yal_isPhone6() -> Bool {
let size = UIScreen.mainScreen().bounds.size
let size = UIScreen.main.bounds.size
let minSide = min(size.height, size.width)
let maxSide = max(size.height, size.width)
return (fabs(minSide - 375.0) < 0.01) && (fabs(maxSide - 667.0) < 0.01)
}
class ExampleTableViewCell: UITableViewCell {
@IBOutlet private weak var hintLabel: UILabel!
@IBOutlet fileprivate weak var hintLabel: UILabel!
}
class ContentViewController: UIViewController {
@IBOutlet private weak var cardNameLabel: UILabel!
@IBOutlet private weak var hintTableView: UITableView!
@IBOutlet private weak var bottomCardConstraint: NSLayoutConstraint!
@IBOutlet private weak var heightConstraint: NSLayoutConstraint!
@IBOutlet fileprivate weak var cardNameLabel: UILabel!
@IBOutlet fileprivate weak var hintTableView: UITableView!
@IBOutlet fileprivate weak var bottomCardConstraint: NSLayoutConstraint!
@IBOutlet fileprivate weak var heightConstraint: NSLayoutConstraint!
var disaster: Disaster?
private var hints: [String]?
fileprivate var hints: [String]?
class func create() -> ContentViewController {
let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
return mainStoryboard.instantiateViewControllerWithIdentifier(String(self)) as! ContentViewController
return mainStoryboard.instantiateViewController(withIdentifier: String(describing: self)) as! ContentViewController
}
// MARK: - Lifecycle
@ -60,14 +60,14 @@ class ContentViewController: UIViewController {
extension ContentViewController: UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return hints?.count ?? 0
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! ExampleTableViewCell
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! ExampleTableViewCell
cell.hintLabel?.text = hints?[indexPath.row]
return cell
}
}
}

View File

@ -9,13 +9,13 @@
import UIKit
import Segmentio
private let animateDuration: NSTimeInterval = 0.6
private let animateDuration: TimeInterval = 0.6
class EmbedContainerViewController: UIViewController {
var style = SegmentioStyle.OnlyImage
var style = SegmentioStyle.onlyImage
private var currentViewController: UIViewController?
fileprivate var currentViewController: UIViewController?
// MARK: - Lifecycle
@ -26,7 +26,7 @@ class EmbedContainerViewController: UIViewController {
// MARK: - Private functions
private func presentController(controller: UIViewController) {
fileprivate func presentController(_ controller: UIViewController) {
if let _ = currentViewController {
removeCurrentViewController()
}
@ -34,29 +34,29 @@ class EmbedContainerViewController: UIViewController {
addChildViewController(controller)
view.addSubview(controller.view)
currentViewController = controller
controller.didMoveToParentViewController(self)
controller.didMove(toParentViewController: self)
}
private func controller(style: SegmentioStyle) -> ExampleViewController {
fileprivate func controller(_ style: SegmentioStyle) -> ExampleViewController {
let controller = ExampleViewController.create()
controller.segmentioStyle = style
controller.view.frame = view.bounds
return controller
}
private func removeCurrentViewController() {
currentViewController?.willMoveToParentViewController(nil)
fileprivate func removeCurrentViewController() {
currentViewController?.willMove(toParentViewController: nil)
currentViewController?.view.removeFromSuperview()
currentViewController?.removeFromParentViewController()
}
private func swapCurrentController(controller: UIViewController) {
currentViewController?.willMoveToParentViewController(nil)
fileprivate func swapCurrentController(_ controller: UIViewController) {
currentViewController?.willMove(toParentViewController: nil)
addChildViewController(controller)
view.addSubview(controller.view)
UIView.animateWithDuration(
animateDuration,
UIView.animate(
withDuration: animateDuration,
animations: {
controller.view.alpha = 1
self.currentViewController?.view.alpha = 0
@ -65,15 +65,15 @@ class EmbedContainerViewController: UIViewController {
self.currentViewController?.view.removeFromSuperview()
self.currentViewController?.removeFromParentViewController()
self.currentViewController = controller
self.currentViewController?.didMoveToParentViewController(self)
self.currentViewController?.didMove(toParentViewController: self)
}
)
}
// MARK: - Public functions
func swapViewControllers(style: SegmentioStyle) {
func swapViewControllers(_ style: SegmentioStyle) {
swapCurrentController(controller(style))
}
}
}

View File

@ -11,14 +11,14 @@ import Segmentio
class ExampleViewController: UIViewController {
var segmentioStyle = SegmentioStyle.ImageOverLabel
var segmentioStyle = SegmentioStyle.imageOverLabel
@IBOutlet private weak var segmentViewHeightConstraint: NSLayoutConstraint!
@IBOutlet private weak var segmentioView: Segmentio!
@IBOutlet private weak var containerView: UIView!
@IBOutlet private weak var scrollView: UIScrollView!
@IBOutlet fileprivate weak var segmentViewHeightConstraint: NSLayoutConstraint!
@IBOutlet fileprivate weak var segmentioView: Segmentio!
@IBOutlet fileprivate weak var containerView: UIView!
@IBOutlet fileprivate weak var scrollView: UIScrollView!
private lazy var viewControllers: [UIViewController] = {
fileprivate lazy var viewControllers: [UIViewController] = {
return self.preparedViewControllers()
}()
@ -26,7 +26,7 @@ class ExampleViewController: UIViewController {
class func create() -> ExampleViewController {
let board = UIStoryboard(name: "Main", bundle: nil)
return board.instantiateViewControllerWithIdentifier(String(self)) as! ExampleViewController
return board.instantiateViewController(withIdentifier: String(describing: self)) as! ExampleViewController
}
// MARK: - Lifecycle
@ -35,27 +35,24 @@ class ExampleViewController: UIViewController {
super.viewDidLoad()
switch segmentioStyle {
case .OnlyLabel, .ImageBeforeLabel, .ImageAfterLabel:
case .onlyLabel, .imageBeforeLabel, .imageAfterLabel:
segmentViewHeightConstraint.constant = 50
case .OnlyImage:
case .onlyImage:
segmentViewHeightConstraint.constant = 100
default:
break
}
}
override func viewDidAppear(animated: Bool) {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setupSegmentioView()
setupScrollView()
}
private func setupSegmentioView() {
segmentioView.setup(
content: segmentioContent(),
style: segmentioStyle,
options: segmentioOptions()
SegmentioBuilder.buildSegmentioView(
segmentioView: segmentioView,
segmentioStyle: segmentioStyle
)
SegmentioBuilder.setupBadgeCountForIndex(segmentioView, index: 1)
segmentioView.selectedSegmentioIndex = selectedSegmentioIndex()
@ -70,108 +67,44 @@ class ExampleViewController: UIViewController {
}
}
private 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 func segmentioOptions() -> SegmentioOptions {
var imageContentMode = UIViewContentMode.Center
switch segmentioStyle {
case .ImageBeforeLabel, .ImageAfterLabel:
imageContentMode = .ScaleAspectFit
default:
break
}
return SegmentioOptions(
backgroundColor: ColorPalette.WhiteColor,
maxVisibleItems: 3,
scrollEnabled: true,
indicatorOptions: segmentioIndicatorOptions(),
horizontalSeparatorOptions: segmentioHorizontalSeparatorOptions(),
verticalSeparatorOptions: segmentioVerticalSeparatorOptions(),
imageContentMode: imageContentMode,
labelTextAlignment: .Center,
segmentStates: segmentioStates()
)
}
private func segmentioStates() -> SegmentioStates {
let font = UIFont.exampleAvenirMediumWithSize(13)
return SegmentioStates(
defaultState: segmentioState(
backgroundColor: UIColor.clearColor(),
titleFont: font,
titleTextColor: ColorPalette.GrayChateauColor
),
selectedState: segmentioState(
backgroundColor: UIColor.clearColor(),
titleFont: font,
titleTextColor: ColorPalette.BlackColor
),
highlightedState: segmentioState(
backgroundColor: ColorPalette.WhiteSmokeColor,
titleFont: font,
titleTextColor: ColorPalette.GrayChateauColor
)
)
}
private func segmentioState(backgroundColor backgroundColor: UIColor, titleFont: UIFont, titleTextColor: UIColor) -> SegmentioState {
return SegmentioState(backgroundColor: backgroundColor, titleFont: titleFont, titleTextColor: titleTextColor)
}
private func segmentioIndicatorOptions() -> SegmentioIndicatorOptions {
return SegmentioIndicatorOptions(
type: .Bottom,
ratio: 1,
height: 5,
color: ColorPalette.CoralColor
)
}
private func segmentioHorizontalSeparatorOptions() -> SegmentioHorizontalSeparatorOptions {
return SegmentioHorizontalSeparatorOptions(
type: .TopAndBottom,
height: 1,
color: ColorPalette.WhiteSmokeColor
)
}
private func segmentioVerticalSeparatorOptions() -> SegmentioVerticalSeparatorOptions {
return SegmentioVerticalSeparatorOptions(
ratio: 1,
color: ColorPalette.WhiteSmokeColor
)
}
// Example viewControllers
private func preparedViewControllers() -> [ContentViewController] {
fileprivate func preparedViewControllers() -> [ContentViewController] {
let tornadoController = ContentViewController.create()
tornadoController.disaster = Disaster(cardName: "Before tornado", hints: Hints.Tornado)
tornadoController.disaster = Disaster(
cardName: "Before tornado",
hints: Hints.tornado
)
let earthquakesController = ContentViewController.create()
earthquakesController.disaster = Disaster(cardName: "Before earthquakes", hints: Hints.Earthquakes)
earthquakesController.disaster = Disaster(
cardName: "Before earthquakes",
hints: Hints.earthquakes
)
let extremeHeatController = ContentViewController.create()
extremeHeatController.disaster = Disaster(cardName: "Before extreme heat", hints: Hints.ExtremeHeat)
extremeHeatController.disaster = Disaster(
cardName: "Before extreme heat",
hints: Hints.extremeHeat
)
let eruptionController = ContentViewController.create()
eruptionController.disaster = Disaster(cardName: "Before eruption", hints: Hints.Eruption)
eruptionController.disaster = Disaster(
cardName: "Before eruption",
hints: Hints.eruption
)
let floodsController = ContentViewController.create()
floodsController.disaster = Disaster(cardName: "Before floods", hints: Hints.Floods)
floodsController.disaster = Disaster(
cardName: "Before floods",
hints: Hints.floods
)
let wildfiresController = ContentViewController.create()
wildfiresController.disaster = Disaster(cardName: "Before wildfires", hints: Hints.Wildfires)
wildfiresController.disaster = Disaster(
cardName: "Before wildfires",
hints: Hints.wildfires
)
return [
tornadoController,
@ -183,49 +116,48 @@ class ExampleViewController: UIViewController {
]
}
private func selectedSegmentioIndex() -> Int {
fileprivate func selectedSegmentioIndex() -> Int {
return 0
}
// MARK: - Setup container view
private func setupScrollView() {
fileprivate func setupScrollView() {
scrollView.contentSize = CGSize(
width: UIScreen.mainScreen().bounds.width * CGFloat(viewControllers.count),
width: UIScreen.main.bounds.width * CGFloat(viewControllers.count),
height: containerView.frame.height
)
for (index, viewController) in viewControllers.enumerate() {
for (index, viewController) in viewControllers.enumerated() {
viewController.view.frame = CGRect(
x: UIScreen.mainScreen().bounds.width * CGFloat(index),
x: UIScreen.main.bounds.width * CGFloat(index),
y: 0,
width: scrollView.frame.width,
height: scrollView.frame.height
)
addChildViewController(viewController)
scrollView.addSubview(viewController.view, options: .UseAutoresize) // module's extension
viewController.didMoveToParentViewController(self)
scrollView.addSubview(viewController.view, options: .useAutoresize) // module's extension
viewController.didMove(toParentViewController: self)
}
}
// MARK: - Actions
private func goToControllerAtIndex(index: Int) {
fileprivate func goToControllerAtIndex(_ index: Int) {
segmentioView.selectedSegmentioIndex = index
}
}
extension ExampleViewController: UIScrollViewDelegate {
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let currentPage = floor(scrollView.contentOffset.x / scrollView.frame.width)
segmentioView.selectedSegmentioIndex = Int(currentPage)
}
func scrollViewDidScroll(scrollView: UIScrollView) {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
scrollView.contentSize = CGSize(width: scrollView.contentSize.width, height: 0)
}
}
}

View File

@ -11,8 +11,8 @@ import Segmentio
class HomeViewController: UIViewController {
private var currentStyle = SegmentioStyle.OnlyImage
private var containerViewController: EmbedContainerViewController?
fileprivate var currentStyle = SegmentioStyle.onlyImage
fileprivate var containerViewController: EmbedContainerViewController?
// MARK: - Lifecycle
@ -20,26 +20,26 @@ class HomeViewController: UIViewController {
super.viewDidLoad()
}
override func shouldPerformSegueWithIdentifier(identifier: String, sender: AnyObject?) -> Bool {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
return true
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == String(EmbedContainerViewController.self) {
containerViewController = segue.destinationViewController as? EmbedContainerViewController
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == String(describing: EmbedContainerViewController.self) {
containerViewController = segue.destination as? EmbedContainerViewController
containerViewController?.style = currentStyle
}
}
// MARK: - Actions
@IBAction private func showMenu(sender: UIBarButtonItem) {
@IBAction fileprivate func showMenu(_ sender: UIBarButtonItem) {
SideMenuViewController.create().showSideMenu(
viewController: self,
currentStyle: currentStyle,
sideMenuDidHide: { [weak self] style in
self?.dismissViewControllerAnimated(
false,
self?.dismiss(
animated: false,
completion: {
if self?.currentStyle != style {
self?.currentStyle = style
@ -51,4 +51,4 @@ class HomeViewController: UIViewController {
)
}
}
}

View File

@ -9,9 +9,9 @@
import UIKit
import Segmentio
typealias SideMenuHandler = ((style: SegmentioStyle) -> Void)
typealias SideMenuHandler = ((_ style: SegmentioStyle) -> Void)
private let animationDuration: NSTimeInterval = 0.3
private let animationDuration: TimeInterval = 0.3
private let selectedCheckboxImage = UIImage(named: "selectedCheckbox")
private let defaultCheckboxImage = UIImage(named: "defaultCheckbox")
@ -19,20 +19,21 @@ class SideMenuViewController: UIViewController {
var sideMenuDidHide: SideMenuHandler?
@IBOutlet private weak var shadowView: UIView!
@IBOutlet private weak var menuTableView: UITableView!
@IBOutlet private weak var menuTableViewWidthConstraint: NSLayoutConstraint!
@IBOutlet fileprivate weak var shadowView: UIView!
@IBOutlet fileprivate weak var menuTableView: UITableView!
@IBOutlet fileprivate weak var menuTableViewWidthConstraint: NSLayoutConstraint!
private var menuItems = SegmentioStyle.allStyles
private var currentStyle = SegmentioStyle.OnlyImage
fileprivate var menuItems = SegmentioStyle.allStyles
fileprivate var currentStyle = SegmentioStyle.onlyImage
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
menuTableView.hidden = true
view.hidden = true
menuTableViewWidthConstraint.constant = UIScreen.mainScreen().bounds.width * 0.7
menuTableView.isHidden = true
view.isHidden = true
menuTableViewWidthConstraint.constant = UIScreen.main.bounds.width * 0.7
setupGestureRecognizers()
}
@ -40,23 +41,24 @@ class SideMenuViewController: UIViewController {
class func create() -> SideMenuViewController {
let board = UIStoryboard(name: "Main", bundle: nil)
return board.instantiateViewControllerWithIdentifier(String(self)) as! SideMenuViewController
return board.instantiateViewController(withIdentifier: String(describing: self)) as! SideMenuViewController
}
func showSideMenu(viewController viewController: UIViewController, currentStyle: SegmentioStyle, sideMenuDidHide: SideMenuHandler?) {
func showSideMenu(viewController: UIViewController, currentStyle: SegmentioStyle, sideMenuDidHide: SideMenuHandler?) {
self.currentStyle = currentStyle
self.sideMenuDidHide = sideMenuDidHide
self.modalPresentationStyle = .OverCurrentContext
modalPresentationStyle = .overCurrentContext
let size = view.frame.size
viewController.presentViewController(self, animated: false) { [weak self] in
self?.view.hidden = false
viewController.present(self, animated: false) { [weak self] in
self?.view.isHidden = false
self?.menuTableView.frame.origin = CGPoint(x: -size.width, y: 0)
UIView.animateWithDuration(
animationDuration,
UIView.animate(
withDuration: animationDuration,
animations: {
self?.view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.63)
self?.slideAnimationToPoint(CGPointZero)
self?.menuTableView.hidden = false
self?.view.backgroundColor = UIColor.black.withAlphaComponent(0.63)
self?.slideAnimationToPoint(.zero)
self?.menuTableView.isHidden = false
}
)
}
@ -64,64 +66,55 @@ class SideMenuViewController: UIViewController {
// MARK: - Private functions
private func setupGestureRecognizers() {
let dissmisSideMenuSelector = #selector(SideMenuViewController.dissmisSideMenu)
fileprivate func setupGestureRecognizers() {
let dissmisSideMenuSelector = #selector(SideMenuViewController.dismissSideMenu)
let tapRecognizer = UITapGestureRecognizer(
target: self,
action: dissmisSideMenuSelector
)
let tapRecognizer = UITapGestureRecognizer(target: self, action: dissmisSideMenuSelector)
tapRecognizer.delegate = self
shadowView.addGestureRecognizer(tapRecognizer)
let swipeRecognizer = UISwipeGestureRecognizer(
target: self,
action: dissmisSideMenuSelector
)
swipeRecognizer.direction = .Left
let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: dissmisSideMenuSelector)
swipeRecognizer.direction = .left
swipeRecognizer.delegate = self
view.addGestureRecognizer(swipeRecognizer)
}
private func didSelectItemAtIndexPath(indexPath: NSIndexPath) {
fileprivate func didSelectItem(at indexPath: IndexPath) {
currentStyle = SegmentioStyle.allStyles[indexPath.row]
dissmisSideMenu()
dismissSideMenu()
}
@objc private func dissmisSideMenu() {
@objc fileprivate func dismissSideMenu() {
let size = view.frame.size
UIView.animateWithDuration(
animationDuration,
UIView.animate(
withDuration: animationDuration,
animations: {
self.slideAnimationToPoint(CGPoint(x: -size.width, y: 0))
self.view.backgroundColor = UIColor.clearColor()
self.view.backgroundColor = .clear
},
completion: { _ in
self.view.hidden = true
self.menuTableView.hidden = true
self.sideMenuDidHide?(style: self.currentStyle)
self.view.isHidden = true
self.menuTableView.isHidden = true
self.sideMenuDidHide?(self.currentStyle)
}
)
}
private func slideAnimationToPoint(point: CGPoint) {
UIView.animateWithDuration(animationDuration) {
fileprivate func slideAnimationToPoint(_ point: CGPoint) {
UIView.animate(withDuration: animationDuration) {
self.menuTableView.frame.origin = point
}
}
private func uncheckCurrentStyle() {
guard let currentStyleIndex = menuItems.indexOf(currentStyle) else {
fileprivate func uncheckCurrentStyle() {
guard let currentStyleIndex = menuItems.index(of: currentStyle) else {
return
}
let activeIndexPath = NSIndexPath(
forRow: currentStyleIndex,
inSection: menuTableView.numberOfSections - 1
)
let activeIndexPath = IndexPath(row: currentStyleIndex, section: menuTableView.numberOfSections - 1)
let activeCell = menuTableView.cellForRowAtIndexPath(activeIndexPath)
let activeCell = menuTableView.cellForRow(at: activeIndexPath)
activeCell?.imageView?.image = defaultCheckboxImage
}
@ -129,45 +122,44 @@ class SideMenuViewController: UIViewController {
extension SideMenuViewController: UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuItems.count ?? 0
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuItems.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let reuseIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")!
let isCurrentStyle = currentStyle == menuItems[indexPath.row]
cell!.textLabel?.text = menuItems[indexPath.row].rawValue.stringFromCamelCase()
cell!.imageView?.image = isCurrentStyle ? selectedCheckboxImage : defaultCheckboxImage
cell.textLabel?.text = menuItems[indexPath.row].rawValue.stringFromCamelCase()
cell.imageView?.image = isCurrentStyle ? selectedCheckboxImage : defaultCheckboxImage
return cell!
return cell
}
}
extension SideMenuViewController: UITableViewDelegate {
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
if currentStyle != menuItems[indexPath.row] {
uncheckCurrentStyle()
cell?.imageView?.image = selectedCheckboxImage
}
didSelectItemAtIndexPath(indexPath)
didSelectItem(at: indexPath)
}
func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
}
extension SideMenuViewController: UIGestureRecognizerDelegate {
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
}
}

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright © 2015 Yalantis
Copyright © 2017 Yalantis
Permission is hereby granted, free of charge, to any person obtaining a copy
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
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
THE SOFTWARE.
THE SOFTWARE.

101
README.md
View File

@ -1,5 +1,5 @@
##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 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)
[![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)
Animated top/bottom segmented control written in Swift.
@ -9,7 +9,9 @@ Check this <a href="https://dribbble.com/shots/2820372-Segmentio-Component">proj
##Requirements
iOS 8.x, Swift 2.2.x
- Xcode 8
- iOS 8.x+
- Swift 3
##Installation
@ -17,14 +19,14 @@ iOS 8.x, Swift 2.2.x
```ruby
use_frameworks!
pod 'Segmentio', '~> 1.1.1'
pod 'Segmentio', '~> 2.1'
```
*(CocoaPods v1.0.1 or later required. See [this blog post](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/) for details.)*
*CocoaPods v1.1.0 or later required*
####[Carthage](http://github.com/Carthage/Carthage)
```ruby
github "Yalantis/Segmentio" ~> 1.1.1
github "Yalantis/Segmentio" ~> 2.1
```
##Usage
@ -35,23 +37,26 @@ import Segmentio
####Init
You can initialize a `Segmentio` instance from code:
```swift
var segmentioView: Segmentio!
let segmentioViewRect = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 125)
let segmentioViewRect = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 125)
segmentioView = Segmentio(frame: segmentioViewRect)
view.addSubview(segmentioView)
```
or
add a `UIView` instance in your .storyboard or .xib, set `Segmentio` class and connect `IBOutlet`:
```swift
@IBOutlet weak var segmentioView: Segmentio!
```
####Setup `Segmentio`
```swift
segmentioView.setupContent(
segmentioView.setup(
content: [SegmentioItem],
style: SegmentioStyle,
options: SegmentioOptions?
@ -61,7 +66,7 @@ segmentioView.setupContent(
To start with default options you can just pass `nil` to the `options` parameter.
```swift
segmentioView.setupContent(
segmentioView.setup(
content: [SegmentioItem],
style: SegmentioStyle,
options: nil
@ -71,6 +76,7 @@ segmentioView.setupContent(
####Configuring items
In order to set items you need to create an array of `SegmentioItem` instances:
```swift
var content = [SegmentioItem]()
@ -83,11 +89,13 @@ content.append(tornadoItem)
####Handling selection
You can specify selected item manually:
```swift
segmentioView.selectedSegmentIndex = 0
segmentioView.selectedSegmentioIndex = 0
```
####Handling callback
```swift
segmentioView.valueDidChange = { segmentio, segmentIndex in
print("Selected item: ", segmentIndex)
@ -96,65 +104,70 @@ segmentioView.valueDidChange = { segmentio, segmentIndex in
####Customization
`Segmentio` can be customized by passing an instance of `SegmentioOptions` struct:
```swift
SegmentioOptions(
backgroundColor: UIColor.whiteColor(),
maxVisibleItems: 3,
scrollEnabled: true,
indicatorOptions: SegmentioIndicatorOptions,
horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions,
verticalSeparatorOptions: SegmentioVerticalSeparatorOptions,
imageContentMode: UIViewContentMode.Center,
labelTextAlignment: NSTextAlignment.Center,
segmentStates: SegmentioStates // tuple of SegmentioState (defaultState, selectState, highlightedState)
backgroundColor: .white,
maxVisibleItems: 3,
scrollEnabled: true,
indicatorOptions: SegmentioIndicatorOptions,
horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions,
verticalSeparatorOptions: SegmentioVerticalSeparatorOptions,
imageContentMode: .center,
labelTextAlignment: .center,
segmentStates: SegmentioStates
)
```
Selection indicator can be customized by passing an instance of `SegmentioIndicatorOptions`:
```swift
SegmentioIndicatorOptions(
type: .Bottom,
ratio: 1,
height: 5,
color: UIColor.orangeColor()
type: .bottom,
ratio: 1,
height: 5,
color: .orange
)
```
Horizontal borders can be customized by passing an instance of `SegmentioHorizontalSeparatorOptions`:
```swift
SegmentioHorizontalSeparatorOptions(
type: SegmentioHorizontalSeparatorType.TopAndBottom, // Top, Bottom, TopAndBottom
height: 1,
color: UIColor.grayColor()
type: SegmentioHorizontalSeparatorType.topAndBottom, // Top, Bottom, TopAndBottom
height: 1,
color: .gray
)
```
Separators between segments can be customized by passing an instance of `SegmentioVerticalSeparatorOptions`:
```swift
SegmentioVerticalSeparatorOptions(
ratio: 0.6 // from 0.1 to 1
color: UIColor.grayColor()
ratio: 0.6, // from 0.1 to 1
color: .gray
)
```
In order to set `SegmentioStates` you need to create a tuple of `SegmentioState` instances:
```swift
SegmentioStates(
defaultState: segmentioState(
backgroundColor: UIColor.clearColor(),
titleFont: UIFont.systemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: UIColor.blackColor()
),
selectState: segmentioState(
backgroundColor: UIColor.orangeColor(),
titleFont: UIFont.systemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: UIColor.whiteColor()
),
highlightedState: segmentioState(
backgroundColor: UIColor.lightGrayColor().colorWithAlphaComponent(0.6),
titleFont: UIFont.boldSystemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: UIColor.blackColor()
)
defaultState: SegmentioState(
backgroundColor: .clear,
titleFont: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
titleTextColor: .black
),
selectedState: SegmentioState(
backgroundColor: .orange,
titleFont: UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
titleTextColor: .white
),
highlightedState: SegmentioState(
backgroundColor: UIColor.lightGray.withAlphaComponent(0.6),
titleFont: UIFont.boldSystemFont(ofSize: UIFont.smallSystemFontSize),
titleTextColor: .black
)
)
```
@ -167,7 +180,7 @@ P.S. Were going to publish more awesomeness wrapped in code and a tutorial on
The MIT License (MIT)
Copyright © 2016 Yalantis
Copyright © 2017 Yalantis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -185,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
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
THE SOFTWARE.
THE SOFTWARE.

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "Segmentio"
spec.version = "1.1.1"
spec.version = "2.1.2"
spec.homepage = "https://github.com/Yalantis/Segmentio"
spec.summary = "Animated top/bottom segmented control written in Swift!"
@ -10,12 +10,12 @@ Pod::Spec.new do |spec|
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.social_media_url = "https://twitter.com/yalantis"
spec.platform = :ios, '8.0'
spec.ios.deployment_target = '8.0'
spec.source = { :git => "https://github.com/Yalantis/Segmentio.git", :tag => spec.version }
spec.source_files = 'Segmentio/Source/**/*.swift'
spec.resources = 'Segmentio/Source/Badge/Views/*.xib'
spec.resource_bundle = { 'Segmentio' => 'Segmentio/Source/Badge/Views/*.xib' }
spec.module_name = 'Segmentio'
spec.requires_arc = true
end

View File

@ -18,6 +18,10 @@
324B605E1D33E5200050B083 /* UIView+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324B60541D33E5200050B083 /* UIView+Appearance.swift */; };
324B605F1D33E5200050B083 /* Segmentio.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324B60551D33E5200050B083 /* Segmentio.swift */; };
324B60601D33E5200050B083 /* SegmentioOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324B60561D33E5200050B083 /* SegmentioOptions.swift */; };
C5514DD81DAB5B82008F14AA /* BadgeViewPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5514DD31DAB5B82008F14AA /* BadgeViewPresenter.swift */; };
C5514DD91DAB5B82008F14AA /* BadgeWithCounterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5514DD51DAB5B82008F14AA /* BadgeWithCounterView.swift */; };
C5514DDA1DAB5B82008F14AA /* BadgeWithCounterViewBigSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5514DD61DAB5B82008F14AA /* BadgeWithCounterViewBigSized.xib */; };
C5514DDB1DAB5B82008F14AA /* BadgeWithCounterViewStandardSized.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5514DD71DAB5B82008F14AA /* BadgeWithCounterViewStandardSized.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -34,6 +38,10 @@
324B60541D33E5200050B083 /* UIView+Appearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Appearance.swift"; sourceTree = "<group>"; };
324B60551D33E5200050B083 /* Segmentio.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Segmentio.swift; sourceTree = "<group>"; };
324B60561D33E5200050B083 /* SegmentioOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegmentioOptions.swift; sourceTree = "<group>"; };
C5514DD31DAB5B82008F14AA /* BadgeViewPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BadgeViewPresenter.swift; sourceTree = "<group>"; };
C5514DD51DAB5B82008F14AA /* BadgeWithCounterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BadgeWithCounterView.swift; sourceTree = "<group>"; };
C5514DD61DAB5B82008F14AA /* BadgeWithCounterViewBigSized.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BadgeWithCounterViewBigSized.xib; sourceTree = "<group>"; };
C5514DD71DAB5B82008F14AA /* BadgeWithCounterViewStandardSized.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BadgeWithCounterViewStandardSized.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -76,6 +84,7 @@
324B604A1D33E5200050B083 /* Source */ = {
isa = PBXGroup;
children = (
C5514DD21DAB5B82008F14AA /* Badge */,
324B604B1D33E5200050B083 /* Cells */,
324B60531D33E5200050B083 /* Extensions */,
324B60551D33E5200050B083 /* Segmentio.swift */,
@ -106,6 +115,25 @@
path = Extensions;
sourceTree = "<group>";
};
C5514DD21DAB5B82008F14AA /* Badge */ = {
isa = PBXGroup;
children = (
C5514DD31DAB5B82008F14AA /* BadgeViewPresenter.swift */,
C5514DD41DAB5B82008F14AA /* Views */,
);
path = Badge;
sourceTree = "<group>";
};
C5514DD41DAB5B82008F14AA /* Views */ = {
isa = PBXGroup;
children = (
C5514DD51DAB5B82008F14AA /* BadgeWithCounterView.swift */,
C5514DD61DAB5B82008F14AA /* BadgeWithCounterViewBigSized.xib */,
C5514DD71DAB5B82008F14AA /* BadgeWithCounterViewStandardSized.xib */,
);
path = Views;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -150,6 +178,7 @@
TargetAttributes = {
324B603F1D33E43E0050B083 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
};
};
};
@ -176,6 +205,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C5514DDB1DAB5B82008F14AA /* BadgeWithCounterViewStandardSized.xib in Resources */,
C5514DDA1DAB5B82008F14AA /* BadgeWithCounterViewBigSized.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -189,6 +220,8 @@
324B60601D33E5200050B083 /* SegmentioOptions.swift in Sources */,
324B605B1D33E5200050B083 /* SegmentioCellWithImageOverLabel.swift in Sources */,
324B60571D33E5200050B083 /* SegmentioCell.swift in Sources */,
C5514DD91DAB5B82008F14AA /* BadgeWithCounterView.swift in Sources */,
C5514DD81DAB5B82008F14AA /* BadgeViewPresenter.swift in Sources */,
324B60591D33E5200050B083 /* SegmentioCellWithImageAfterLabel.swift in Sources */,
324B605F1D33E5200050B083 /* Segmentio.swift in Sources */,
324B60581D33E5200050B083 /* SegmentioCellWithImage.swift in Sources */,
@ -239,7 +272,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -279,7 +312,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@ -301,6 +334,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yalantismobile.Segmentio;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -320,6 +354,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yalantismobile.Segmentio;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};

View File

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

View File

@ -0,0 +1,92 @@
//
// BadgeViewPresenter.swift
// Pods
//
// Created by Eugene on 22.09.16.
//
//
import UIKit
class BadgeViewPresenter {
func addBadgeForContainerView(_ containerView: UIView, counterValue: Int, backgroundColor: UIColor = .red, badgeSize: BadgeSize = .standard) {
var badgeView: BadgeWithCounterView!
for view in containerView.subviews {
if view is BadgeWithCounterView {
badgeView = view as! BadgeWithCounterView
badgeView?.setBadgeBackgroundColor(backgroundColor)
badgeView?.setBadgeCounterValue(counterValue)
}
}
if badgeView == nil {
badgeView = badgeViewForCounterValue(counterValue, backgroundColor: backgroundColor, size: badgeSize)
badgeView.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(badgeView)
containerView.bringSubview(toFront: badgeView)
setupBadgeConstraints(badgeView, counterValue: counterValue)
}
}
func removeBadgeFromContainerView(_ containerView: UIView) {
for view in containerView.subviews {
if view is BadgeWithCounterView {
view.removeFromSuperview()
}
}
}
fileprivate func setupBadgeConstraints(_ badgeView: BadgeWithCounterView, counterValue: Int) {
var constraintConstant:CGFloat = -5.0
if counterValue > 9 {
constraintConstant = -10.0
}
let segmentTitleLabelHorizontalCenterConstraint =
NSLayoutConstraint(
item: badgeView,
attribute: .top,
relatedBy: .equal,
toItem: badgeView.superview,
attribute: .top,
multiplier: 1,
constant: 6.0
)
let segmentTitleLabelVerticalCenterConstraint =
NSLayoutConstraint(
item: badgeView,
attribute: .trailing,
relatedBy: .equal,
toItem: badgeView.superview,
attribute: .trailing,
multiplier: 1,
constant: constraintConstant
)
segmentTitleLabelHorizontalCenterConstraint.isActive = true
segmentTitleLabelVerticalCenterConstraint.isActive = true
}
}
enum Separator {
case top
case bottom
case topAndBottom
}
// MARK: Badges views creation
extension BadgeViewPresenter {
fileprivate func badgeViewForCounterValue(_ counter: Int, backgroundColor: UIColor, size: BadgeSize) -> BadgeWithCounterView {
let view = BadgeWithCounterView.instanceFromNib(size: size)
view.setBadgeBackgroundColor(backgroundColor)
view.setBadgeCounterValue(counter)
return view
}
}

View File

@ -0,0 +1,47 @@
import Foundation
private let BadgeCounterMaxValue = 99
private let BadgeCounterOverMaxValueText = "99+"
private let standardSizedNibName = "BadgeWithCounterViewStandardSized"
private let bigSizedNibName = "BadgeWithCounterViewBigSized"
enum BadgeSize {
case standard
case big
}
class BadgeWithCounterView: UIView {
@IBOutlet fileprivate weak var counterValueLabel: UILabel!
@IBOutlet fileprivate weak var backgroundImageView: UIImageView!
class func instanceFromNib(size: BadgeSize) -> BadgeWithCounterView {
let nibName = nibNameForSize(size)
let podBundle = Bundle(for: self.classForCoder())
if let bundleURL = podBundle.url(forResource: "Segmentio", withExtension: "bundle"), let bundle = Bundle(url: bundleURL) {
return UINib(nibName: nibName, bundle: bundle).instantiate(withOwner: nil, options: nil)[0] as! BadgeWithCounterView
}
return BadgeWithCounterView(frame: .zero)
}
func setBadgeCounterValue(_ counterValue: Int) {
var counterText: String!
if counterValue > BadgeCounterMaxValue {
counterText = BadgeCounterOverMaxValueText
} else {
counterText = String(counterValue)
}
counterValueLabel.text = counterText
}
func setBadgeBackgroundColor(_ color: UIColor) {
backgroundImageView.backgroundColor = color
}
fileprivate class func nibNameForSize(_ size: BadgeSize) -> String {
return size == .standard ? standardSizedNibName : bigSizedNibName
}
}

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view userInteractionEnabled="NO" contentMode="scaleToFill" id="KcE-SS-9TU" customClass="BadgeWithCounterView" customModule="Segmentio">
<rect key="frame" x="0.0" y="0.0" width="38" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="v0J-W6-cSb" userLabel="Background Image View" customClass="RoundImageView" customModule="Segmentio" customModuleProvider="target">
<rect key="frame" x="-2" y="-1" width="40.5" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="20" id="0LH-dc-4RL"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" secondItem="v0J-W6-cSb" secondAttribute="height" id="ofE-fK-2Pf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" text="99+" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.30000001192092896" translatesAutoresizingMaskIntoConstraints="NO" id="aLy-ls-VfX" userLabel="Counter Value Label">
<rect key="frame" x="6" y="2" width="25" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="v0J-W6-cSb" firstAttribute="centerX" secondItem="KcE-SS-9TU" secondAttribute="centerX" id="8mG-rK-NDa"/>
<constraint firstItem="aLy-ls-VfX" firstAttribute="width" secondItem="v0J-W6-cSb" secondAttribute="width" constant="-15" id="G78-cE-E4C"/>
<constraint firstItem="v0J-W6-cSb" firstAttribute="centerY" secondItem="KcE-SS-9TU" secondAttribute="centerY" id="ObE-ZA-xQJ"/>
<constraint firstItem="aLy-ls-VfX" firstAttribute="centerX" secondItem="v0J-W6-cSb" secondAttribute="centerX" id="Rvg-Jy-Cnd"/>
<constraint firstItem="aLy-ls-VfX" firstAttribute="centerY" secondItem="v0J-W6-cSb" secondAttribute="centerY" id="ibJ-Qo-25e"/>
<constraint firstItem="aLy-ls-VfX" firstAttribute="height" secondItem="v0J-W6-cSb" secondAttribute="height" constant="-6" id="kr5-0Q-aUM"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="backgroundImageView" destination="v0J-W6-cSb" id="F4i-xu-iDM"/>
<outlet property="counterValueLabel" destination="aLy-ls-VfX" id="uv7-Qn-Ucz"/>
</connections>
<point key="canvasLocation" x="398" y="446"/>
</view>
</objects>
</document>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view userInteractionEnabled="NO" contentMode="scaleToFill" id="iN0-l3-epB" customClass="BadgeWithCounterView" customModule="Segmentio">
<rect key="frame" x="0.0" y="0.0" width="30" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="d4V-GG-9pR" userLabel="Background Image View" customClass="RoundImageView" customModule="Segmentio" customModuleProvider="target">
<rect key="frame" x="-2" y="-1" width="32.5" height="20"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="18" id="Nld-O1-MJv"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" secondItem="d4V-GG-9pR" secondAttribute="height" id="cCQ-lW-OUm"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" text="99+" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.29999999999999999" translatesAutoresizingMaskIntoConstraints="NO" id="ech-Mu-YMM" userLabel="Counter Value Label">
<rect key="frame" x="2.5" y="1" width="25" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="ech-Mu-YMM" firstAttribute="centerY" secondItem="d4V-GG-9pR" secondAttribute="centerY" id="3TE-QX-wNX"/>
<constraint firstItem="ech-Mu-YMM" firstAttribute="centerX" secondItem="d4V-GG-9pR" secondAttribute="centerX" id="QJJ-ap-dbB"/>
<constraint firstItem="d4V-GG-9pR" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="R7x-Ll-s8y"/>
<constraint firstItem="ech-Mu-YMM" firstAttribute="width" secondItem="d4V-GG-9pR" secondAttribute="width" constant="-7" id="Sz2-qr-fOS"/>
<constraint firstItem="d4V-GG-9pR" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="dFc-74-PeR"/>
<constraint firstItem="ech-Mu-YMM" firstAttribute="height" secondItem="d4V-GG-9pR" secondAttribute="height" constant="-4" id="uDs-Tl-0La"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="backgroundImageView" destination="d4V-GG-9pR" id="aJr-t4-PcZ"/>
<outlet property="counterValueLabel" destination="ech-Mu-YMM" id="7r3-jp-rZj"/>
</connections>
<point key="canvasLocation" x="398" y="446"/>
</view>
</objects>
</document>

View File

@ -16,23 +16,26 @@ class SegmentioCell: UICollectionViewCell {
var verticalSeparatorView: UIView?
var segmentTitleLabel: UILabel?
var segmentImageView: UIImageView?
var containerView: UIView?
var imageContainerView: UIView?
var topConstraint: NSLayoutConstraint?
var bottomConstraint: NSLayoutConstraint?
var cellSelected = false
private var options = SegmentioOptions()
private var style = SegmentioStyle.ImageOverLabel
private let verticalSeparatorLayer = CAShapeLayer()
fileprivate var options = SegmentioOptions()
fileprivate var style = SegmentioStyle.imageOverLabel
fileprivate let verticalSeparatorLayer = CAShapeLayer()
fileprivate let badgePresenter = BadgeViewPresenter()
override var highlighted: Bool {
override var isHighlighted: Bool {
get {
return super.highlighted
return super.isHighlighted
}
set {
if newValue != highlighted {
super.highlighted = newValue
if newValue != isHighlighted {
super.isHighlighted = newValue
let highlightedState = options.states.highlightedState
let defaultState = options.states.defaultState
@ -42,11 +45,11 @@ class SegmentioCell: UICollectionViewCell {
let highlightedTitleTextColor = cellSelected ? selectedState.titleTextColor : defaultState.titleTextColor
let highlightedTitleFont = cellSelected ? selectedState.titleFont : defaultState.titleFont
segmentTitleLabel?.textColor = highlighted ? highlightedState.titleTextColor : highlightedTitleTextColor
segmentTitleLabel?.font = highlighted ? highlightedState.titleFont : highlightedTitleFont
segmentTitleLabel?.textColor = isHighlighted ? highlightedState.titleTextColor : highlightedTitleTextColor
segmentTitleLabel?.font = isHighlighted ? highlightedState.titleFont : highlightedTitleFont
}
backgroundColor = highlighted ? highlightedState.backgroundColor : defaultState.backgroundColor
backgroundColor = isHighlighted ? highlightedState.backgroundColor : defaultState.backgroundColor
}
}
}
@ -55,22 +58,33 @@ class SegmentioCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
segmentImageView = UIImageView(frame: CGRectZero)
if let segmentImageView = segmentImageView {
contentView.addSubview(segmentImageView)
imageContainerView = UIView(frame: CGRect.zero)
if let imageContainerView = imageContainerView {
contentView.addSubview(imageContainerView)
}
segmentImageView = UIImageView(frame: CGRect.zero)
if let segmentImageView = segmentImageView, let imageContainerView = imageContainerView {
imageContainerView.addSubview(segmentImageView)
}
segmentTitleLabel = UILabel(frame: CGRectZero)
if let segmentTitleLabel = segmentTitleLabel {
contentView.addSubview(segmentTitleLabel)
containerView = UIView(frame: CGRect.zero)
if let containerView = containerView {
contentView.addSubview(containerView)
}
segmentTitleLabel = UILabel(frame: CGRect.zero)
if let segmentTitleLabel = segmentTitleLabel, let containerView = containerView {
containerView.addSubview(segmentTitleLabel)
}
segmentImageView?.translatesAutoresizingMaskIntoConstraints = false
segmentTitleLabel?.translatesAutoresizingMaskIntoConstraints = false
containerView?.translatesAutoresizingMaskIntoConstraints = false
imageContainerView?.translatesAutoresizingMaskIntoConstraints = false
segmentImageView?.layer.masksToBounds = true
segmentTitleLabel?.font = UIFont.systemFontOfSize(UIFont.smallSystemFontSize())
segmentTitleLabel?.font = UIFont.systemFont(ofSize: UIFont.smallSystemFontSize)
setupConstraintsForSubviews()
addVerticalSeparator()
@ -85,11 +99,14 @@ class SegmentioCell: UICollectionViewCell {
super.prepareForReuse()
switch style {
case .OnlyLabel:
case .onlyLabel:
badgePresenter.removeBadgeFromContainerView(containerView!)
segmentTitleLabel?.text = nil
case .OnlyImage:
case .onlyImage:
badgePresenter.removeBadgeFromContainerView(imageContainerView!)
segmentImageView?.image = nil
default:
badgePresenter.removeBadgeFromContainerView(containerView!)
segmentTitleLabel?.text = nil
segmentImageView?.image = nil
}
@ -97,11 +114,10 @@ class SegmentioCell: UICollectionViewCell {
// MARK: - Configure
func configure(content content: SegmentioItem, style: SegmentioStyle, options: SegmentioOptions, isLastCell: Bool) {
func configure(content: SegmentioItem, style: SegmentioStyle, options: SegmentioOptions, isLastCell: Bool) {
self.options = options
self.style = style
setupContent(content: content)
if let indicatorOptions = self.options.indicatorOptions {
setupConstraint(indicatorOptions: indicatorOptions)
}
@ -111,9 +127,10 @@ class SegmentioCell: UICollectionViewCell {
setupVerticalSeparators()
}
}
configurateBadgeWithCount(content.badgeCount, color: content.badgeColor)
}
func configure(selected selected: Bool) {
func configure(selected: Bool) {
cellSelected = selected
let selectedState = options.states.selectedState
@ -125,13 +142,137 @@ class SegmentioCell: UICollectionViewCell {
}
}
func setupConstraintsForSubviews() {
return // implement in subclasses
func configurateBadgeWithCount(_ badgeCount: Int?, color: UIColor?) {
guard let badgeCount = badgeCount, let color = color else {
return
}
if style == .onlyImage {
badgePresenter.addBadgeForContainerView(
imageContainerView!,
counterValue: badgeCount,
backgroundColor: color,
badgeSize: .standard
)
} else {
badgePresenter.addBadgeForContainerView(
containerView!,
counterValue: badgeCount,
backgroundColor: color,
badgeSize: .standard
)
}
}
func setupConstraintsForSubviews() {
setupContainerConstraints()
setupImageContainerConstraints()
return // implement in subclasses
}
// MARK: - Private functions
private func setupContent(content content: SegmentioItem) {
fileprivate func setupContainerConstraints() {
guard let segmentTitleLabel = segmentTitleLabel, let containerView = containerView else {
return
}
let segmentTitleLabelVerticalCenterConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .centerY,
relatedBy: .equal,
toItem: containerView,
attribute: .centerY,
multiplier: 1,
constant: 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([
segmentTitleLabelTrailingConstraint,
segmentTitleLabelVerticalCenterConstraint,
segmentTitleLabelLeadingConstraint
])
}
fileprivate func setupImageContainerConstraints() {
guard let segmentImageView = segmentImageView else {
return
}
guard let imageContainerView = imageContainerView else {
return
}
let segmentImageViewTopConstraint =
NSLayoutConstraint(
item: segmentImageView,
attribute: .top,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .top,
multiplier: 1,
constant: 0
)
let segmentImageViewLeadingConstraint =
NSLayoutConstraint(
item: segmentImageView,
attribute: .leading,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .leading,
multiplier: 1,
constant: 0
)
let segmentImageViewTrailingConstraint =
NSLayoutConstraint(
item: segmentImageView,
attribute: .trailing,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .trailing,
multiplier: 1,
constant: 0
)
let segmentImageViewBottomConstraint =
NSLayoutConstraint(
item: segmentImageView,
attribute: .bottom,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .bottom,
multiplier: 1,
constant: 0
)
addConstraints([
segmentImageViewBottomConstraint,
segmentImageViewTrailingConstraint,
segmentImageViewLeadingConstraint,
segmentImageViewTopConstraint
])
}
fileprivate func setupContent(content: SegmentioItem) {
if style.isWithImage() {
segmentImageView?.contentMode = options.imageContentMode
segmentImageView?.image = content.image
@ -139,6 +280,7 @@ class SegmentioCell: UICollectionViewCell {
if style.isWithText() {
segmentTitleLabel?.textAlignment = options.labelTextAlignment
segmentTitleLabel?.numberOfLines = options.labelTextNumberOfLines
let defaultState = options.states.defaultState
segmentTitleLabel?.textColor = defaultState.titleTextColor
segmentTitleLabel?.font = defaultState.titleFont
@ -146,18 +288,18 @@ class SegmentioCell: UICollectionViewCell {
}
}
private func setupConstraint(indicatorOptions indicatorOptions: SegmentioIndicatorOptions) {
fileprivate func setupConstraint(indicatorOptions: SegmentioIndicatorOptions) {
switch indicatorOptions.type {
case .Top:
case .top:
topConstraint?.constant = padding + indicatorOptions.height
case .Bottom:
case .bottom:
bottomConstraint?.constant = padding + indicatorOptions.height
}
}
// MARK: - Vertical separator
private func addVerticalSeparator() {
fileprivate func addVerticalSeparator() {
let contentViewWidth = contentView.bounds.width
let rect = CGRect(
x: contentView.bounds.width - 1,
@ -183,48 +325,50 @@ class SegmentioCell: UICollectionViewCell {
let widthConstraint = NSLayoutConstraint(
item: verticalSeparatorView,
attribute: .Width,
relatedBy: .Equal,
attribute: .width,
relatedBy: .equal,
toItem: nil,
attribute: .NotAnAttribute,
attribute: .notAnAttribute,
multiplier: 1,
constant: 1
)
widthConstraint.active = true
widthConstraint.isActive = true
let trailingConstraint = NSLayoutConstraint(
item: verticalSeparatorView,
attribute: .Trailing,
relatedBy: .Equal,
attribute: .trailing,
relatedBy: .equal,
toItem: contentView,
attribute: .Trailing,
attribute: .trailing,
multiplier: 1,
constant: 0
)
trailingConstraint.active = true
trailingConstraint.isActive = true
let topConstraint = NSLayoutConstraint(
item: verticalSeparatorView,
attribute: .Top, relatedBy: .Equal,
toItem: contentView, attribute: .Top,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .top,
multiplier: 1,
constant: 0
)
topConstraint.active = true
topConstraint.isActive = true
let bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
attribute: .bottom,
relatedBy: .equal,
toItem: verticalSeparatorView,
attribute: .Bottom,
attribute: .bottom,
multiplier: 1,
constant: 0
)
bottomConstraint.active = true
bottomConstraint.isActive = true
}
private func setupVerticalSeparators() {
fileprivate func setupVerticalSeparators() {
guard let verticalSeparatorOptions = options.verticalSeparatorOptions else {
return
}
@ -240,15 +384,15 @@ class SegmentioCell: UICollectionViewCell {
let endY = bounds.height - difference
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: verticalSeparatorView.frame.width / 2, y: startY))
path.addLineToPoint(CGPoint(x: verticalSeparatorView.frame.width / 2, y: endY))
path.move(to: CGPoint(x: verticalSeparatorView.frame.width / 2, y: startY))
path.addLine(to: CGPoint(x: verticalSeparatorView.frame.width / 2, y: endY))
verticalSeparatorLayer.path = path.CGPath
verticalSeparatorLayer.path = path.cgPath
verticalSeparatorLayer.lineWidth = 1
verticalSeparatorLayer.strokeColor = verticalSeparatorOptions.color.CGColor
verticalSeparatorLayer.fillColor = verticalSeparatorOptions.color.CGColor
verticalSeparatorLayer.strokeColor = verticalSeparatorOptions.color.cgColor
verticalSeparatorLayer.fillColor = verticalSeparatorOptions.color.cgColor
verticalSeparatorView.layer.addSublayer(verticalSeparatorLayer)
}
}
}

View File

@ -11,44 +11,45 @@ import UIKit
final class SegmentioCellWithImage: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentImageView = segmentImageView else {
super.setupConstraintsForSubviews()
guard let imageContainerView = imageContainerView else {
return
}
let views = ["segmentImageView": segmentImageView]
let views = ["imageContainerView": imageContainerView]
// main constraints
let segmentImageViewlHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentImageView]-|",
let segmentImageViewlHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|-[imageContainerView]-|",
options: [],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints(segmentImageViewlHorizontConstraint)
NSLayoutConstraint.activate(segmentImageViewlHorizontConstraint)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentImageView,
attribute: .Top,
relatedBy: .Equal,
item: imageContainerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentImageView,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -11,58 +11,58 @@ import UIKit
final class SegmentioCellWithImageAfterLabel: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentImageView = segmentImageView else {
super.setupConstraintsForSubviews()
guard let imageContainerView = imageContainerView else {
return
}
guard let segmentTitleLabel = segmentTitleLabel else {
guard let containerView = containerView else {
return
}
let metrics = ["labelHeight": segmentTitleLabelHeight]
let views = [
"segmentImageView": segmentImageView,
"segmentTitleLabel": segmentTitleLabel
"imageContainerView": imageContainerView,
"containerView": containerView
]
// main constraints
let segmentImageViewVerticalConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[segmentImageView(labelHeight)]",
options: [.AlignAllCenterY],
let segmentImageViewVerticalConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "V:[imageContainerView(labelHeight)]",
options: [.alignAllCenterY],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(segmentImageViewVerticalConstraint)
NSLayoutConstraint.activate(segmentImageViewVerticalConstraint)
let contentViewHorizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentTitleLabel]-[segmentImageView(labelHeight)]-|",
options: [.AlignAllCenterY],
let contentViewHorizontalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "|-[containerView]-[imageContainerView(labelHeight)]-|",
options: [.alignAllCenterY],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(contentViewHorizontalConstraints)
NSLayoutConstraint.activate(contentViewHorizontalConstraints)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .Top,
relatedBy: .Equal,
item: containerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentTitleLabel,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: containerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -11,58 +11,59 @@ import UIKit
class SegmentioCellWithImageBeforeLabel: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentImageView = segmentImageView else {
super.setupConstraintsForSubviews()
guard let imageContainerView = imageContainerView else {
return
}
guard let segmentTitleLabel = segmentTitleLabel else {
guard let containerView = containerView else {
return
}
let metrics = ["labelHeight": segmentTitleLabelHeight]
let views = [
"segmentImageView": segmentImageView,
"segmentTitleLabel": segmentTitleLabel
"imageContainerView": imageContainerView,
"containerView": containerView
]
// main constraints
let segmentImageViewVerticalConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[segmentImageView(labelHeight)]",
options: [.AlignAllCenterY],
let segmentImageViewVerticalConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "V:[imageContainerView(labelHeight)]",
options: [.alignAllCenterY],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(segmentImageViewVerticalConstraint)
NSLayoutConstraint.activate(segmentImageViewVerticalConstraint)
let contentViewHorizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentImageView(labelHeight)]-[segmentTitleLabel]-|",
options: [.AlignAllCenterY],
let contentViewHorizontalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "|-[imageContainerView(labelHeight)]-[containerView]-|",
options: [.alignAllCenterY],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(contentViewHorizontalConstraints)
NSLayoutConstraint.activate(contentViewHorizontalConstraints)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .Top,
relatedBy: .Equal,
item: containerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentTitleLabel,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: containerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -11,65 +11,69 @@ import UIKit
class SegmentioCellWithImageOverLabel: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentImageView = segmentImageView else {
super.setupConstraintsForSubviews()
guard let imageContainerView = imageContainerView else {
return
}
guard let segmentTitleLabel = segmentTitleLabel else {
guard let containerView = containerView else {
return
}
let metrics = ["labelHeight": segmentTitleLabelHeight]
let views = [
"segmentImageView": segmentImageView,
"segmentTitleLabel": segmentTitleLabel
"imageContainerView": imageContainerView,
"containerView": containerView
]
// main constraints
let segmentImageViewHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentImageView]-|",
let segmentImageViewHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|-[imageContainerView]-|",
options: [],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints(segmentImageViewHorizontConstraint)
NSLayoutConstraint.activate(segmentImageViewHorizontConstraint)
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentTitleLabel]-|",
options: [],
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|-[containerView]-|",
options: [.alignAllCenterX],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints(segmentTitleLabelHorizontConstraint)
views: views
)
let contentViewVerticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[segmentImageView]-[segmentTitleLabel(labelHeight)]",
NSLayoutConstraint.activate(segmentTitleLabelHorizontConstraint)
let contentViewVerticalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "V:[imageContainerView]-[containerView(labelHeight)]",
options: [],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(contentViewVerticalConstraints)
NSLayoutConstraint.activate(contentViewVerticalConstraints)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentImageView,
attribute: .Top,
relatedBy: .Equal,
item: imageContainerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentTitleLabel,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: containerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -11,65 +11,67 @@ import UIKit
class SegmentioCellWithImageUnderLabel: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentImageView = segmentImageView else {
super.setupConstraintsForSubviews()
guard let imageContainerView = imageContainerView else {
return
}
guard let segmentTitleLabel = segmentTitleLabel else {
guard let containerView = containerView else {
return
}
let metrics = ["labelHeight": segmentTitleLabelHeight]
let views = [
"segmentImageView": segmentImageView,
"segmentTitleLabel": segmentTitleLabel
"imageContainerView": imageContainerView,
"containerView": containerView
]
// main constraints
let segmentImageViewHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentImageView]-|",
let segmentImageViewHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|-[imageContainerView]-|",
options: [],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints(segmentImageViewHorizontConstraint)
NSLayoutConstraint.activate(segmentImageViewHorizontConstraint)
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentTitleLabel]-|",
options: [],
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|-[containerView]-|",
options: [.alignAllCenterX],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints(segmentTitleLabelHorizontConstraint)
views: views
)
NSLayoutConstraint.activate(segmentTitleLabelHorizontConstraint)
let contentViewVerticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[segmentTitleLabel(labelHeight)]-[segmentImageView]",
let contentViewVerticalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "V:[containerView(labelHeight)]-[imageContainerView]",
options: [],
metrics: metrics,
views: views)
NSLayoutConstraint.activateConstraints(contentViewVerticalConstraints)
NSLayoutConstraint.activate(contentViewVerticalConstraints)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .Top,
relatedBy: .Equal,
item: containerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentImageView,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: imageContainerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -11,45 +11,47 @@ import UIKit
final class SegmentioCellWithLabel: SegmentioCell {
override func setupConstraintsForSubviews() {
guard let segmentTitleLabel = segmentTitleLabel else {
super.setupConstraintsForSubviews()
guard let containerView = containerView else {
return
}
let views = ["segmentTitleLabel": segmentTitleLabel]
let views = ["containerView": containerView]
// main constraints
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraintsWithVisualFormat(
"|-[segmentTitleLabel]-|",
options: [],
let segmentTitleLabelHorizontConstraint = NSLayoutConstraint.constraints(
withVisualFormat: "|[containerView]|", //changed from |-[containerView]-|. remove standard space
options: [.alignAllCenterX],
metrics: nil,
views: views
)
NSLayoutConstraint.activateConstraints(segmentTitleLabelHorizontConstraint)
NSLayoutConstraint.activate(segmentTitleLabelHorizontConstraint)
// custom constraints
topConstraint = NSLayoutConstraint(
item: segmentTitleLabel,
attribute: .Top,
relatedBy: .Equal,
item: containerView,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: padding
)
topConstraint?.active = true
topConstraint?.isActive = true
bottomConstraint = NSLayoutConstraint(
item: contentView,
attribute: .Bottom,
relatedBy: .Equal,
toItem: segmentTitleLabel,
attribute: .Bottom,
attribute: .bottom,
relatedBy: .equal,
toItem: containerView,
attribute: .bottom,
multiplier: 1,
constant: padding
)
bottomConstraint?.active = true
bottomConstraint?.isActive = true
}
}
}

View File

@ -0,0 +1,23 @@
import Foundation
@IBDesignable
class RoundImageView: UIImageView {
override var bounds: CGRect {
didSet {
updateCornerRadiusValue()
}
}
override func awakeFromNib() {
super.awakeFromNib()
updateCornerRadiusValue()
}
fileprivate func updateCornerRadiusValue() {
let cornerRadius = min(bounds.size.height, bounds.size.width) / 2
layer.cornerRadius = cornerRadius
}
}

View File

@ -8,34 +8,40 @@
import UIKit
private typealias SubviewTreeModifier = (Void -> UIView)
private typealias SubviewTreeModifier = ((Void) -> UIView)
public struct AppearanceOptions: OptionSetType {
public struct AppearanceOptions: OptionSet {
public static let overlay = AppearanceOptions(rawValue: 1 << 0)
public static let useAutoresize = AppearanceOptions(rawValue: 1 << 1)
public let rawValue: UInt
public init(rawValue: UInt) { self.rawValue = rawValue }
public static let Overlay = AppearanceOptions(rawValue: 1 << 0)
public static let UseAutoresize = AppearanceOptions(rawValue: 1 << 1)
public init(rawValue: UInt) {
self.rawValue = rawValue
}
}
extension UIView {
private func addSubviewUsingOptions(options: AppearanceOptions, modifier: SubviewTreeModifier) {
fileprivate func addSubviewUsingOptions(_ options: AppearanceOptions, modifier: SubviewTreeModifier) {
let subview = modifier()
if options.union(.Overlay) == .Overlay {
if options.union(.UseAutoresize) != .UseAutoresize {
if options.union(.overlay) == .overlay {
if options.union(.useAutoresize) != .useAutoresize {
subview.translatesAutoresizingMaskIntoConstraints = false
let views = dictionaryOfNames([subview])
let horisontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"|[subview]|",
let horisontalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "|[subview]|",
options: [],
metrics: nil,
views: views
)
addConstraints(horisontalConstraints)
let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat(
"V:|[subview]|",
let verticalConstraints = NSLayoutConstraint.constraints(
withVisualFormat: "V:|[subview]|",
options: [],
metrics: nil,
views: views
@ -44,14 +50,14 @@ extension UIView {
} else {
frame = bounds
subview.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
subview.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}
}
private func dictionaryOfNames(views:[UIView]) -> [String: UIView] {
fileprivate func dictionaryOfNames(_ views: [UIView]) -> [String: UIView] {
var container = [String: UIView]()
for (_, value) in views.enumerate() {
for (_, value) in views.enumerated() {
container["subview"] = value
}
return container
@ -59,7 +65,7 @@ extension UIView {
// MARK: - Interface methods
public func addSubview(subview: UIView, options: AppearanceOptions) {
public func addSubview(_ subview: UIView, options: AppearanceOptions) {
if subview.superview == self {
return
}
@ -69,14 +75,14 @@ extension UIView {
}
}
public func insertSubview(subview: UIView, index: Int, options: AppearanceOptions) {
public func insertSubview(_ subview: UIView, index: Int, options: AppearanceOptions) {
if subview.superview == self {
return
}
addSubviewUsingOptions(options) { [weak self] in
self?.insertSubview(subview, atIndex: index)
self?.insertSubview(subview, at: index)
return subview
}
}
}
}

View File

@ -9,11 +9,9 @@
import UIKit
import QuartzCore
public typealias SegmentioSelectionCallback = ((segmentio: Segmentio, selectedSegmentioIndex: Int) -> Void)
public typealias SegmentioSelectionCallback = ((_ segmentio: Segmentio, _ selectedSegmentioIndex: Int) -> Void)
private let animationDuration: CFTimeInterval = 0.3
public class Segmentio: UIView {
open class Segmentio: UIView {
internal struct Points {
var startPoint: CGPoint
@ -36,41 +34,29 @@ public class Segmentio: UIView {
var endX: CGFloat
}
public var valueDidChange: SegmentioSelectionCallback?
public var selectedSegmentioIndex = -1 {
open var valueDidChange: SegmentioSelectionCallback?
open var selectedSegmentioIndex = -1 {
didSet {
if selectedSegmentioIndex != oldValue {
reloadSegmentio()
valueDidChange?(segmentio: self, selectedSegmentioIndex: selectedSegmentioIndex)
valueDidChange?(self, selectedSegmentioIndex)
}
}
}
open fileprivate(set) var segmentioItems = [SegmentioItem]()
fileprivate var segmentioCollectionView: UICollectionView?
fileprivate var segmentioOptions = SegmentioOptions()
fileprivate var segmentioStyle = SegmentioStyle.imageOverLabel
fileprivate var isPerformingScrollAnimation = false
private var segmentioCollectionView: UICollectionView?
private var segmentioItems = [SegmentioItem]()
private var segmentioOptions = SegmentioOptions()
private var segmentioStyle = SegmentioStyle.ImageOverLabel
private var isPerformingScrollAnimation = false
private var topSeparatorView: UIView?
private var bottomSeparatorView: UIView?
private var indicatorLayer: CAShapeLayer?
private var selectedLayer: CAShapeLayer?
private var cachedOrientation: UIInterfaceOrientation? = UIApplication.sharedApplication().statusBarOrientation {
didSet {
if cachedOrientation != oldValue {
reloadSegmentio()
}
}
}
fileprivate var topSeparatorView: UIView?
fileprivate var bottomSeparatorView: UIView?
fileprivate var indicatorLayer: CAShapeLayer?
fileprivate var selectedLayer: CAShapeLayer?
// MARK: - Lifecycle
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
@ -81,20 +67,19 @@ public class Segmentio: UIView {
commonInit()
}
private func commonInit() {
setupSegmentedCollectionView()
NSNotificationCenter.defaultCenter().addObserver(
self,
selector: #selector(Segmentio.handleOrientationNotification),
name: UIDeviceOrientationDidChangeNotification,
object: nil
)
open override func layoutSubviews() {
super.layoutSubviews()
reloadSegmentio()
}
private func setupSegmentedCollectionView() {
fileprivate func commonInit() {
setupSegmentedCollectionView()
}
fileprivate func setupSegmentedCollectionView() {
let layout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsetsZero
layout.scrollDirection = .Horizontal
layout.sectionInset = UIEdgeInsets.zero
layout.scrollDirection = .horizontal
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
@ -105,21 +90,21 @@ public class Segmentio: UIView {
collectionView.dataSource = self
collectionView.delegate = self
collectionView.pagingEnabled = false
collectionView.isPagingEnabled = false
collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.bounces = true
collectionView.scrollEnabled = segmentioOptions.scrollEnabled
collectionView.backgroundColor = UIColor.clearColor()
collectionView.isScrollEnabled = segmentioOptions.scrollEnabled
collectionView.backgroundColor = .clear
segmentioCollectionView = collectionView
if let segmentioCollectionView = segmentioCollectionView {
addSubview(segmentioCollectionView, options: .Overlay)
addSubview(segmentioCollectionView, options: .overlay)
}
}
private func frameForSegmentCollectionView() -> CGRect {
fileprivate func frameForSegmentCollectionView() -> CGRect {
var separatorsHeight: CGFloat = 0
var collectionViewFrameMinY: CGFloat = 0
@ -127,12 +112,12 @@ public class Segmentio: UIView {
let separatorHeight = horizontalSeparatorOptions.height
switch horizontalSeparatorOptions.type {
case .Top:
case .top:
collectionViewFrameMinY = separatorHeight
separatorsHeight = separatorHeight
case .Bottom:
case .bottom:
separatorsHeight = separatorHeight
case .TopAndBottom:
case .topAndBottom:
collectionViewFrameMinY = separatorHeight
separatorsHeight = separatorHeight * 2
}
@ -146,16 +131,10 @@ public class Segmentio: UIView {
)
}
// MARK: - Handle orientation notification
@objc private func handleOrientationNotification() {
cachedOrientation = UIApplication.sharedApplication().statusBarOrientation
}
// MARK: - Setups:
// MARK: Main setup
public func setup(content content: [SegmentioItem], style: SegmentioStyle, options: SegmentioOptions?) {
open func setup(content: [SegmentioItem], style: SegmentioStyle, options: SegmentioOptions?) {
segmentioItems = content
segmentioStyle = style
@ -164,13 +143,13 @@ public class Segmentio: UIView {
if let options = options {
segmentioOptions = options
segmentioCollectionView?.scrollEnabled = segmentioOptions.scrollEnabled
segmentioCollectionView?.isScrollEnabled = segmentioOptions.scrollEnabled
backgroundColor = options.backgroundColor
}
if segmentioOptions.states.selectedState.backgroundColor != UIColor.clearColor() {
if segmentioOptions.states.selectedState.backgroundColor != .clear {
selectedLayer = CAShapeLayer()
if let selectedLayer = selectedLayer, sublayer = segmentioCollectionView?.layer {
if let selectedLayer = selectedLayer, let sublayer = segmentioCollectionView?.layer {
setupShapeLayer(
shapeLayer: selectedLayer,
backgroundColor: segmentioOptions.states.selectedState.backgroundColor,
@ -197,33 +176,43 @@ public class Segmentio: UIView {
segmentioCollectionView?.reloadData()
}
public override func didMoveToSuperview() {
open override func didMoveToSuperview() {
super.didMoveToSuperview()
setupHorizontalSeparatorIfPossible()
}
open func addBadge(at index: Int, count: Int, color: UIColor = .red) {
segmentioItems[index].addBadge(count, color: color)
segmentioCollectionView?.reloadData()
}
open func removeBadge(at index: Int) {
segmentioItems[index].removeBadge()
segmentioCollectionView?.reloadData()
}
// MARK: Collection view setup
private func setupCellWithStyle(style: SegmentioStyle) {
fileprivate func setupCellWithStyle(_ style: SegmentioStyle) {
var cellClass: SegmentioCell.Type {
switch style {
case .OnlyLabel:
case .onlyLabel:
return SegmentioCellWithLabel.self
case .OnlyImage:
case .onlyImage:
return SegmentioCellWithImage.self
case .ImageOverLabel:
case .imageOverLabel:
return SegmentioCellWithImageOverLabel.self
case .ImageUnderLabel:
case .imageUnderLabel:
return SegmentioCellWithImageUnderLabel.self
case .ImageBeforeLabel:
case .imageBeforeLabel:
return SegmentioCellWithImageBeforeLabel.self
case .ImageAfterLabel:
case .imageAfterLabel:
return SegmentioCellWithImageAfterLabel.self
}
}
segmentioCollectionView?.registerClass(
segmentioCollectionView?.register(
cellClass,
forCellWithReuseIdentifier: segmentioStyle.rawValue
)
@ -233,13 +222,13 @@ public class Segmentio: UIView {
// MARK: Horizontal separators setup
private func setupHorizontalSeparatorIfPossible() {
fileprivate func setupHorizontalSeparatorIfPossible() {
if superview != nil && segmentioOptions.horizontalSeparatorOptions != nil {
setupHorizontalSeparator()
}
}
private func setupHorizontalSeparator() {
fileprivate func setupHorizontalSeparator() {
topSeparatorView?.removeFromSuperview()
bottomSeparatorView?.removeFromSuperview()
@ -250,16 +239,16 @@ public class Segmentio: UIView {
let height = horizontalSeparatorOptions.height
let type = horizontalSeparatorOptions.type
if type == .Top || type == .TopAndBottom {
topSeparatorView = UIView(frame: CGRectZero)
if type == .top || type == .topAndBottom {
topSeparatorView = UIView(frame: CGRect.zero)
setupConstraintsForSeparatorView(
separatorView: topSeparatorView,
originY: 0
)
}
if type == .Bottom || type == .TopAndBottom {
bottomSeparatorView = UIView(frame: CGRectZero)
if type == .bottom || type == .topAndBottom {
bottomSeparatorView = UIView(frame: CGRect.zero)
setupConstraintsForSeparatorView(
separatorView: bottomSeparatorView,
originY: frame.maxY - height
@ -267,8 +256,8 @@ public class Segmentio: UIView {
}
}
private func setupConstraintsForSeparatorView(separatorView separatorView: UIView?, originY: CGFloat) {
guard let horizontalSeparatorOptions = segmentioOptions.horizontalSeparatorOptions, separatorView = separatorView else {
fileprivate func setupConstraintsForSeparatorView(separatorView: UIView?, originY: CGFloat) {
guard let horizontalSeparatorOptions = segmentioOptions.horizontalSeparatorOptions, let separatorView = separatorView else {
return
}
@ -278,61 +267,62 @@ public class Segmentio: UIView {
let topConstraint = NSLayoutConstraint(
item: separatorView,
attribute: .Top,
relatedBy: .Equal,
attribute: .top,
relatedBy: .equal,
toItem: superview,
attribute: .Top,
attribute: .top,
multiplier: 1,
constant: originY
)
topConstraint.active = true
topConstraint.isActive = true
let leadingConstraint = NSLayoutConstraint(
item: separatorView,
attribute: .Leading,
relatedBy: .Equal,
attribute: .leading,
relatedBy: .equal,
toItem: self,
attribute: .Leading,
attribute: .leading,
multiplier: 1,
constant: 0
)
leadingConstraint.active = true
leadingConstraint.isActive = true
let trailingConstraint = NSLayoutConstraint(
item: separatorView,
attribute: .Trailing,
relatedBy: .Equal,
attribute: .trailing,
relatedBy: .equal,
toItem: self,
attribute: .Trailing,
attribute: .trailing,
multiplier: 1,
constant: 0
)
trailingConstraint.active = true
trailingConstraint.isActive = true
let heightConstraint = NSLayoutConstraint(
item: separatorView,
attribute: .Height,
relatedBy: .Equal,
attribute: .height,
relatedBy: .equal,
toItem: nil,
attribute: .NotAnAttribute,
attribute: .notAnAttribute,
multiplier: 1,
constant: horizontalSeparatorOptions.height
)
heightConstraint.active = true
heightConstraint.isActive = true
}
// MARK: CAShapeLayers setup
private func setupShapeLayer(shapeLayer shapeLayer: CAShapeLayer, backgroundColor: UIColor, height: CGFloat, sublayer: CALayer) {
shapeLayer.fillColor = backgroundColor.CGColor
shapeLayer.strokeColor = backgroundColor.CGColor
fileprivate func setupShapeLayer(shapeLayer: CAShapeLayer, backgroundColor: UIColor, height: CGFloat, sublayer: CALayer) {
shapeLayer.fillColor = backgroundColor.cgColor
shapeLayer.strokeColor = backgroundColor.cgColor
shapeLayer.lineWidth = height
layer.insertSublayer(shapeLayer, below: sublayer)
}
// MARK: - Actions:
// MARK: Reload segmentio
private func reloadSegmentio() {
public func reloadSegmentio() {
segmentioCollectionView?.collectionViewLayout.invalidateLayout()
segmentioCollectionView?.reloadData()
scrollToItemAtContext()
moveShapeLayerAtContext()
@ -340,7 +330,7 @@ public class Segmentio: UIView {
// MARK: Move shape layer to item
private func moveShapeLayerAtContext() {
fileprivate func moveShapeLayerAtContext() {
if let indicatorLayer = indicatorLayer, let options = segmentioOptions.indicatorOptions {
let item = itemInSuperview(ratio: options.ratio)
let context = contextForItem(item)
@ -380,8 +370,8 @@ public class Segmentio: UIView {
// MARK: Scroll to item
private func scrollToItemAtContext() {
guard let numberOfSections = segmentioCollectionView?.numberOfSections() else {
fileprivate func scrollToItemAtContext() {
guard let numberOfSections = segmentioCollectionView?.numberOfSections else {
return
}
@ -390,20 +380,21 @@ public class Segmentio: UIView {
if context.isLastOrPrelastVisibleCell == true {
let newIndex = selectedSegmentioIndex + (context.isLastCell ? 0 : 1)
let newIndexPath = NSIndexPath(forItem: newIndex, inSection: numberOfSections - 1)
segmentioCollectionView?.scrollToItemAtIndexPath(
newIndexPath,
atScrollPosition: .None,
let newIndexPath = IndexPath(item: newIndex, section: numberOfSections - 1)
segmentioCollectionView?.scrollToItem(
at: newIndexPath,
at: UICollectionViewScrollPosition(),
animated: true
)
}
if context.isFirstOrSecondVisibleCell == true {
if context.isFirstOrSecondVisibleCell == true && selectedSegmentioIndex != -1 {
let newIndex = selectedSegmentioIndex - (context.isFirstIndex ? 1 : 0)
let newIndexPath = NSIndexPath(forItem: newIndex, inSection: numberOfSections - 1)
segmentioCollectionView?.scrollToItemAtIndexPath(
newIndexPath,
atScrollPosition: .None,
let newIndexPath = IndexPath(item: newIndex, section: numberOfSections - 1)
segmentioCollectionView?.scrollToItem(
at: newIndexPath,
at: UICollectionViewScrollPosition(),
animated: true
)
}
@ -411,38 +402,38 @@ public class Segmentio: UIView {
// MARK: Move shape layer
private func moveShapeLayer(shapeLayer: CAShapeLayer, startPoint: CGPoint, endPoint: CGPoint, animated: Bool = false) {
fileprivate func moveShapeLayer(_ shapeLayer: CAShapeLayer, startPoint: CGPoint, endPoint: CGPoint, animated: Bool = false) {
var endPointWithVerticalSeparator = endPoint
let isLastItem = selectedSegmentioIndex + 1 == segmentioItems.count
endPointWithVerticalSeparator.x = endPoint.x - (isLastItem ? 0 : 1)
let shapeLayerPath = UIBezierPath()
shapeLayerPath.moveToPoint(startPoint)
shapeLayerPath.addLineToPoint(endPointWithVerticalSeparator)
shapeLayerPath.move(to: startPoint)
shapeLayerPath.addLine(to: endPointWithVerticalSeparator)
if animated == true {
isPerformingScrollAnimation = true
userInteractionEnabled = false
isUserInteractionEnabled = false
CATransaction.begin()
let animation = CABasicAnimation(keyPath: "path")
animation.fromValue = shapeLayer.path
animation.toValue = shapeLayerPath.CGPath
animation.duration = animationDuration
animation.toValue = shapeLayerPath.cgPath
animation.duration = segmentioOptions.animationDuration
CATransaction.setCompletionBlock() {
self.isPerformingScrollAnimation = false
self.userInteractionEnabled = true
self.isUserInteractionEnabled = true
}
shapeLayer.addAnimation(animation, forKey: "path")
shapeLayer.add(animation, forKey: "path")
CATransaction.commit()
}
shapeLayer.path = shapeLayerPath.CGPath
shapeLayer.path = shapeLayerPath.cgPath
}
// MARK: - Context for item
private func contextForItem(item: ItemInSuperview) -> Context {
fileprivate func contextForItem(_ item: ItemInSuperview) -> Context {
let cellFrame = item.cellFrameInSuperview
let cellWidth = cellFrame.width
let lastCellMinX = floor(item.collectionViewWidth - cellWidth)
@ -466,10 +457,10 @@ public class Segmentio: UIView {
// MARK: - Item in superview
private func itemInSuperview(ratio ratio: CGFloat = 1) -> ItemInSuperview {
fileprivate func itemInSuperview(ratio: CGFloat = 1) -> ItemInSuperview {
var collectionViewWidth: CGFloat = 0
var cellWidth: CGFloat = 0
var cellRect = CGRectZero
var cellRect = CGRect.zero
var shapeLayerWidth: CGFloat = 0
if let collectionView = segmentioCollectionView {
@ -498,7 +489,7 @@ public class Segmentio: UIView {
// MARK: - Indicator point Y
private func indicatorPointY() -> CGFloat {
fileprivate func indicatorPointY() -> CGFloat {
var indicatorPointY: CGFloat = 0
guard let indicatorOptions = segmentioOptions.indicatorOptions else {
@ -506,9 +497,9 @@ public class Segmentio: UIView {
}
switch indicatorOptions.type {
case .Top:
case .top:
indicatorPointY = (indicatorOptions.height / 2)
case .Bottom:
case .bottom:
indicatorPointY = frame.height - (indicatorOptions.height / 2)
}
@ -517,14 +508,14 @@ public class Segmentio: UIView {
}
let separatorHeight = horizontalSeparatorOptions.height
let isIndicatorTop = indicatorOptions.type == .Top
let isIndicatorTop = indicatorOptions.type == .top
switch horizontalSeparatorOptions.type {
case .Top:
case .top:
indicatorPointY = isIndicatorTop ? indicatorPointY + separatorHeight : indicatorPointY
case .Bottom:
case .bottom:
indicatorPointY = isIndicatorTop ? indicatorPointY : indicatorPointY - separatorHeight
case .TopAndBottom:
case .topAndBottom:
indicatorPointY = isIndicatorTop ? indicatorPointY + separatorHeight : indicatorPointY - separatorHeight
}
@ -536,14 +527,14 @@ public class Segmentio: UIView {
extension Segmentio: UICollectionViewDataSource {
public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return segmentioItems.count ?? 0
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return segmentioItems.count
}
public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(
segmentioStyle.rawValue,
forIndexPath: indexPath) as! SegmentioCell
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: segmentioStyle.rawValue,
for: indexPath) as! SegmentioCell
cell.configure(
content: segmentioItems[indexPath.row],
@ -563,11 +554,11 @@ extension Segmentio: UICollectionViewDataSource {
extension Segmentio: UICollectionViewDelegate {
public func collectionView(collectionView: UICollectionView, shouldSelectItemAtIndexPath indexPath: NSIndexPath) -> Bool {
public func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
return true
}
public func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectedSegmentioIndex = indexPath.row
}
@ -577,12 +568,9 @@ extension Segmentio: UICollectionViewDelegate {
extension Segmentio: UICollectionViewDelegateFlowLayout {
public func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let maxVisibleItems = segmentioOptions.maxVisibleItems > segmentioItems.count ? CGFloat(segmentioItems.count) : CGFloat(segmentioOptions.maxVisibleItems)
return CGSize(
width: floor(collectionView.frame.width / maxVisibleItems),
height: collectionView.frame.height
)
return CGSize( width: floor(collectionView.frame.width / maxVisibleItems), height: collectionView.frame.height)
}
}
@ -591,17 +579,17 @@ extension Segmentio: UICollectionViewDelegateFlowLayout {
extension Segmentio: UIScrollViewDelegate {
public func scrollViewDidScroll(scrollView: UIScrollView) {
if isPerformingScrollAnimation == true {
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
if isPerformingScrollAnimation {
return
}
if let options = segmentioOptions.indicatorOptions, indicatorLayer = indicatorLayer {
if let options = segmentioOptions.indicatorOptions, let indicatorLayer = indicatorLayer {
let item = itemInSuperview(ratio: options.ratio)
moveShapeLayer(
indicatorLayer,
startPoint: CGPointMake(item.startX, indicatorPointY()),
endPoint: CGPointMake(item.endX, indicatorPointY()),
startPoint: CGPoint(x: item.startX, y: indicatorPointY()),
endPoint: CGPoint(x: item.endX, y: indicatorPointY()),
animated: false
)
}
@ -620,6 +608,7 @@ extension Segmentio: UIScrollViewDelegate {
}
extension Segmentio.Points {
init(context: Segmentio.Context, item: Segmentio.ItemInSuperview, pointY: CGFloat) {
let cellWidth = item.cellFrameInSuperview.width
@ -656,4 +645,4 @@ extension Segmentio.Points {
endPoint = CGPoint(x: endX, y: pointY)
}
}
}

View File

@ -11,27 +11,41 @@ import UIKit
// MARK: - Item
public struct SegmentioItem {
var title: String?
var image: UIImage?
public var title: String?
public var image: UIImage?
public var badgeCount: Int?
public var badgeColor: UIColor?
public init(title: String?, image: UIImage?) {
self.title = title
self.image = image
}
public mutating func addBadge(_ count: Int, color: UIColor) {
self.badgeCount = count
self.badgeColor = color
}
public mutating func removeBadge() {
self.badgeCount = nil
self.badgeColor = nil
}
}
// MARK: - Content view
public struct SegmentioState {
var backgroundColor: UIColor
var titleFont: UIFont
var titleTextColor: UIColor
public init(
backgroundColor: UIColor = UIColor.clearColor(),
titleFont: UIFont = UIFont.systemFontOfSize(UIFont.smallSystemFontSize()),
titleTextColor: UIColor = UIColor.blackColor()) {
backgroundColor: UIColor = .clear,
titleFont: UIFont = UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
titleTextColor: UIColor = .black) {
self.backgroundColor = backgroundColor
self.titleFont = titleFont
self.titleTextColor = titleTextColor
@ -42,18 +56,20 @@ public struct SegmentioState {
// MARK: - Horizontal separator
public enum SegmentioHorizontalSeparatorType {
case Top, Bottom, TopAndBottom
case top
case bottom
case topAndBottom
}
public struct SegmentioHorizontalSeparatorOptions {
var type: SegmentioHorizontalSeparatorType
var height: CGFloat
var color: UIColor
public init(
type: SegmentioHorizontalSeparatorType = .TopAndBottom,
height: CGFloat = 1.0,
color: UIColor = UIColor.darkGrayColor()) {
public init(type: SegmentioHorizontalSeparatorType = .topAndBottom, height: CGFloat = 1.0, color: UIColor = .darkGray) {
self.type = type
self.height = height
self.color = color
@ -64,10 +80,11 @@ public struct SegmentioHorizontalSeparatorOptions {
// MARK: - Vertical separator
public struct SegmentioVerticalSeparatorOptions {
var ratio: CGFloat
var color: UIColor
public init(ratio: CGFloat = 1.0, color: UIColor = UIColor.darkGrayColor()) {
public init(ratio: CGFloat = 1, color: UIColor = .darkGray) {
self.ratio = ratio
self.color = color
}
@ -77,20 +94,20 @@ public struct SegmentioVerticalSeparatorOptions {
// MARK: - Indicator
public enum SegmentioIndicatorType {
case Top, Bottom
case top
case bottom
}
public struct SegmentioIndicatorOptions {
var type: SegmentioIndicatorType
var ratio: CGFloat
var height: CGFloat
var color: UIColor
public init(
type: SegmentioIndicatorType = .Bottom,
ratio: CGFloat = 1.0,
height: CGFloat = 2.0,
color: UIColor = UIColor.orangeColor()) {
public init(type: SegmentioIndicatorType = .bottom, ratio: CGFloat = 1, height: CGFloat = 2, color: UIColor = .orange) {
self.type = type
self.ratio = ratio
self.height = height
@ -102,20 +119,21 @@ public struct SegmentioIndicatorOptions {
// MARK: - Control options
public enum SegmentioStyle: String {
case OnlyLabel, OnlyImage, ImageOverLabel, ImageUnderLabel, ImageBeforeLabel, ImageAfterLabel
case onlyLabel, onlyImage, imageOverLabel, imageUnderLabel, imageBeforeLabel, imageAfterLabel
public static let allStyles = [
OnlyLabel,
OnlyImage,
ImageOverLabel,
ImageUnderLabel,
ImageBeforeLabel,
ImageAfterLabel
onlyLabel,
onlyImage,
imageOverLabel,
imageUnderLabel,
imageBeforeLabel,
imageAfterLabel
]
public func isWithText() -> Bool {
switch self {
case .OnlyLabel, .ImageOverLabel, .ImageUnderLabel, .ImageBeforeLabel, .ImageAfterLabel:
case .onlyLabel, .imageOverLabel, .imageUnderLabel, .imageBeforeLabel, .imageAfterLabel:
return true
default:
return false
@ -124,7 +142,7 @@ public enum SegmentioStyle: String {
public func isWithImage() -> Bool {
switch self {
case .ImageOverLabel, .ImageUnderLabel, .ImageBeforeLabel, .ImageAfterLabel, .OnlyImage:
case .imageOverLabel, .imageUnderLabel, .imageBeforeLabel, .imageAfterLabel, .onlyImage:
return true
default:
return false
@ -135,6 +153,7 @@ public enum SegmentioStyle: String {
public typealias SegmentioStates = (defaultState: SegmentioState, selectedState: SegmentioState, highlightedState: SegmentioState)
public struct SegmentioOptions {
var backgroundColor: UIColor
var maxVisibleItems: Int
var scrollEnabled: Bool
@ -143,10 +162,12 @@ public struct SegmentioOptions {
var indicatorOptions: SegmentioIndicatorOptions?
var imageContentMode: UIViewContentMode
var labelTextAlignment: NSTextAlignment
var labelTextNumberOfLines: Int
var states: SegmentioStates
var animationDuration: CFTimeInterval
public init() {
self.backgroundColor = UIColor.lightGrayColor()
self.backgroundColor = .lightGray
self.maxVisibleItems = 4
self.scrollEnabled = true
@ -155,17 +176,19 @@ public struct SegmentioOptions {
self.indicatorOptions = SegmentioIndicatorOptions()
self.imageContentMode = .Center
self.labelTextAlignment = .Center
self.imageContentMode = .center
self.labelTextAlignment = .center
self.labelTextNumberOfLines = 0
self.states = SegmentioStates(
defaultState: SegmentioState(),
selectedState: 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, segmentStates: SegmentioStates) {
public init(backgroundColor: UIColor, maxVisibleItems: Int, scrollEnabled: Bool, indicatorOptions: SegmentioIndicatorOptions?, horizontalSeparatorOptions: SegmentioHorizontalSeparatorOptions?, verticalSeparatorOptions: SegmentioVerticalSeparatorOptions?, imageContentMode: UIViewContentMode, labelTextAlignment: NSTextAlignment, labelTextNumberOfLines: Int, segmentStates: SegmentioStates, animationDuration: CFTimeInterval) {
self.backgroundColor = backgroundColor
self.maxVisibleItems = maxVisibleItems
self.scrollEnabled = scrollEnabled
@ -174,7 +197,9 @@ public struct SegmentioOptions {
self.verticalSeparatorOptions = verticalSeparatorOptions
self.imageContentMode = imageContentMode
self.labelTextAlignment = labelTextAlignment
self.labelTextNumberOfLines = labelTextNumberOfLines
self.states = segmentStates
self.animationDuration = animationDuration
}
}
}