├── .gitignore ├── .swift-version ├── Classes ├── OTSortButton.swift └── OTSortButtonImages.xcassets │ ├── Contents.json │ ├── ots_sort_ascend.imageset │ ├── Contents.json │ └── triangle_sort_up@2x.png │ ├── ots_sort_descend.imageset │ ├── Contents.json │ └── triangle_sort_down@2x.png │ └── ots_sort_none.imageset │ ├── Contents.json │ └── triangle_sort_normal@2x.png ├── DemoApplication ├── DemoApplication.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcuserdata │ │ └── Mac.xcuserdatad │ │ └── xcschemes │ │ ├── DemoApplication.xcscheme │ │ └── xcschememanagement.plist ├── DemoApplication │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── sort_background_ascend.imageset │ │ │ ├── Contents.json │ │ │ └── sort_background_ascend.png │ │ └── sort_background_descend.imageset │ │ │ ├── Contents.json │ │ │ └── sort_background_descend.png │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Extension │ │ ├── Date+differenceDays.swift │ │ ├── Date+fromString.swift │ │ └── String+fromDate.swift │ ├── Info.plist │ ├── Struct │ │ └── Constant.swift │ └── ViewController │ │ ├── Cell │ │ ├── TableViewCell.swift │ │ └── TableViewCell.xib │ │ ├── ViewController.swift │ │ └── ViewController.xib ├── DemoApplicationTests │ ├── DemoApplicationTests.swift │ └── Info.plist └── DemoApplicationUITests │ ├── DemoApplicationUITests.swift │ └── Info.plist ├── LICENSE ├── OTSortButton.podspec ├── OTSortButton.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── OTSortButton.xcscheme ├── OTSortButton ├── OTSortButton │ ├── Info.plist │ └── OTSortButton.h └── OTSortButtonTests │ ├── Info.plist │ └── OTSortButtonTests.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode (from gitignore.io) 2 | build/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | *.moved-aside 14 | DerivedData 15 | *.hmap 16 | *.ipa 17 | *.xcuserstate 18 | 19 | # CocoaPod 20 | Pods/* 21 | Podfile.lock 22 | 23 | # Carthage 24 | Carthage/Build 25 | 26 | # others 27 | *.swp 28 | !.gitkeep 29 | .DS_Store 30 | UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /Classes/OTSortButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OTSortButton.swift 3 | // OTSortButton 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | // https://github.com/PKPK-Carnage/OTSortButton 9 | 10 | /** 11 | [OTSortButton] 12 | 13 | Copyright (c) [2017] [Tomosuke Okada] 14 | 15 | This software is released under the MIT License. 16 | http://opensource.org/licenses/mit-license.ph 17 | 18 | */ 19 | 20 | import UIKit 21 | 22 | public enum SortType { 23 | case none 24 | case ascend 25 | case descend 26 | } 27 | 28 | 29 | public class OTSortButton: UIButton { 30 | 31 | 32 | //MARK: Color 33 | @IBInspectable public var noneTextColor: UIColor = UIColor.lightGray 34 | @IBInspectable public var noneBackgroundColor: UIColor = UIColor.darkGray 35 | @IBInspectable public var noneBackgroundImage: UIImage? 36 | 37 | @IBInspectable public var ascendTextColor: UIColor = UIColor.black 38 | @IBInspectable public var ascendBackgroundColor: UIColor = UIColor.white 39 | @IBInspectable public var ascendImageColor: UIColor = UIColor.black 40 | @IBInspectable public var ascendBackgroundImage: UIImage? 41 | 42 | @IBInspectable public var descendTextColor: UIColor = UIColor.black 43 | @IBInspectable public var descendBackgroundColor: UIColor = UIColor.white 44 | @IBInspectable public var descendImageColor: UIColor = UIColor.black 45 | @IBInspectable public var descendBackgroundImage: UIImage? 46 | 47 | //MARK: Type 48 | public var sortType: SortType = .none { 49 | didSet { 50 | if sortType == .none { 51 | 52 | backgroundColor = noneBackgroundColor 53 | setImage(noneImage, for: .normal) 54 | setTitleColor(noneTextColor, for: .normal) 55 | tintColor = UIColor.clear 56 | setBackgroundImage(noneBackgroundImage, for: .normal) 57 | 58 | } else if sortType == .ascend { 59 | 60 | backgroundColor = ascendBackgroundColor 61 | setImage(ascendImage, for: .normal) 62 | setTitleColor(ascendTextColor, for: .normal) 63 | tintColor = ascendImageColor 64 | setBackgroundImage(ascendBackgroundImage, for: .normal) 65 | 66 | } else if sortType == .descend { 67 | 68 | backgroundColor = descendBackgroundColor 69 | setImage(descendImage, for: .normal) 70 | setTitleColor(descendTextColor, for: .normal) 71 | tintColor = descendImageColor 72 | setBackgroundImage(descendBackgroundImage, for: .normal) 73 | 74 | } 75 | } 76 | } 77 | 78 | 79 | //MARK: Key 80 | public var sortKey = "" 81 | 82 | //MARK: Image 83 | private let ascendImage = UIImage(named: "ots_sort_ascend", in: Bundle(for: OTSortButton.self), compatibleWith: nil)!.withRenderingMode(.alwaysTemplate) 84 | private let descendImage = UIImage(named: "ots_sort_descend", in: Bundle(for: OTSortButton.self), compatibleWith: nil)!.withRenderingMode(.alwaysTemplate) 85 | private let noneImage = UIImage(named: "ots_sort_none", in: Bundle(for: OTSortButton.self), compatibleWith: nil)! 86 | 87 | 88 | //MARK: - Initialize 89 | override init(frame: CGRect) { 90 | super.init(frame: frame) 91 | initialize() 92 | } 93 | 94 | required public init?(coder aDecoder: NSCoder) { 95 | super.init(coder: aDecoder) 96 | initialize() 97 | } 98 | 99 | private func initialize() { 100 | 101 | sortType = .none 102 | 103 | transform = CGAffineTransform(scaleX: -1.0, y: 1.0) 104 | titleLabel?.transform = CGAffineTransform(scaleX: -1.0, y: 1.0) 105 | imageView?.transform = CGAffineTransform(scaleX: -1.0, y: 1.0) 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_ascend.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "triangle_sort_up@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_ascend.imageset/triangle_sort_up@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frog-Frog/OTSortButton/1064dbd039a5ede74e7ccbadadbb059033c6636f/Classes/OTSortButtonImages.xcassets/ots_sort_ascend.imageset/triangle_sort_up@2x.png -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_descend.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "triangle_sort_down@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_descend.imageset/triangle_sort_down@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frog-Frog/OTSortButton/1064dbd039a5ede74e7ccbadadbb059033c6636f/Classes/OTSortButtonImages.xcassets/ots_sort_descend.imageset/triangle_sort_down@2x.png -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_none.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "triangle_sort_normal@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Classes/OTSortButtonImages.xcassets/ots_sort_none.imageset/triangle_sort_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frog-Frog/OTSortButton/1064dbd039a5ede74e7ccbadadbb059033c6636f/Classes/OTSortButtonImages.xcassets/ots_sort_none.imageset/triangle_sort_normal@2x.png -------------------------------------------------------------------------------- /DemoApplication/DemoApplication.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 044AC1D71F6B3CD50094E476 /* OTSortButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 044AC1D31F6B39140094E476 /* OTSortButton.framework */; }; 11 | 044AC1D81F6B3CD50094E476 /* OTSortButton.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 044AC1D31F6B39140094E476 /* OTSortButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 12 | 04F65AB61F6AA63800CDB097 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65AB51F6AA63800CDB097 /* AppDelegate.swift */; }; 13 | 04F65ABB1F6AA63800CDB097 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AB91F6AA63800CDB097 /* Main.storyboard */; }; 14 | 04F65ABD1F6AA63800CDB097 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04F65ABC1F6AA63800CDB097 /* Assets.xcassets */; }; 15 | 04F65AC01F6AA63800CDB097 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F65ABE1F6AA63800CDB097 /* LaunchScreen.storyboard */; }; 16 | 04F65ACB1F6AA63800CDB097 /* DemoApplicationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65ACA1F6AA63800CDB097 /* DemoApplicationTests.swift */; }; 17 | 04F65AD61F6AA63800CDB097 /* DemoApplicationUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65AD51F6AA63800CDB097 /* DemoApplicationUITests.swift */; }; 18 | 04F65AFE1F6AAD1500CDB097 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AFD1F6AAD1500CDB097 /* ViewController.xib */; }; 19 | 04F65AFF1F6AAD1500CDB097 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AFD1F6AAD1500CDB097 /* ViewController.xib */; }; 20 | 04F65B001F6AAD1500CDB097 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AFD1F6AAD1500CDB097 /* ViewController.xib */; }; 21 | 04F65B021F6AAD2600CDB097 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B011F6AAD2600CDB097 /* ViewController.swift */; }; 22 | 04F65B031F6AAD2600CDB097 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B011F6AAD2600CDB097 /* ViewController.swift */; }; 23 | 04F65B041F6AAD2600CDB097 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B011F6AAD2600CDB097 /* ViewController.swift */; }; 24 | 04F65B0C1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B0A1F6AAD5A00CDB097 /* TableViewCell.swift */; }; 25 | 04F65B0D1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B0A1F6AAD5A00CDB097 /* TableViewCell.swift */; }; 26 | 04F65B0E1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B0A1F6AAD5A00CDB097 /* TableViewCell.swift */; }; 27 | 04F65B0F1F6AAD5A00CDB097 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65B0B1F6AAD5A00CDB097 /* TableViewCell.xib */; }; 28 | 04F65B101F6AAD5A00CDB097 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65B0B1F6AAD5A00CDB097 /* TableViewCell.xib */; }; 29 | 04F65B111F6AAD5A00CDB097 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04F65B0B1F6AAD5A00CDB097 /* TableViewCell.xib */; }; 30 | 04F65B121F6AB1F200CDB097 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AB91F6AA63800CDB097 /* Main.storyboard */; }; 31 | 04F65B141F6AB1F400CDB097 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F65AB91F6AA63800CDB097 /* Main.storyboard */; }; 32 | 04F65B171F6AC56E00CDB097 /* String+fromDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B161F6AC56E00CDB097 /* String+fromDate.swift */; }; 33 | 04F65B181F6AC56E00CDB097 /* String+fromDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B161F6AC56E00CDB097 /* String+fromDate.swift */; }; 34 | 04F65B191F6AC56E00CDB097 /* String+fromDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B161F6AC56E00CDB097 /* String+fromDate.swift */; }; 35 | 04F65B1B1F6AC58400CDB097 /* Date+fromString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B1A1F6AC58400CDB097 /* Date+fromString.swift */; }; 36 | 04F65B1C1F6AC58400CDB097 /* Date+fromString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B1A1F6AC58400CDB097 /* Date+fromString.swift */; }; 37 | 04F65B1D1F6AC58400CDB097 /* Date+fromString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B1A1F6AC58400CDB097 /* Date+fromString.swift */; }; 38 | 04F65B241F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B231F6ACAC500CDB097 /* Date+differenceDays.swift */; }; 39 | 04F65B251F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B231F6ACAC500CDB097 /* Date+differenceDays.swift */; }; 40 | 04F65B261F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B231F6ACAC500CDB097 /* Date+differenceDays.swift */; }; 41 | 04F65B291F6ACE6300CDB097 /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B281F6ACE6300CDB097 /* Constant.swift */; }; 42 | 04F65B2A1F6ACE6300CDB097 /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B281F6ACE6300CDB097 /* Constant.swift */; }; 43 | 04F65B2B1F6ACE6300CDB097 /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F65B281F6ACE6300CDB097 /* Constant.swift */; }; 44 | /* End PBXBuildFile section */ 45 | 46 | /* Begin PBXContainerItemProxy section */ 47 | 044AC1D21F6B39140094E476 /* PBXContainerItemProxy */ = { 48 | isa = PBXContainerItemProxy; 49 | containerPortal = 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */; 50 | proxyType = 2; 51 | remoteGlobalIDString = 04F65A8F1F6AA60400CDB097; 52 | remoteInfo = OTSortButton; 53 | }; 54 | 044AC1D41F6B39140094E476 /* PBXContainerItemProxy */ = { 55 | isa = PBXContainerItemProxy; 56 | containerPortal = 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */; 57 | proxyType = 2; 58 | remoteGlobalIDString = 04F65A981F6AA60500CDB097; 59 | remoteInfo = OTSortButtonTests; 60 | }; 61 | 044AC1D91F6B3CD50094E476 /* PBXContainerItemProxy */ = { 62 | isa = PBXContainerItemProxy; 63 | containerPortal = 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */; 64 | proxyType = 1; 65 | remoteGlobalIDString = 04F65A8E1F6AA60400CDB097; 66 | remoteInfo = OTSortButton; 67 | }; 68 | 04F65AC71F6AA63800CDB097 /* PBXContainerItemProxy */ = { 69 | isa = PBXContainerItemProxy; 70 | containerPortal = 04F65AAA1F6AA63800CDB097 /* Project object */; 71 | proxyType = 1; 72 | remoteGlobalIDString = 04F65AB11F6AA63800CDB097; 73 | remoteInfo = DemoApplication; 74 | }; 75 | 04F65AD21F6AA63800CDB097 /* PBXContainerItemProxy */ = { 76 | isa = PBXContainerItemProxy; 77 | containerPortal = 04F65AAA1F6AA63800CDB097 /* Project object */; 78 | proxyType = 1; 79 | remoteGlobalIDString = 04F65AB11F6AA63800CDB097; 80 | remoteInfo = DemoApplication; 81 | }; 82 | /* End PBXContainerItemProxy section */ 83 | 84 | /* Begin PBXCopyFilesBuildPhase section */ 85 | 04F65AFB1F6AA90700CDB097 /* Embed Frameworks */ = { 86 | isa = PBXCopyFilesBuildPhase; 87 | buildActionMask = 2147483647; 88 | dstPath = ""; 89 | dstSubfolderSpec = 10; 90 | files = ( 91 | 044AC1D81F6B3CD50094E476 /* OTSortButton.framework in Embed Frameworks */, 92 | ); 93 | name = "Embed Frameworks"; 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXCopyFilesBuildPhase section */ 97 | 98 | /* Begin PBXFileReference section */ 99 | 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OTSortButton.xcodeproj; path = ../OTSortButton.xcodeproj; sourceTree = ""; }; 100 | 04F65AB21F6AA63800CDB097 /* DemoApplication.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApplication.app; sourceTree = BUILT_PRODUCTS_DIR; }; 101 | 04F65AB51F6AA63800CDB097 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 102 | 04F65ABA1F6AA63800CDB097 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 103 | 04F65ABC1F6AA63800CDB097 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 104 | 04F65ABF1F6AA63800CDB097 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 105 | 04F65AC11F6AA63800CDB097 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 106 | 04F65AC61F6AA63800CDB097 /* DemoApplicationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoApplicationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 107 | 04F65ACA1F6AA63800CDB097 /* DemoApplicationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoApplicationTests.swift; sourceTree = ""; }; 108 | 04F65ACC1F6AA63800CDB097 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 109 | 04F65AD11F6AA63800CDB097 /* DemoApplicationUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoApplicationUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 110 | 04F65AD51F6AA63800CDB097 /* DemoApplicationUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoApplicationUITests.swift; sourceTree = ""; }; 111 | 04F65AD71F6AA63800CDB097 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 112 | 04F65AFD1F6AAD1500CDB097 /* ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ViewController.xib; path = ViewController/ViewController.xib; sourceTree = ""; }; 113 | 04F65B011F6AAD2600CDB097 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ViewController.swift; path = ViewController/ViewController.swift; sourceTree = ""; }; 114 | 04F65B0A1F6AAD5A00CDB097 /* TableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TableViewCell.swift; path = ViewController/Cell/TableViewCell.swift; sourceTree = ""; }; 115 | 04F65B0B1F6AAD5A00CDB097 /* TableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = TableViewCell.xib; path = ViewController/Cell/TableViewCell.xib; sourceTree = ""; }; 116 | 04F65B161F6AC56E00CDB097 /* String+fromDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "String+fromDate.swift"; path = "Extension/String+fromDate.swift"; sourceTree = ""; }; 117 | 04F65B1A1F6AC58400CDB097 /* Date+fromString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Date+fromString.swift"; path = "Extension/Date+fromString.swift"; sourceTree = ""; }; 118 | 04F65B231F6ACAC500CDB097 /* Date+differenceDays.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Date+differenceDays.swift"; path = "Extension/Date+differenceDays.swift"; sourceTree = ""; }; 119 | 04F65B281F6ACE6300CDB097 /* Constant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Constant.swift; path = Struct/Constant.swift; sourceTree = ""; }; 120 | /* End PBXFileReference section */ 121 | 122 | /* Begin PBXFrameworksBuildPhase section */ 123 | 04F65AAF1F6AA63800CDB097 /* Frameworks */ = { 124 | isa = PBXFrameworksBuildPhase; 125 | buildActionMask = 2147483647; 126 | files = ( 127 | 044AC1D71F6B3CD50094E476 /* OTSortButton.framework in Frameworks */, 128 | ); 129 | runOnlyForDeploymentPostprocessing = 0; 130 | }; 131 | 04F65AC31F6AA63800CDB097 /* Frameworks */ = { 132 | isa = PBXFrameworksBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | 04F65ACE1F6AA63800CDB097 /* Frameworks */ = { 139 | isa = PBXFrameworksBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | /* End PBXFrameworksBuildPhase section */ 146 | 147 | /* Begin PBXGroup section */ 148 | 044AC1CE1F6B39140094E476 /* Products */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 044AC1D31F6B39140094E476 /* OTSortButton.framework */, 152 | 044AC1D51F6B39140094E476 /* OTSortButtonTests.xctest */, 153 | ); 154 | name = Products; 155 | sourceTree = ""; 156 | }; 157 | 04F65AA91F6AA63800CDB097 = { 158 | isa = PBXGroup; 159 | children = ( 160 | 04F65AB41F6AA63800CDB097 /* DemoApplication */, 161 | 04F65AC91F6AA63800CDB097 /* DemoApplicationTests */, 162 | 04F65AD41F6AA63800CDB097 /* DemoApplicationUITests */, 163 | 04F65AB31F6AA63800CDB097 /* Products */, 164 | 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */, 165 | ); 166 | sourceTree = ""; 167 | }; 168 | 04F65AB31F6AA63800CDB097 /* Products */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 04F65AB21F6AA63800CDB097 /* DemoApplication.app */, 172 | 04F65AC61F6AA63800CDB097 /* DemoApplicationTests.xctest */, 173 | 04F65AD11F6AA63800CDB097 /* DemoApplicationUITests.xctest */, 174 | ); 175 | name = Products; 176 | sourceTree = ""; 177 | }; 178 | 04F65AB41F6AA63800CDB097 /* DemoApplication */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 04F65B271F6ACE4600CDB097 /* Struct */, 182 | 04F65B151F6AC53B00CDB097 /* Extension */, 183 | 04F65AFC1F6AACF700CDB097 /* ViewController */, 184 | 04F65AB51F6AA63800CDB097 /* AppDelegate.swift */, 185 | 04F65AB91F6AA63800CDB097 /* Main.storyboard */, 186 | 04F65ABC1F6AA63800CDB097 /* Assets.xcassets */, 187 | 04F65ABE1F6AA63800CDB097 /* LaunchScreen.storyboard */, 188 | 04F65AC11F6AA63800CDB097 /* Info.plist */, 189 | ); 190 | path = DemoApplication; 191 | sourceTree = ""; 192 | }; 193 | 04F65AC91F6AA63800CDB097 /* DemoApplicationTests */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 04F65ACA1F6AA63800CDB097 /* DemoApplicationTests.swift */, 197 | 04F65ACC1F6AA63800CDB097 /* Info.plist */, 198 | ); 199 | path = DemoApplicationTests; 200 | sourceTree = ""; 201 | }; 202 | 04F65AD41F6AA63800CDB097 /* DemoApplicationUITests */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 04F65AD51F6AA63800CDB097 /* DemoApplicationUITests.swift */, 206 | 04F65AD71F6AA63800CDB097 /* Info.plist */, 207 | ); 208 | path = DemoApplicationUITests; 209 | sourceTree = ""; 210 | }; 211 | 04F65AFC1F6AACF700CDB097 /* ViewController */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 04F65B011F6AAD2600CDB097 /* ViewController.swift */, 215 | 04F65AFD1F6AAD1500CDB097 /* ViewController.xib */, 216 | 04F65B051F6AAD2B00CDB097 /* Cell */, 217 | ); 218 | name = ViewController; 219 | sourceTree = ""; 220 | }; 221 | 04F65B051F6AAD2B00CDB097 /* Cell */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | 04F65B0A1F6AAD5A00CDB097 /* TableViewCell.swift */, 225 | 04F65B0B1F6AAD5A00CDB097 /* TableViewCell.xib */, 226 | ); 227 | name = Cell; 228 | sourceTree = ""; 229 | }; 230 | 04F65B151F6AC53B00CDB097 /* Extension */ = { 231 | isa = PBXGroup; 232 | children = ( 233 | 04F65B161F6AC56E00CDB097 /* String+fromDate.swift */, 234 | 04F65B1A1F6AC58400CDB097 /* Date+fromString.swift */, 235 | 04F65B231F6ACAC500CDB097 /* Date+differenceDays.swift */, 236 | ); 237 | name = Extension; 238 | sourceTree = ""; 239 | }; 240 | 04F65B271F6ACE4600CDB097 /* Struct */ = { 241 | isa = PBXGroup; 242 | children = ( 243 | 04F65B281F6ACE6300CDB097 /* Constant.swift */, 244 | ); 245 | name = Struct; 246 | sourceTree = ""; 247 | }; 248 | /* End PBXGroup section */ 249 | 250 | /* Begin PBXNativeTarget section */ 251 | 04F65AB11F6AA63800CDB097 /* DemoApplication */ = { 252 | isa = PBXNativeTarget; 253 | buildConfigurationList = 04F65ADA1F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplication" */; 254 | buildPhases = ( 255 | 04F65AAE1F6AA63800CDB097 /* Sources */, 256 | 04F65AAF1F6AA63800CDB097 /* Frameworks */, 257 | 04F65AB01F6AA63800CDB097 /* Resources */, 258 | 04F65AFB1F6AA90700CDB097 /* Embed Frameworks */, 259 | ); 260 | buildRules = ( 261 | ); 262 | dependencies = ( 263 | 044AC1DA1F6B3CD50094E476 /* PBXTargetDependency */, 264 | ); 265 | name = DemoApplication; 266 | productName = DemoApplication; 267 | productReference = 04F65AB21F6AA63800CDB097 /* DemoApplication.app */; 268 | productType = "com.apple.product-type.application"; 269 | }; 270 | 04F65AC51F6AA63800CDB097 /* DemoApplicationTests */ = { 271 | isa = PBXNativeTarget; 272 | buildConfigurationList = 04F65ADD1F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplicationTests" */; 273 | buildPhases = ( 274 | 04F65AC21F6AA63800CDB097 /* Sources */, 275 | 04F65AC31F6AA63800CDB097 /* Frameworks */, 276 | 04F65AC41F6AA63800CDB097 /* Resources */, 277 | ); 278 | buildRules = ( 279 | ); 280 | dependencies = ( 281 | 04F65AC81F6AA63800CDB097 /* PBXTargetDependency */, 282 | ); 283 | name = DemoApplicationTests; 284 | productName = DemoApplicationTests; 285 | productReference = 04F65AC61F6AA63800CDB097 /* DemoApplicationTests.xctest */; 286 | productType = "com.apple.product-type.bundle.unit-test"; 287 | }; 288 | 04F65AD01F6AA63800CDB097 /* DemoApplicationUITests */ = { 289 | isa = PBXNativeTarget; 290 | buildConfigurationList = 04F65AE01F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplicationUITests" */; 291 | buildPhases = ( 292 | 04F65ACD1F6AA63800CDB097 /* Sources */, 293 | 04F65ACE1F6AA63800CDB097 /* Frameworks */, 294 | 04F65ACF1F6AA63800CDB097 /* Resources */, 295 | ); 296 | buildRules = ( 297 | ); 298 | dependencies = ( 299 | 04F65AD31F6AA63800CDB097 /* PBXTargetDependency */, 300 | ); 301 | name = DemoApplicationUITests; 302 | productName = DemoApplicationUITests; 303 | productReference = 04F65AD11F6AA63800CDB097 /* DemoApplicationUITests.xctest */; 304 | productType = "com.apple.product-type.bundle.ui-testing"; 305 | }; 306 | /* End PBXNativeTarget section */ 307 | 308 | /* Begin PBXProject section */ 309 | 04F65AAA1F6AA63800CDB097 /* Project object */ = { 310 | isa = PBXProject; 311 | attributes = { 312 | LastSwiftUpdateCheck = 0830; 313 | LastUpgradeCheck = 0830; 314 | ORGANIZATIONNAME = TomosukeOkada; 315 | TargetAttributes = { 316 | 04F65AB11F6AA63800CDB097 = { 317 | CreatedOnToolsVersion = 8.3.3; 318 | DevelopmentTeam = NG4PAUE398; 319 | ProvisioningStyle = Automatic; 320 | }; 321 | 04F65AC51F6AA63800CDB097 = { 322 | CreatedOnToolsVersion = 8.3.3; 323 | DevelopmentTeam = NG4PAUE398; 324 | ProvisioningStyle = Automatic; 325 | TestTargetID = 04F65AB11F6AA63800CDB097; 326 | }; 327 | 04F65AD01F6AA63800CDB097 = { 328 | CreatedOnToolsVersion = 8.3.3; 329 | DevelopmentTeam = NG4PAUE398; 330 | ProvisioningStyle = Automatic; 331 | TestTargetID = 04F65AB11F6AA63800CDB097; 332 | }; 333 | }; 334 | }; 335 | buildConfigurationList = 04F65AAD1F6AA63800CDB097 /* Build configuration list for PBXProject "DemoApplication" */; 336 | compatibilityVersion = "Xcode 3.2"; 337 | developmentRegion = English; 338 | hasScannedForEncodings = 0; 339 | knownRegions = ( 340 | en, 341 | Base, 342 | ); 343 | mainGroup = 04F65AA91F6AA63800CDB097; 344 | productRefGroup = 04F65AB31F6AA63800CDB097 /* Products */; 345 | projectDirPath = ""; 346 | projectReferences = ( 347 | { 348 | ProductGroup = 044AC1CE1F6B39140094E476 /* Products */; 349 | ProjectRef = 044AC1CD1F6B39140094E476 /* OTSortButton.xcodeproj */; 350 | }, 351 | ); 352 | projectRoot = ""; 353 | targets = ( 354 | 04F65AB11F6AA63800CDB097 /* DemoApplication */, 355 | 04F65AC51F6AA63800CDB097 /* DemoApplicationTests */, 356 | 04F65AD01F6AA63800CDB097 /* DemoApplicationUITests */, 357 | ); 358 | }; 359 | /* End PBXProject section */ 360 | 361 | /* Begin PBXReferenceProxy section */ 362 | 044AC1D31F6B39140094E476 /* OTSortButton.framework */ = { 363 | isa = PBXReferenceProxy; 364 | fileType = wrapper.framework; 365 | path = OTSortButton.framework; 366 | remoteRef = 044AC1D21F6B39140094E476 /* PBXContainerItemProxy */; 367 | sourceTree = BUILT_PRODUCTS_DIR; 368 | }; 369 | 044AC1D51F6B39140094E476 /* OTSortButtonTests.xctest */ = { 370 | isa = PBXReferenceProxy; 371 | fileType = wrapper.cfbundle; 372 | path = OTSortButtonTests.xctest; 373 | remoteRef = 044AC1D41F6B39140094E476 /* PBXContainerItemProxy */; 374 | sourceTree = BUILT_PRODUCTS_DIR; 375 | }; 376 | /* End PBXReferenceProxy section */ 377 | 378 | /* Begin PBXResourcesBuildPhase section */ 379 | 04F65AB01F6AA63800CDB097 /* Resources */ = { 380 | isa = PBXResourcesBuildPhase; 381 | buildActionMask = 2147483647; 382 | files = ( 383 | 04F65AC01F6AA63800CDB097 /* LaunchScreen.storyboard in Resources */, 384 | 04F65B0F1F6AAD5A00CDB097 /* TableViewCell.xib in Resources */, 385 | 04F65ABD1F6AA63800CDB097 /* Assets.xcassets in Resources */, 386 | 04F65AFE1F6AAD1500CDB097 /* ViewController.xib in Resources */, 387 | 04F65ABB1F6AA63800CDB097 /* Main.storyboard in Resources */, 388 | ); 389 | runOnlyForDeploymentPostprocessing = 0; 390 | }; 391 | 04F65AC41F6AA63800CDB097 /* Resources */ = { 392 | isa = PBXResourcesBuildPhase; 393 | buildActionMask = 2147483647; 394 | files = ( 395 | 04F65B121F6AB1F200CDB097 /* Main.storyboard in Resources */, 396 | 04F65AFF1F6AAD1500CDB097 /* ViewController.xib in Resources */, 397 | 04F65B101F6AAD5A00CDB097 /* TableViewCell.xib in Resources */, 398 | ); 399 | runOnlyForDeploymentPostprocessing = 0; 400 | }; 401 | 04F65ACF1F6AA63800CDB097 /* Resources */ = { 402 | isa = PBXResourcesBuildPhase; 403 | buildActionMask = 2147483647; 404 | files = ( 405 | 04F65B141F6AB1F400CDB097 /* Main.storyboard in Resources */, 406 | 04F65B001F6AAD1500CDB097 /* ViewController.xib in Resources */, 407 | 04F65B111F6AAD5A00CDB097 /* TableViewCell.xib in Resources */, 408 | ); 409 | runOnlyForDeploymentPostprocessing = 0; 410 | }; 411 | /* End PBXResourcesBuildPhase section */ 412 | 413 | /* Begin PBXSourcesBuildPhase section */ 414 | 04F65AAE1F6AA63800CDB097 /* Sources */ = { 415 | isa = PBXSourcesBuildPhase; 416 | buildActionMask = 2147483647; 417 | files = ( 418 | 04F65B291F6ACE6300CDB097 /* Constant.swift in Sources */, 419 | 04F65B171F6AC56E00CDB097 /* String+fromDate.swift in Sources */, 420 | 04F65B0C1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */, 421 | 04F65B021F6AAD2600CDB097 /* ViewController.swift in Sources */, 422 | 04F65AB61F6AA63800CDB097 /* AppDelegate.swift in Sources */, 423 | 04F65B1B1F6AC58400CDB097 /* Date+fromString.swift in Sources */, 424 | 04F65B241F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */, 425 | ); 426 | runOnlyForDeploymentPostprocessing = 0; 427 | }; 428 | 04F65AC21F6AA63800CDB097 /* Sources */ = { 429 | isa = PBXSourcesBuildPhase; 430 | buildActionMask = 2147483647; 431 | files = ( 432 | 04F65B2A1F6ACE6300CDB097 /* Constant.swift in Sources */, 433 | 04F65B181F6AC56E00CDB097 /* String+fromDate.swift in Sources */, 434 | 04F65B0D1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */, 435 | 04F65B031F6AAD2600CDB097 /* ViewController.swift in Sources */, 436 | 04F65ACB1F6AA63800CDB097 /* DemoApplicationTests.swift in Sources */, 437 | 04F65B1C1F6AC58400CDB097 /* Date+fromString.swift in Sources */, 438 | 04F65B251F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */, 439 | ); 440 | runOnlyForDeploymentPostprocessing = 0; 441 | }; 442 | 04F65ACD1F6AA63800CDB097 /* Sources */ = { 443 | isa = PBXSourcesBuildPhase; 444 | buildActionMask = 2147483647; 445 | files = ( 446 | 04F65B2B1F6ACE6300CDB097 /* Constant.swift in Sources */, 447 | 04F65B191F6AC56E00CDB097 /* String+fromDate.swift in Sources */, 448 | 04F65B0E1F6AAD5A00CDB097 /* TableViewCell.swift in Sources */, 449 | 04F65B041F6AAD2600CDB097 /* ViewController.swift in Sources */, 450 | 04F65AD61F6AA63800CDB097 /* DemoApplicationUITests.swift in Sources */, 451 | 04F65B1D1F6AC58400CDB097 /* Date+fromString.swift in Sources */, 452 | 04F65B261F6ACAC500CDB097 /* Date+differenceDays.swift in Sources */, 453 | ); 454 | runOnlyForDeploymentPostprocessing = 0; 455 | }; 456 | /* End PBXSourcesBuildPhase section */ 457 | 458 | /* Begin PBXTargetDependency section */ 459 | 044AC1DA1F6B3CD50094E476 /* PBXTargetDependency */ = { 460 | isa = PBXTargetDependency; 461 | name = OTSortButton; 462 | targetProxy = 044AC1D91F6B3CD50094E476 /* PBXContainerItemProxy */; 463 | }; 464 | 04F65AC81F6AA63800CDB097 /* PBXTargetDependency */ = { 465 | isa = PBXTargetDependency; 466 | target = 04F65AB11F6AA63800CDB097 /* DemoApplication */; 467 | targetProxy = 04F65AC71F6AA63800CDB097 /* PBXContainerItemProxy */; 468 | }; 469 | 04F65AD31F6AA63800CDB097 /* PBXTargetDependency */ = { 470 | isa = PBXTargetDependency; 471 | target = 04F65AB11F6AA63800CDB097 /* DemoApplication */; 472 | targetProxy = 04F65AD21F6AA63800CDB097 /* PBXContainerItemProxy */; 473 | }; 474 | /* End PBXTargetDependency section */ 475 | 476 | /* Begin PBXVariantGroup section */ 477 | 04F65AB91F6AA63800CDB097 /* Main.storyboard */ = { 478 | isa = PBXVariantGroup; 479 | children = ( 480 | 04F65ABA1F6AA63800CDB097 /* Base */, 481 | ); 482 | name = Main.storyboard; 483 | sourceTree = ""; 484 | }; 485 | 04F65ABE1F6AA63800CDB097 /* LaunchScreen.storyboard */ = { 486 | isa = PBXVariantGroup; 487 | children = ( 488 | 04F65ABF1F6AA63800CDB097 /* Base */, 489 | ); 490 | name = LaunchScreen.storyboard; 491 | sourceTree = ""; 492 | }; 493 | /* End PBXVariantGroup section */ 494 | 495 | /* Begin XCBuildConfiguration section */ 496 | 04F65AD81F6AA63800CDB097 /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | ALWAYS_SEARCH_USER_PATHS = NO; 500 | CLANG_ANALYZER_NONNULL = YES; 501 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 502 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 503 | CLANG_CXX_LIBRARY = "libc++"; 504 | CLANG_ENABLE_MODULES = YES; 505 | CLANG_ENABLE_OBJC_ARC = YES; 506 | CLANG_WARN_BOOL_CONVERSION = YES; 507 | CLANG_WARN_CONSTANT_CONVERSION = YES; 508 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 509 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 510 | CLANG_WARN_EMPTY_BODY = YES; 511 | CLANG_WARN_ENUM_CONVERSION = YES; 512 | CLANG_WARN_INFINITE_RECURSION = YES; 513 | CLANG_WARN_INT_CONVERSION = YES; 514 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 515 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 516 | CLANG_WARN_UNREACHABLE_CODE = YES; 517 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 518 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 519 | COPY_PHASE_STRIP = NO; 520 | DEBUG_INFORMATION_FORMAT = dwarf; 521 | ENABLE_STRICT_OBJC_MSGSEND = YES; 522 | ENABLE_TESTABILITY = YES; 523 | GCC_C_LANGUAGE_STANDARD = gnu99; 524 | GCC_DYNAMIC_NO_PIC = NO; 525 | GCC_NO_COMMON_BLOCKS = YES; 526 | GCC_OPTIMIZATION_LEVEL = 0; 527 | GCC_PREPROCESSOR_DEFINITIONS = ( 528 | "DEBUG=1", 529 | "$(inherited)", 530 | ); 531 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 532 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 533 | GCC_WARN_UNDECLARED_SELECTOR = YES; 534 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 535 | GCC_WARN_UNUSED_FUNCTION = YES; 536 | GCC_WARN_UNUSED_VARIABLE = YES; 537 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 538 | MTL_ENABLE_DEBUG_INFO = YES; 539 | ONLY_ACTIVE_ARCH = YES; 540 | SDKROOT = iphoneos; 541 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 542 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 543 | TARGETED_DEVICE_FAMILY = "1,2"; 544 | }; 545 | name = Debug; 546 | }; 547 | 04F65AD91F6AA63800CDB097 /* Release */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | ALWAYS_SEARCH_USER_PATHS = NO; 551 | CLANG_ANALYZER_NONNULL = YES; 552 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 553 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 554 | CLANG_CXX_LIBRARY = "libc++"; 555 | CLANG_ENABLE_MODULES = YES; 556 | CLANG_ENABLE_OBJC_ARC = YES; 557 | CLANG_WARN_BOOL_CONVERSION = YES; 558 | CLANG_WARN_CONSTANT_CONVERSION = YES; 559 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 560 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 561 | CLANG_WARN_EMPTY_BODY = YES; 562 | CLANG_WARN_ENUM_CONVERSION = YES; 563 | CLANG_WARN_INFINITE_RECURSION = YES; 564 | CLANG_WARN_INT_CONVERSION = YES; 565 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 566 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 567 | CLANG_WARN_UNREACHABLE_CODE = YES; 568 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 569 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 570 | COPY_PHASE_STRIP = NO; 571 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 572 | ENABLE_NS_ASSERTIONS = NO; 573 | ENABLE_STRICT_OBJC_MSGSEND = YES; 574 | GCC_C_LANGUAGE_STANDARD = gnu99; 575 | GCC_NO_COMMON_BLOCKS = YES; 576 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 577 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 578 | GCC_WARN_UNDECLARED_SELECTOR = YES; 579 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 580 | GCC_WARN_UNUSED_FUNCTION = YES; 581 | GCC_WARN_UNUSED_VARIABLE = YES; 582 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 583 | MTL_ENABLE_DEBUG_INFO = NO; 584 | SDKROOT = iphoneos; 585 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 586 | TARGETED_DEVICE_FAMILY = "1,2"; 587 | VALIDATE_PRODUCT = YES; 588 | }; 589 | name = Release; 590 | }; 591 | 04F65ADB1F6AA63800CDB097 /* Debug */ = { 592 | isa = XCBuildConfiguration; 593 | buildSettings = { 594 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 595 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 596 | DEVELOPMENT_TEAM = NG4PAUE398; 597 | INFOPLIST_FILE = DemoApplication/Info.plist; 598 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 599 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplication; 600 | PRODUCT_NAME = "$(TARGET_NAME)"; 601 | SWIFT_VERSION = 3.0; 602 | }; 603 | name = Debug; 604 | }; 605 | 04F65ADC1F6AA63800CDB097 /* Release */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 609 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 610 | DEVELOPMENT_TEAM = NG4PAUE398; 611 | INFOPLIST_FILE = DemoApplication/Info.plist; 612 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 613 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplication; 614 | PRODUCT_NAME = "$(TARGET_NAME)"; 615 | SWIFT_VERSION = 3.0; 616 | }; 617 | name = Release; 618 | }; 619 | 04F65ADE1F6AA63800CDB097 /* Debug */ = { 620 | isa = XCBuildConfiguration; 621 | buildSettings = { 622 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 623 | BUNDLE_LOADER = "$(TEST_HOST)"; 624 | DEVELOPMENT_TEAM = NG4PAUE398; 625 | INFOPLIST_FILE = DemoApplicationTests/Info.plist; 626 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 627 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplicationTests; 628 | PRODUCT_NAME = "$(TARGET_NAME)"; 629 | SWIFT_VERSION = 3.0; 630 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoApplication.app/DemoApplication"; 631 | }; 632 | name = Debug; 633 | }; 634 | 04F65ADF1F6AA63800CDB097 /* Release */ = { 635 | isa = XCBuildConfiguration; 636 | buildSettings = { 637 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 638 | BUNDLE_LOADER = "$(TEST_HOST)"; 639 | DEVELOPMENT_TEAM = NG4PAUE398; 640 | INFOPLIST_FILE = DemoApplicationTests/Info.plist; 641 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 642 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplicationTests; 643 | PRODUCT_NAME = "$(TARGET_NAME)"; 644 | SWIFT_VERSION = 3.0; 645 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DemoApplication.app/DemoApplication"; 646 | }; 647 | name = Release; 648 | }; 649 | 04F65AE11F6AA63800CDB097 /* Debug */ = { 650 | isa = XCBuildConfiguration; 651 | buildSettings = { 652 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 653 | DEVELOPMENT_TEAM = NG4PAUE398; 654 | INFOPLIST_FILE = DemoApplicationUITests/Info.plist; 655 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 656 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplicationUITests; 657 | PRODUCT_NAME = "$(TARGET_NAME)"; 658 | SWIFT_VERSION = 3.0; 659 | TEST_TARGET_NAME = DemoApplication; 660 | }; 661 | name = Debug; 662 | }; 663 | 04F65AE21F6AA63800CDB097 /* Release */ = { 664 | isa = XCBuildConfiguration; 665 | buildSettings = { 666 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 667 | DEVELOPMENT_TEAM = NG4PAUE398; 668 | INFOPLIST_FILE = DemoApplicationUITests/Info.plist; 669 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 670 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.DemoApplicationUITests; 671 | PRODUCT_NAME = "$(TARGET_NAME)"; 672 | SWIFT_VERSION = 3.0; 673 | TEST_TARGET_NAME = DemoApplication; 674 | }; 675 | name = Release; 676 | }; 677 | /* End XCBuildConfiguration section */ 678 | 679 | /* Begin XCConfigurationList section */ 680 | 04F65AAD1F6AA63800CDB097 /* Build configuration list for PBXProject "DemoApplication" */ = { 681 | isa = XCConfigurationList; 682 | buildConfigurations = ( 683 | 04F65AD81F6AA63800CDB097 /* Debug */, 684 | 04F65AD91F6AA63800CDB097 /* Release */, 685 | ); 686 | defaultConfigurationIsVisible = 0; 687 | defaultConfigurationName = Release; 688 | }; 689 | 04F65ADA1F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplication" */ = { 690 | isa = XCConfigurationList; 691 | buildConfigurations = ( 692 | 04F65ADB1F6AA63800CDB097 /* Debug */, 693 | 04F65ADC1F6AA63800CDB097 /* Release */, 694 | ); 695 | defaultConfigurationIsVisible = 0; 696 | defaultConfigurationName = Release; 697 | }; 698 | 04F65ADD1F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplicationTests" */ = { 699 | isa = XCConfigurationList; 700 | buildConfigurations = ( 701 | 04F65ADE1F6AA63800CDB097 /* Debug */, 702 | 04F65ADF1F6AA63800CDB097 /* Release */, 703 | ); 704 | defaultConfigurationIsVisible = 0; 705 | defaultConfigurationName = Release; 706 | }; 707 | 04F65AE01F6AA63800CDB097 /* Build configuration list for PBXNativeTarget "DemoApplicationUITests" */ = { 708 | isa = XCConfigurationList; 709 | buildConfigurations = ( 710 | 04F65AE11F6AA63800CDB097 /* Debug */, 711 | 04F65AE21F6AA63800CDB097 /* Release */, 712 | ); 713 | defaultConfigurationIsVisible = 0; 714 | defaultConfigurationName = Release; 715 | }; 716 | /* End XCConfigurationList section */ 717 | }; 718 | rootObject = 04F65AAA1F6AA63800CDB097 /* Project object */; 719 | } 720 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication.xcodeproj/xcuserdata/Mac.xcuserdatad/xcschemes/DemoApplication.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication.xcodeproj/xcuserdata/Mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DemoApplication.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04F65AB11F6AA63800CDB097 16 | 17 | primary 18 | 19 | 20 | 04F65AC51F6AA63800CDB097 21 | 22 | primary 23 | 24 | 25 | 04F65AD01F6AA63800CDB097 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/sort_background_ascend.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "resizing" : { 9 | "mode" : "9-part", 10 | "center" : { 11 | "mode" : "tile", 12 | "width" : 1, 13 | "height" : 1 14 | }, 15 | "cap-insets" : { 16 | "bottom" : 11, 17 | "top" : 11, 18 | "right" : 11, 19 | "left" : 11 20 | } 21 | }, 22 | "idiom" : "universal", 23 | "filename" : "sort_background_ascend.png", 24 | "scale" : "2x" 25 | }, 26 | { 27 | "idiom" : "universal", 28 | "scale" : "3x" 29 | } 30 | ], 31 | "info" : { 32 | "version" : 1, 33 | "author" : "xcode" 34 | } 35 | } -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/sort_background_ascend.imageset/sort_background_ascend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frog-Frog/OTSortButton/1064dbd039a5ede74e7ccbadadbb059033c6636f/DemoApplication/DemoApplication/Assets.xcassets/sort_background_ascend.imageset/sort_background_ascend.png -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/sort_background_descend.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "resizing" : { 9 | "mode" : "9-part", 10 | "center" : { 11 | "mode" : "tile", 12 | "width" : 1, 13 | "height" : 1 14 | }, 15 | "cap-insets" : { 16 | "bottom" : 11, 17 | "top" : 11, 18 | "right" : 11, 19 | "left" : 11 20 | } 21 | }, 22 | "idiom" : "universal", 23 | "filename" : "sort_background_descend.png", 24 | "scale" : "2x" 25 | }, 26 | { 27 | "idiom" : "universal", 28 | "scale" : "3x" 29 | } 30 | ], 31 | "info" : { 32 | "version" : 1, 33 | "author" : "xcode" 34 | } 35 | } -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Assets.xcassets/sort_background_descend.imageset/sort_background_descend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Frog-Frog/OTSortButton/1064dbd039a5ede74e7ccbadadbb059033c6636f/DemoApplication/DemoApplication/Assets.xcassets/sort_background_descend.imageset/sort_background_descend.png -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Extension/Date+differenceDays.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+differenceDays.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Date { 12 | 13 | static func difference(days: Int, from:Date) -> Date? { 14 | let calendar = Calendar(identifier: .gregorian) 15 | 16 | return calendar.date(byAdding: .day, value: days, to: calendar.startOfDay(for: from)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Extension/Date+fromString.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+fromString.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Date { 12 | 13 | static func from(string: String, format: String) -> Date? { 14 | let formatter = DateFormatter() 15 | formatter.locale = Locale.current 16 | formatter.dateFormat = format 17 | 18 | return formatter.date(from: string) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Extension/String+fromDate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // String+fromDate.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | 13 | static func from(date: Date, format: String) -> String { 14 | let formatter = DateFormatter() 15 | formatter.locale = Locale.current 16 | formatter.dateFormat = format 17 | 18 | 19 | return formatter.string(from: date) 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/Struct/Constant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constant.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct DataKey { 12 | static let String = "string" 13 | static let Number = "number" 14 | static let Date = "date" 15 | } 16 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/ViewController/Cell/TableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TableViewCell: UITableViewCell { 12 | 13 | @IBOutlet weak var leftLabel: UILabel! 14 | @IBOutlet weak var centerLabel: UILabel! 15 | @IBOutlet weak var rightLabel: UILabel! 16 | 17 | var data = Dictionary() { 18 | didSet { 19 | leftLabel.text = data[DataKey.String] 20 | centerLabel.text = data[DataKey.Number] 21 | rightLabel.text = data[DataKey.Date] 22 | } 23 | } 24 | 25 | 26 | 27 | override func awakeFromNib() { 28 | super.awakeFromNib() 29 | } 30 | 31 | override func setSelected(_ selected: Bool, animated: Bool) { 32 | super.setSelected(selected, animated: animated) 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/ViewController/Cell/TableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/ViewController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DemoApplication 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | import OTSortButton 12 | 13 | class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { 14 | 15 | @IBOutlet var sortButtonCollection: [OTSortButton]! 16 | 17 | @IBOutlet weak var leftSortButton: OTSortButton! 18 | @IBOutlet weak var centerSortButton: OTSortButton! 19 | @IBOutlet weak var rightSortButton: OTSortButton! 20 | 21 | @IBOutlet weak var tableView: UITableView! 22 | 23 | var dataArray = Array>() 24 | 25 | var sortedArray = Array>() 26 | 27 | let cellName = "TableViewCell" 28 | 29 | //MARK: - LifeCycle 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | createSampleData() 33 | prepareSortButton() 34 | prepareTableView() 35 | } 36 | 37 | 38 | override func didReceiveMemoryWarning() { 39 | super.didReceiveMemoryWarning() 40 | } 41 | 42 | 43 | //MARK: - SampleData 44 | func createSampleData() { 45 | 46 | var date = Date() 47 | for _ in 0 ..< 30 { 48 | 49 | let randomText = generateRandomString(length: 3) 50 | let randomNumber = String(Int(arc4random_uniform(100))) 51 | let dateText = String.from(date: date, format: "MM/dd") 52 | 53 | let data = [DataKey.String: randomText, 54 | DataKey.Number: randomNumber, 55 | DataKey.Date: dateText] 56 | 57 | dataArray.append(data) 58 | 59 | date = Date.difference(days: 1, from: date) ?? Date() 60 | } 61 | 62 | sortedArray = dataArray 63 | } 64 | 65 | func generateRandomString(length: Int) -> String { 66 | 67 | let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 68 | let upperBound = UInt32(alphabet.characters.count) 69 | 70 | return String((0.. Character in 71 | return alphabet[alphabet.index(alphabet.startIndex, offsetBy: Int(arc4random_uniform(upperBound)))] 72 | }) 73 | } 74 | 75 | 76 | //MARK: - Prepare 77 | func prepareSortButton() { 78 | leftSortButton.sortKey = DataKey.String 79 | centerSortButton.sortKey = DataKey.Number 80 | rightSortButton.sortKey = DataKey.Date 81 | } 82 | 83 | func prepareTableView() { 84 | let nib = UINib(nibName: cellName, bundle: nil) 85 | tableView.register(nib, forCellReuseIdentifier: cellName) 86 | } 87 | 88 | 89 | //MARK: - UITableViewDataSource 90 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 91 | return sortedArray.count 92 | } 93 | 94 | 95 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 96 | let cell = tableView.dequeueReusableCell(withIdentifier: cellName, for: indexPath) as! TableViewCell 97 | 98 | cell.data = sortedArray[indexPath.row] 99 | 100 | return cell 101 | } 102 | 103 | 104 | //MARK: - IBAction 105 | @IBAction func tappedSortButton(_ sender: OTSortButton) { 106 | 107 | for sortButton in sortButtonCollection { 108 | if sortButton == sender { 109 | 110 | let dataKey = sortButton.sortKey 111 | 112 | switch sortButton.sortType { 113 | case .none: 114 | 115 | sortButton.sortType = .ascend 116 | 117 | if sortButton == centerSortButton { 118 | sortedArray = dataArray.sorted(by: { Int($0[dataKey]!)! < Int($1[dataKey]!)! }) 119 | } else { 120 | sortedArray = dataArray.sorted(by: { $0[dataKey]! < $1[dataKey]! }) 121 | } 122 | 123 | 124 | case .ascend: 125 | 126 | sortButton.sortType = .descend 127 | 128 | if sortButton == centerSortButton { 129 | sortedArray = dataArray.sorted(by: { Int($0[dataKey]!)! > Int($1[dataKey]!)! }) 130 | } else { 131 | sortedArray = dataArray.sorted(by: { $0[dataKey]! > $1[dataKey]! }) 132 | } 133 | 134 | 135 | case .descend: 136 | 137 | sortButton.sortType = .none 138 | 139 | sortedArray = dataArray 140 | 141 | } 142 | } else { 143 | sortButton.sortType = .none 144 | } 145 | } 146 | 147 | tableView.reloadData() 148 | } 149 | } 150 | 151 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplication/ViewController/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 58 | 85 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplicationTests/DemoApplicationTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DemoApplicationTests.swift 3 | // DemoApplicationTests 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import DemoApplication 11 | 12 | class DemoApplicationTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplicationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplicationUITests/DemoApplicationUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DemoApplicationUITests.swift 3 | // DemoApplicationUITests 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DemoApplicationUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | if #available(iOS 9.0, *) { 22 | XCUIApplication().launch() 23 | } else { 24 | // Fallback on earlier versions 25 | } 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | override func tearDown() { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | super.tearDown() 33 | } 34 | 35 | func testExample() { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /DemoApplication/DemoApplicationUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Tomosuke Okada 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OTSortButton.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint OTSortButton.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | s.name = "OTSortButton" 12 | s.version = "1.0" 13 | s.summary = "OTSortButton is a UIButton library useful for sorting." 14 | s.homepage = "https://github.com/PKPK-Carnage" 15 | s.license = { :type => "MIT", :file => "LICENSE" } 16 | s.author = { "Tomosuke Okada" => "pkpkcarnage@gmail.com" } 17 | s.social_media_url = "https://github.com/PKPK-Carnage" 18 | s.platform = :ios, "8.0" 19 | 20 | s.source = { :git => "https://github.com/PKPK-Carnage/OTSortButton.git", :tag => "#{s.version}" } 21 | 22 | s.source_files = "Classes", "Classes/**/*.{swift}" 23 | s.resource_bundles = { 24 | 'OTSortButton' => ['Classes/*.xcassets'] 25 | } 26 | 27 | s.requires_arc = true 28 | 29 | 30 | end 31 | -------------------------------------------------------------------------------- /OTSortButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 044AC1C01F6B38820094E476 /* OTSortButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044AC1BE1F6B38820094E476 /* OTSortButton.swift */; }; 11 | 044AC1C11F6B38830094E476 /* OTSortButtonImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 044AC1BF1F6B38820094E476 /* OTSortButtonImages.xcassets */; }; 12 | 044AC1C91F6B38930094E476 /* OTSortButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 044AC1C41F6B38930094E476 /* OTSortButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 044AC1D61F6B3AD50094E476 /* OTSortButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044AC1C71F6B38930094E476 /* OTSortButtonTests.swift */; }; 14 | 04F65A991F6AA60500CDB097 /* OTSortButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04F65A8F1F6AA60400CDB097 /* OTSortButton.framework */; }; 15 | 04FF6BFB1F6C13BF00D5C895 /* OTSortButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044AC1BE1F6B38820094E476 /* OTSortButton.swift */; }; 16 | 04FF6BFC1F6C13C200D5C895 /* OTSortButtonImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 044AC1BF1F6B38820094E476 /* OTSortButtonImages.xcassets */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 04F65A9A1F6AA60500CDB097 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 04F65A861F6AA60400CDB097 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 04F65A8E1F6AA60400CDB097; 25 | remoteInfo = OTSortButton; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 044AC1BE1F6B38820094E476 /* OTSortButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTSortButton.swift; sourceTree = ""; }; 31 | 044AC1BF1F6B38820094E476 /* OTSortButtonImages.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = OTSortButtonImages.xcassets; sourceTree = ""; }; 32 | 044AC1C31F6B38930094E476 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 044AC1C41F6B38930094E476 /* OTSortButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTSortButton.h; sourceTree = ""; }; 34 | 044AC1C61F6B38930094E476 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 044AC1C71F6B38930094E476 /* OTSortButtonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTSortButtonTests.swift; sourceTree = ""; }; 36 | 04F65A8F1F6AA60400CDB097 /* OTSortButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OTSortButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 04F65A981F6AA60500CDB097 /* OTSortButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OTSortButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 04F65A8B1F6AA60400CDB097 /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | 04F65A951F6AA60500CDB097 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | 04F65A991F6AA60500CDB097 /* OTSortButton.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 044AC1BD1F6B38820094E476 /* Classes */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 044AC1BE1F6B38820094E476 /* OTSortButton.swift */, 63 | 044AC1BF1F6B38820094E476 /* OTSortButtonImages.xcassets */, 64 | ); 65 | path = Classes; 66 | sourceTree = ""; 67 | }; 68 | 044AC1C21F6B38930094E476 /* OTSortButton */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 044AC1C31F6B38930094E476 /* Info.plist */, 72 | 044AC1C41F6B38930094E476 /* OTSortButton.h */, 73 | ); 74 | name = OTSortButton; 75 | path = OTSortButton/OTSortButton; 76 | sourceTree = ""; 77 | }; 78 | 044AC1C51F6B38930094E476 /* OTSortButtonTests */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 044AC1C61F6B38930094E476 /* Info.plist */, 82 | 044AC1C71F6B38930094E476 /* OTSortButtonTests.swift */, 83 | ); 84 | name = OTSortButtonTests; 85 | path = OTSortButton/OTSortButtonTests; 86 | sourceTree = ""; 87 | }; 88 | 04F65A851F6AA60400CDB097 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 044AC1BD1F6B38820094E476 /* Classes */, 92 | 044AC1C21F6B38930094E476 /* OTSortButton */, 93 | 044AC1C51F6B38930094E476 /* OTSortButtonTests */, 94 | 04F65A901F6AA60400CDB097 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 04F65A901F6AA60400CDB097 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 04F65A8F1F6AA60400CDB097 /* OTSortButton.framework */, 102 | 04F65A981F6AA60500CDB097 /* OTSortButtonTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | /* End PBXGroup section */ 108 | 109 | /* Begin PBXHeadersBuildPhase section */ 110 | 04F65A8C1F6AA60400CDB097 /* Headers */ = { 111 | isa = PBXHeadersBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | 044AC1C91F6B38930094E476 /* OTSortButton.h in Headers */, 115 | ); 116 | runOnlyForDeploymentPostprocessing = 0; 117 | }; 118 | /* End PBXHeadersBuildPhase section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 04F65A8E1F6AA60400CDB097 /* OTSortButton */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 04F65AA31F6AA60500CDB097 /* Build configuration list for PBXNativeTarget "OTSortButton" */; 124 | buildPhases = ( 125 | 04F65A8A1F6AA60400CDB097 /* Sources */, 126 | 04F65A8B1F6AA60400CDB097 /* Frameworks */, 127 | 04F65A8C1F6AA60400CDB097 /* Headers */, 128 | 04F65A8D1F6AA60400CDB097 /* Resources */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = OTSortButton; 135 | productName = OTSortButton; 136 | productReference = 04F65A8F1F6AA60400CDB097 /* OTSortButton.framework */; 137 | productType = "com.apple.product-type.framework"; 138 | }; 139 | 04F65A971F6AA60500CDB097 /* OTSortButtonTests */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 04F65AA61F6AA60500CDB097 /* Build configuration list for PBXNativeTarget "OTSortButtonTests" */; 142 | buildPhases = ( 143 | 04F65A941F6AA60500CDB097 /* Sources */, 144 | 04F65A951F6AA60500CDB097 /* Frameworks */, 145 | 04F65A961F6AA60500CDB097 /* Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | 04F65A9B1F6AA60500CDB097 /* PBXTargetDependency */, 151 | ); 152 | name = OTSortButtonTests; 153 | productName = OTSortButtonTests; 154 | productReference = 04F65A981F6AA60500CDB097 /* OTSortButtonTests.xctest */; 155 | productType = "com.apple.product-type.bundle.unit-test"; 156 | }; 157 | /* End PBXNativeTarget section */ 158 | 159 | /* Begin PBXProject section */ 160 | 04F65A861F6AA60400CDB097 /* Project object */ = { 161 | isa = PBXProject; 162 | attributes = { 163 | LastSwiftUpdateCheck = 0830; 164 | LastUpgradeCheck = 0830; 165 | ORGANIZATIONNAME = TomosukeOkada; 166 | TargetAttributes = { 167 | 04F65A8E1F6AA60400CDB097 = { 168 | CreatedOnToolsVersion = 8.3.3; 169 | LastSwiftMigration = 0830; 170 | ProvisioningStyle = Manual; 171 | }; 172 | 04F65A971F6AA60500CDB097 = { 173 | CreatedOnToolsVersion = 8.3.3; 174 | ProvisioningStyle = Manual; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = 04F65A891F6AA60400CDB097 /* Build configuration list for PBXProject "OTSortButton" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = English; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | ); 185 | mainGroup = 04F65A851F6AA60400CDB097; 186 | productRefGroup = 04F65A901F6AA60400CDB097 /* Products */; 187 | projectDirPath = ""; 188 | projectRoot = ""; 189 | targets = ( 190 | 04F65A8E1F6AA60400CDB097 /* OTSortButton */, 191 | 04F65A971F6AA60500CDB097 /* OTSortButtonTests */, 192 | ); 193 | }; 194 | /* End PBXProject section */ 195 | 196 | /* Begin PBXResourcesBuildPhase section */ 197 | 04F65A8D1F6AA60400CDB097 /* Resources */ = { 198 | isa = PBXResourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 044AC1C11F6B38830094E476 /* OTSortButtonImages.xcassets in Resources */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | 04F65A961F6AA60500CDB097 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | 04FF6BFC1F6C13C200D5C895 /* OTSortButtonImages.xcassets in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXSourcesBuildPhase section */ 216 | 04F65A8A1F6AA60400CDB097 /* Sources */ = { 217 | isa = PBXSourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 044AC1C01F6B38820094E476 /* OTSortButton.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 04F65A941F6AA60500CDB097 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 04FF6BFB1F6C13BF00D5C895 /* OTSortButton.swift in Sources */, 229 | 044AC1D61F6B3AD50094E476 /* OTSortButtonTests.swift in Sources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXSourcesBuildPhase section */ 234 | 235 | /* Begin PBXTargetDependency section */ 236 | 04F65A9B1F6AA60500CDB097 /* PBXTargetDependency */ = { 237 | isa = PBXTargetDependency; 238 | target = 04F65A8E1F6AA60400CDB097 /* OTSortButton */; 239 | targetProxy = 04F65A9A1F6AA60500CDB097 /* PBXContainerItemProxy */; 240 | }; 241 | /* End PBXTargetDependency section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | 04F65AA11F6AA60500CDB097 /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNREACHABLE_CODE = YES; 265 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 266 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 267 | COPY_PHASE_STRIP = NO; 268 | CURRENT_PROJECT_VERSION = 1; 269 | DEBUG_INFORMATION_FORMAT = dwarf; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | ENABLE_TESTABILITY = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_DYNAMIC_NO_PIC = NO; 274 | GCC_NO_COMMON_BLOCKS = YES; 275 | GCC_OPTIMIZATION_LEVEL = 0; 276 | GCC_PREPROCESSOR_DEFINITIONS = ( 277 | "DEBUG=1", 278 | "$(inherited)", 279 | ); 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 287 | MTL_ENABLE_DEBUG_INFO = YES; 288 | ONLY_ACTIVE_ARCH = YES; 289 | SDKROOT = iphoneos; 290 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 291 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 292 | TARGETED_DEVICE_FAMILY = "1,2"; 293 | VERSIONING_SYSTEM = "apple-generic"; 294 | VERSION_INFO_PREFIX = ""; 295 | }; 296 | name = Debug; 297 | }; 298 | 04F65AA21F6AA60500CDB097 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_WARN_BOOL_CONVERSION = YES; 309 | CLANG_WARN_CONSTANT_CONVERSION = YES; 310 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 311 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 312 | CLANG_WARN_EMPTY_BODY = YES; 313 | CLANG_WARN_ENUM_CONVERSION = YES; 314 | CLANG_WARN_INFINITE_RECURSION = YES; 315 | CLANG_WARN_INT_CONVERSION = YES; 316 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 317 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 318 | CLANG_WARN_UNREACHABLE_CODE = YES; 319 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 320 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 321 | COPY_PHASE_STRIP = NO; 322 | CURRENT_PROJECT_VERSION = 1; 323 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 324 | ENABLE_NS_ASSERTIONS = NO; 325 | ENABLE_STRICT_OBJC_MSGSEND = YES; 326 | GCC_C_LANGUAGE_STANDARD = gnu99; 327 | GCC_NO_COMMON_BLOCKS = YES; 328 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 329 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 330 | GCC_WARN_UNDECLARED_SELECTOR = YES; 331 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 332 | GCC_WARN_UNUSED_FUNCTION = YES; 333 | GCC_WARN_UNUSED_VARIABLE = YES; 334 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 335 | MTL_ENABLE_DEBUG_INFO = NO; 336 | SDKROOT = iphoneos; 337 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 338 | TARGETED_DEVICE_FAMILY = "1,2"; 339 | VALIDATE_PRODUCT = YES; 340 | VERSIONING_SYSTEM = "apple-generic"; 341 | VERSION_INFO_PREFIX = ""; 342 | }; 343 | name = Release; 344 | }; 345 | 04F65AA41F6AA60500CDB097 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | CLANG_ENABLE_MODULES = YES; 349 | CODE_SIGN_IDENTITY = ""; 350 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 351 | DEFINES_MODULE = YES; 352 | DEVELOPMENT_TEAM = ""; 353 | DYLIB_COMPATIBILITY_VERSION = 1; 354 | DYLIB_CURRENT_VERSION = 1; 355 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 356 | INFOPLIST_FILE = "$(SRCROOT)/OTSortButton/OTSortButton/Info.plist"; 357 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 358 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 359 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.OTSortButton; 360 | PRODUCT_NAME = "$(TARGET_NAME)"; 361 | PROVISIONING_PROFILE_SPECIFIER = ""; 362 | SKIP_INSTALL = YES; 363 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 364 | SWIFT_VERSION = 3.0; 365 | }; 366 | name = Debug; 367 | }; 368 | 04F65AA51F6AA60500CDB097 /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | CLANG_ENABLE_MODULES = YES; 372 | CODE_SIGN_IDENTITY = ""; 373 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 374 | DEFINES_MODULE = YES; 375 | DEVELOPMENT_TEAM = ""; 376 | DYLIB_COMPATIBILITY_VERSION = 1; 377 | DYLIB_CURRENT_VERSION = 1; 378 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 379 | INFOPLIST_FILE = "$(SRCROOT)/OTSortButton/OTSortButton/Info.plist"; 380 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 382 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.OTSortButton; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | PROVISIONING_PROFILE_SPECIFIER = ""; 385 | SKIP_INSTALL = YES; 386 | SWIFT_VERSION = 3.0; 387 | }; 388 | name = Release; 389 | }; 390 | 04F65AA71F6AA60500CDB097 /* Debug */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 394 | DEVELOPMENT_TEAM = ""; 395 | INFOPLIST_FILE = OTSortButtonTests/Info.plist; 396 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 397 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.OTSortButtonTests; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | PROVISIONING_PROFILE_SPECIFIER = ""; 400 | SWIFT_VERSION = 3.0; 401 | }; 402 | name = Debug; 403 | }; 404 | 04F65AA81F6AA60500CDB097 /* Release */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 408 | DEVELOPMENT_TEAM = ""; 409 | INFOPLIST_FILE = OTSortButtonTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 411 | PRODUCT_BUNDLE_IDENTIFIER = TomosukeOkada.OTSortButtonTests; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | PROVISIONING_PROFILE_SPECIFIER = ""; 414 | SWIFT_VERSION = 3.0; 415 | }; 416 | name = Release; 417 | }; 418 | /* End XCBuildConfiguration section */ 419 | 420 | /* Begin XCConfigurationList section */ 421 | 04F65A891F6AA60400CDB097 /* Build configuration list for PBXProject "OTSortButton" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | 04F65AA11F6AA60500CDB097 /* Debug */, 425 | 04F65AA21F6AA60500CDB097 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | 04F65AA31F6AA60500CDB097 /* Build configuration list for PBXNativeTarget "OTSortButton" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 04F65AA41F6AA60500CDB097 /* Debug */, 434 | 04F65AA51F6AA60500CDB097 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | 04F65AA61F6AA60500CDB097 /* Build configuration list for PBXNativeTarget "OTSortButtonTests" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | 04F65AA71F6AA60500CDB097 /* Debug */, 443 | 04F65AA81F6AA60500CDB097 /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | /* End XCConfigurationList section */ 449 | }; 450 | rootObject = 04F65A861F6AA60400CDB097 /* Project object */; 451 | } 452 | -------------------------------------------------------------------------------- /OTSortButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OTSortButton.xcodeproj/xcshareddata/xcschemes/OTSortButton.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /OTSortButton/OTSortButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /OTSortButton/OTSortButton/OTSortButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // OTSortButton.h 3 | // OTSortButton 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for OTSortButton. 12 | FOUNDATION_EXPORT double OTSortButtonVersionNumber; 13 | 14 | //! Project version string for OTSortButton. 15 | FOUNDATION_EXPORT const unsigned char OTSortButtonVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /OTSortButton/OTSortButtonTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /OTSortButton/OTSortButtonTests/OTSortButtonTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OTSortButtonTests.swift 3 | // OTSortButtonTests 4 | // 5 | // Created by Tomosuke Okada on 2017/09/14. 6 | // Copyright © 2017年 TomosukeOkada. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import OTSortButton 11 | 12 | class OTSortButtonTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OTSortButton 2 | 3 | ## Description 4 | OTSortButton is a UIButton library useful for sorting. 5 | 6 | ## Features 7 | ・Change appearance for each parts and sort types. 8 | 9 | ## Demo 10 | ![otsortbuttondemo](https://user-images.githubusercontent.com/20692907/30483166-d765c672-9a60-11e7-8753-87bdcf4cdddc.gif) 11 | 12 | ## Usage 13 | 1.Set OTSortButton to Custom Class and Module of your UIButton. 14 | 15 | ![2017-09-15 21 10 54](https://user-images.githubusercontent.com/20692907/30481581-6a2e9166-9a5a-11e7-939d-ccec96b11136.png) 16 | 17 | 18 | The appearance can be set with IBInspectable. 19 | 20 | ![2017-09-15 21 27 45](https://user-images.githubusercontent.com/20692907/30482111-c25eb6fc-9a5c-11e7-9d21-50924081d4a6.png) 21 | 22 | 2.Import and connect IBOutlet 23 | 24 | ```swift 25 | import OTSortButton 26 | 27 | @IBOutlet var sortButtonCollection: [OTSortButton]! 28 | ``` 29 | 30 | 3.If you want to set the key on the button, please set it as the sort key 31 | 32 | ```swift 33 | 34 | @IBOutlet weak var yourSortButton: OTSortButton! 35 | 36 | yourSortButton.sortKey = "yourKey" 37 | 38 | ``` 39 | 40 | 4.Connect IBAction 41 | 42 | ```swift 43 | @IBAction func tappedSortButton(_ sender: OTSortButton) { 44 | for sortButton in sortButtonCollection { 45 | if sortButton == sender { 46 | let key = sortButton.sortKey 47 | switch sortButton.sortType { 48 | case .none: 49 | 50 | sortButton.sortType = .ascend 51 | // Sort ascend here. 52 | //e.g. sortedArray = yourArray.sorted(by: { $0[key]! < $1[key]! }) 53 | 54 | case .ascend: 55 | 56 | sortButton.sortType = .descend 57 | // Sort descend here. 58 | //e.g. sortedArray = yourArray.sorted(by: { $0[key]! > $1[key]! }) 59 | 60 | case .descend: 61 | 62 | sortButton.sortType = .none 63 | // Undo here. 64 | //e.g. sortedArray = yourArray 65 | } 66 | } else { 67 | sortButton.sortType = .none 68 | } 69 | } 70 | yourView.reloadData() 71 | } 72 | 73 | 74 | ``` 75 | 76 | ## Install 77 | 78 | ### CocoaPods 79 | Add this to your Podfile. 80 | 81 | ```PodFile 82 | pod 'OTSortButton' 83 | ``` 84 | 85 | ### Carthage 86 | Add this to your Cartfile. 87 | 88 | ```Cartfile 89 | github "PKPK-Carnage/OTSortButton" 90 | ``` 91 | 92 | ## Help 93 | 94 | If you want to support this framework, you can do these things. 95 | 96 | * Please let us know if you have any requests for me. 97 | 98 | I will do my best to live up to your expectations. 99 | 100 | * You can make contribute code, issues and pull requests. 101 | 102 | I promise to confirm them. 103 | 104 | ## Licence 105 | 106 | [MIT](https://github.com/PKPK-Carnage/OTSortButton/blob/master/LICENSE) 107 | 108 | ## Author 109 | 110 | [PKPK-Carnage🦎](https://github.com/PKPK-Carnage) 111 | --------------------------------------------------------------------------------