├── .gitattributes ├── .gitignore ├── Examples ├── Assets │ └── Video │ │ └── balllin.mov ├── Examples.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Examples │ ├── AppDelegate.swift │ ├── BlocksViewController.h │ ├── BlocksViewController.m │ ├── Bridging-Header.h │ ├── BrightnessViewController.swift │ ├── CellsController.swift │ ├── ColorsViewController.swift │ ├── CustomKeyboardViewController.swift │ ├── CustomTextEntryViewController.swift │ ├── GesturesViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── 1024.png │ │ │ ├── 120 - iPhone Copy 4@2x.png │ │ │ ├── 120 - iPhone Copy 4@3x.png │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── five-1.png │ │ │ ├── four.png │ │ │ ├── iphonex.png │ │ │ ├── sim.png │ │ │ └── sixplus.png │ ├── Info.plist │ ├── PDFGeneratorViewController.h │ ├── PDFGeneratorViewController.m │ ├── ProgressTaskViewController.swift │ ├── RootTableViewController.h │ ├── RootTableViewController.m │ ├── TextViewViewController.swift │ ├── VelocityViewController.h │ ├── VelocityViewController.m │ └── VideoViewController.swift ├── TVExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── App Icon & Top Shelf Image.brandassets │ │ │ ├── App Icon - Large.imagestack │ │ │ │ ├── Back.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ │ ├── Contents.json │ │ │ │ ├── Front.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ │ └── Middle.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ ├── App Icon - Small.imagestack │ │ │ │ ├── Back.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ │ ├── Contents.json │ │ │ │ ├── Front.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ │ └── Middle.imagestacklayer │ │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ └── Top Shelf Image.imageset │ │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── appicon.png ├── License.txt ├── README.mdown ├── curry.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── curry.xcscheme ├── curry ├── Categories │ ├── Animations │ │ ├── CAAnimation+TKAnimation.h │ │ ├── CAAnimation+TKAnimation.m │ │ ├── CAKeyframeAnimation+TKAnimation.h │ │ ├── CAKeyframeAnimation+TKAnimation.m │ │ ├── CALayer+TKAnimation.h │ │ ├── CALayer+TKAnimation.m │ │ ├── UIView+TKAnimation.h │ │ ├── UIView+TKAnimation.m │ │ └── UIView+Velocity.swift │ ├── Foundation │ │ ├── Bundle+TKCategory.swift │ │ ├── NSArray+TKCategory.h │ │ ├── NSArray+TKCategory.m │ │ ├── NSAttributedString+TKCategory.h │ │ ├── NSAttributedString+TKCategory.m │ │ ├── NSBundle+Receipts.h │ │ ├── NSBundle+Receipts.m │ │ ├── NSDate+TKCategory.h │ │ ├── NSDate+TKCategory.m │ │ ├── NSMutableArray+TKCategory.h │ │ ├── NSMutableArray+TKCategory.m │ │ ├── NSMutableAttributedString+TKCategory.h │ │ ├── NSMutableAttributedString+TKCategory.m │ │ ├── NSObject+DataHelper.h │ │ ├── NSObject+DataHelper.m │ │ ├── NSObject+JSON.h │ │ ├── NSObject+JSON.m │ │ ├── NSObject+TKCategory.h │ │ ├── NSObject+TKCategory.m │ │ ├── NSString+TKCategory.h │ │ ├── NSString+TKCategory.m │ │ ├── NSString+TKUIKit.h │ │ ├── NSString+TKUIKit.m │ │ ├── NSTimer+Blocks.h │ │ ├── NSTimer+Blocks.m │ │ ├── NSURLRequest+TKCategory.h │ │ ├── NSURLRequest+TKCategory.m │ │ ├── NSURLSession+TKCategory.h │ │ ├── NSURLSession+TKCategory.m │ │ ├── NSURLSession+TKProgressDataTask.h │ │ ├── NSURLSession+TKProgressDataTask.m │ │ ├── NSUserDefaults+iCloud.h │ │ ├── NSUserDefaults+iCloud.m │ │ └── URLRequest+TKCategory.swift │ └── UIKit │ │ ├── Base │ │ ├── UIApplication+TKCategory.h │ │ ├── UIApplication+TKCategory.m │ │ ├── UIDevice+TKCategory.swift │ │ ├── UIScreen+TKCategory.h │ │ ├── UIScreen+TKCategory.m │ │ ├── UITraitCollection+TKCategory.h │ │ └── UITraitCollection+TKCategory.m │ │ ├── Controllers │ │ ├── UIActionSheet+Blocks.h │ │ ├── UIActionSheet+Blocks.m │ │ ├── UIActionSheet+TKCategory.h │ │ ├── UIActionSheet+TKCategory.m │ │ ├── UIAlertController+TKCategory.h │ │ ├── UIAlertController+TKCategory.m │ │ ├── UIAlertView+Blocks.h │ │ ├── UIAlertView+Blocks.m │ │ ├── UIAlertView+TKCategory.h │ │ ├── UIAlertView+TKCategory.m │ │ ├── UIControl+Blocks.h │ │ ├── UIControl+Blocks.m │ │ ├── UIImagePickerController+TKCategory.h │ │ ├── UIImagePickerController+TKCategory.m │ │ ├── UIViewController+TKCategory.h │ │ └── UIViewController+TKCategory.m │ │ ├── Elements │ │ ├── UIColor+TKCategory.h │ │ ├── UIColor+TKCategory.m │ │ ├── UIFont+TKCategory.h │ │ ├── UIFont+TKCategory.m │ │ ├── UIGestureRecognizer+Blocks.h │ │ ├── UIGestureRecognizer+Blocks.m │ │ ├── UIGestureRecognizer+TKCategory.h │ │ ├── UIGestureRecognizer+TKCategory.m │ │ ├── UIImage+TKCategory.h │ │ ├── UIImage+TKCategory.m │ │ ├── UIMotionEffectGroup+TKCategory.h │ │ └── UIMotionEffectGroup+TKCategory.m │ │ └── Views │ │ ├── UIBarButtonItem+TKCategory.h │ │ ├── UIBarButtonItem+TKCategory.m │ │ ├── UIButton+TKCategory.h │ │ ├── UIButton+TKCategory.m │ │ ├── UIImageView+TKCategory.h │ │ ├── UIImageView+TKCategory.m │ │ ├── UILabel+Initializers.h │ │ ├── UILabel+Initializers.m │ │ ├── UILabel+Spacing.swift │ │ ├── UILabel+TKCategory.h │ │ ├── UILabel+TKCategory.m │ │ ├── UINavigationBar+TKCategory.h │ │ ├── UINavigationBar+TKCategory.m │ │ ├── UIPanGestureRecognizer+VelocityDirection.h │ │ ├── UIPanGestureRecognizer+VelocityDirection.m │ │ ├── UIScrollView+Positioning.h │ │ ├── UIScrollView+Positioning.m │ │ ├── UIScrollview+TKCategory.h │ │ ├── UIScrollview+TKCategory.m │ │ ├── UITextField+TKCategory.h │ │ ├── UITextField+TKCategory.m │ │ ├── UIView+GestureRecognizerBlock.h │ │ ├── UIView+GestureRecognizerBlock.m │ │ ├── UIView+Initializers.h │ │ ├── UIView+Initializers.m │ │ ├── UIView+Positioning.h │ │ ├── UIView+Positioning.m │ │ ├── UIView+TKCategory.h │ │ └── UIView+TKCategory.m ├── CreditCard │ ├── TKCreditCardCVVTextField.h │ ├── TKCreditCardCVVTextField.m │ ├── TKCreditCardExpirationTextField.h │ ├── TKCreditCardExpirationTextField.m │ ├── TKCreditCardNumberTextField.h │ ├── TKCreditCardNumberTextField.m │ ├── TKCreditCardZipTextField.h │ ├── TKCreditCardZipTextField.m │ ├── TKPhoneNumberTextField.h │ └── TKPhoneNumberTextField.m ├── Extra │ ├── TKSafariWebCredentials.h │ ├── TKSafariWebCredentials.m │ ├── TKSoundAlertController.h │ └── TKSoundAlertController.m ├── Headers.h ├── Supporting Files │ ├── CurryImages.xcassets │ │ ├── keyboard-backspace-key.imageset │ │ │ ├── Contents.json │ │ │ ├── Delete@3x.png │ │ │ ├── backspace-key.png │ │ │ └── backspace-key@2x.png │ │ ├── keyboard-down-keyboard.imageset │ │ │ ├── Contents.json │ │ │ ├── down-keyboard.png │ │ │ └── down-keyboard@2x.png │ │ ├── keyboard-move-keyboard-dots.imageset │ │ │ ├── Contents.json │ │ │ ├── move-keyboard-dots.png │ │ │ └── move-keyboard-dots@2x.png │ │ └── keyboard-next-key.imageset │ │ │ ├── Contents.json │ │ │ ├── arrow@3x.png │ │ │ ├── next-key.png │ │ │ └── next-key@2x.png │ └── Info.plist ├── TKFoundation.h ├── TKUIKit.h ├── ViewControllers │ ├── TKCardModalViewController.h │ ├── TKCardModalViewController.m │ ├── TKCollectionViewController.h │ ├── TKCollectionViewController.m │ ├── TKCustomPresentationViewController.h │ ├── TKCustomPresentationViewController.m │ ├── TKKeyboardTableViewController.h │ ├── TKKeyboardTableViewController.m │ ├── TKTableViewController.h │ ├── TKTableViewController.m │ ├── TKVideoViewController.h │ ├── TKVideoViewController.m │ ├── TKWebViewController.h │ └── TKWebViewController.m ├── Views │ ├── TKCurrentTimeLabel.h │ ├── TKCurrentTimeLabel.m │ ├── TKDecimalInputView.h │ ├── TKDecimalInputView.m │ ├── TKDecimalInputWithNextKeyView.h │ ├── TKDecimalInputWithNextKeyView.m │ ├── TKExtendedScrollView.h │ ├── TKExtendedScrollView.m │ ├── TKGradientView.h │ ├── TKGradientView.m │ ├── TKInputKey.h │ ├── TKInputKey.m │ ├── TKInputView.h │ ├── TKInputView.m │ ├── TKNumberInputView.h │ ├── TKNumberInputView.m │ ├── TKNumberInputWithNextKeyView.h │ ├── TKNumberInputWithNextKeyView.m │ ├── TKSectionedScrollView.h │ ├── TKSectionedScrollView.m │ ├── TKShapeView.h │ ├── TKShapeView.m │ ├── TKStepperCell.h │ ├── TKStepperCell.m │ ├── TKSwitchCell.h │ ├── TKSwitchCell.m │ ├── TKTextFieldCell.h │ ├── TKTextFieldCell.m │ ├── TKTextView.h │ ├── TKTextView.m │ ├── TKWindow.h │ └── TKWindow.m └── curry.h ├── curryMac ├── Info.plist ├── NSView+Positioning.h ├── NSView+Positioning.m ├── NSView+TKCategory.h ├── NSView+TKCategory.m └── curryMac.h ├── curryTV ├── Info.plist └── curryTV.h ├── curryTests ├── DataTests.h ├── DataTests.m ├── NSArrayTests.h ├── NSArrayTests.m ├── NSStringTests.h ├── NSStringTests.m ├── Supporting Files │ └── Info.plist ├── UIViewTests.h ├── UIViewTests.m └── curryTests.m └── curryWatch ├── Info.plist └── curryWatch.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.swift linguist-language=Swift -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /Examples/Assets/Video/balllin.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Assets/Video/balllin.mov -------------------------------------------------------------------------------- /Examples/Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Examples/BlocksViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheetBlockViewController.h 3 | // Created by Devin Ross on 5/1/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | @import curry; 34 | 35 | @interface BlocksViewController : UIViewController 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Examples/Examples/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bridging-Header.h 3 | // Created by Devin Ross on 4/10/15. 4 | // Copyright (c) 2015 Devin Ross. All rights reserved. 5 | // 6 | /* 7 | 8 | curry || https://github.com/devinross/curry 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation 12 | files (the "Software"), to deal in the Software without 13 | restriction, including without limitation the rights to use, 14 | copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the 16 | Software is furnished to do so, subject to the following 17 | conditions: 18 | 19 | The above copyright notice and this permission notice shall be 20 | included in all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #ifndef Header_h 34 | #define Header_h 35 | 36 | @import curry; 37 | #import "RootTableViewController.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Examples/Examples/BrightnessViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BrightnessViewController.swift 3 | // Created by Devin Ross on 9/12/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | import UIKit 34 | 35 | class BrightnessViewController: UIViewController { 36 | 37 | override func loadView() { 38 | super.loadView() 39 | 40 | self.view.backgroundColor = UIColor.white 41 | 42 | 43 | let btn = UIButton(type: .roundedRect) 44 | btn.frame = CGRectCenteredInRect(self.view.bounds, 200, 60) 45 | 46 | btn.setTitle("Lower Brightness", for: .normal) 47 | btn.addTarget(self, action: #selector(changeBrightness), for: .touchUpInside) 48 | 49 | self.view.addSubview(btn) 50 | 51 | } 52 | 53 | @objc func changeBrightness(sender: UIButton){ 54 | 55 | 56 | if sender.tag == 0 { 57 | 58 | sender.tag = 1 59 | UIScreen.main.setBrightness(0.2, animated: true) 60 | sender.setTitle("Raise Brightness", for: .normal) 61 | 62 | }else{ 63 | 64 | sender.tag = 0 65 | UIScreen.main.setBrightness(1, animated: true) 66 | sender.setTitle("Lower Brightness", for: .normal) 67 | 68 | } 69 | 70 | 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Examples/Examples/CellsController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellsController.swift 3 | // Examples 4 | // 5 | // Created by Devin Ross on 1/12/21. 6 | // Copyright © 2021 Devin Ross. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import curry 11 | 12 | class CellsController : TKTableViewController{ 13 | 14 | 15 | var cells : [UITableViewCell] = [] 16 | 17 | 18 | override func loadView() { 19 | super.loadView() 20 | 21 | let fieldCell = TKTextFieldCell(style: .default, reuseIdentifier: "field") 22 | fieldCell.textField.placeholder = "Field" 23 | fieldCell.textField.text = "Field" 24 | 25 | let switchCell = TKSwitchCell(style: .default, reuseIdentifier: "switch") 26 | switchCell.textLabel?.text = "Field" 27 | 28 | self.cells = [fieldCell,switchCell] 29 | 30 | 31 | } 32 | 33 | override func numberOfSections(in tableView: UITableView) -> Int { 34 | return 1 35 | } 36 | 37 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 38 | return self.cells.count 39 | } 40 | 41 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 42 | return cells[indexPath.row] 43 | } 44 | 45 | 46 | 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Examples/Examples/CustomKeyboardViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomKeyboardViewController.swift 3 | // Created by Devin Ross on 9/12/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | import UIKit 34 | 35 | class CustomKeyboardViewController: UIViewController { 36 | 37 | 38 | override func loadView() { 39 | super.loadView() 40 | 41 | self.view.backgroundColor = UIColor.white 42 | self.edgesForExtendedLayout = .bottom 43 | 44 | let textField = UITextField(frame: CGRectMakeInset(0, 0, self.view.width, 100, 30, 20)) 45 | textField.autoresizingMask = [.flexibleWidth] 46 | textField.backgroundColor = UIColor(white: 0.95, alpha: 1) 47 | self.view.addSubview(textField) 48 | 49 | let input = TKNumberInputView(frame: CGRect(x: 0, y: 0, width: self.view.width, height: 216)) 50 | input.textField = textField 51 | textField.inputView = input 52 | 53 | 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Examples/Examples/GesturesViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GesturesViewController.swift 3 | // Created by Devin Ross on 9/12/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import UIKit 33 | 34 | class GesturesViewController: UIViewController { 35 | 36 | 37 | override func loadView(){ 38 | super.loadView() 39 | 40 | self.view.backgroundColor = UIColor.white 41 | 42 | 43 | let label = UILabel(frame: CGRect(x: 0, y: self.view.height - 60, width: self.view.width, height: 60)) 44 | label.textAlignment = .center 45 | self.view.addSubview(label) 46 | 47 | let pan = UIPanGestureRecognizer { (sender) in 48 | label.text = "\(sender.state) (\(sender.location(in: self.view).x),\(sender.location(in: self.view).y))" 49 | } 50 | self.view.addGestureRecognizer(pan) 51 | 52 | 53 | } 54 | 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/AppIcon.appiconset/120 - iPhone Copy 4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/AppIcon.appiconset/120 - iPhone Copy 4@2x.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/AppIcon.appiconset/120 - iPhone Copy 4@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/AppIcon.appiconset/120 - iPhone Copy 4@3x.png -------------------------------------------------------------------------------- /Examples/Examples/Images.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 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "120 - iPhone Copy 4@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "120 - iPhone Copy 4@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "1024x1024", 47 | "idiom" : "ios-marketing", 48 | "filename" : "1024.png", 49 | "scale" : "1x" 50 | } 51 | ], 52 | "info" : { 53 | "version" : 1, 54 | "author" : "xcode" 55 | } 56 | } -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "2436h", 7 | "filename" : "iphonex.png", 8 | "minimum-system-version" : "11.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "minimum-system-version" : "11.0", 17 | "subtype" : "2436h", 18 | "scale" : "3x" 19 | }, 20 | { 21 | "extent" : "full-screen", 22 | "idiom" : "iphone", 23 | "subtype" : "736h", 24 | "filename" : "sixplus.png", 25 | "minimum-system-version" : "8.0", 26 | "orientation" : "portrait", 27 | "scale" : "3x" 28 | }, 29 | { 30 | "orientation" : "landscape", 31 | "idiom" : "iphone", 32 | "extent" : "full-screen", 33 | "minimum-system-version" : "8.0", 34 | "subtype" : "736h", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "extent" : "full-screen", 39 | "idiom" : "iphone", 40 | "subtype" : "667h", 41 | "filename" : "sim.png", 42 | "minimum-system-version" : "8.0", 43 | "orientation" : "portrait", 44 | "scale" : "2x" 45 | }, 46 | { 47 | "orientation" : "portrait", 48 | "idiom" : "iphone", 49 | "filename" : "four.png", 50 | "extent" : "full-screen", 51 | "minimum-system-version" : "7.0", 52 | "scale" : "2x" 53 | }, 54 | { 55 | "extent" : "full-screen", 56 | "idiom" : "iphone", 57 | "subtype" : "retina4", 58 | "filename" : "five-1.png", 59 | "minimum-system-version" : "7.0", 60 | "orientation" : "portrait", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "orientation" : "portrait", 65 | "idiom" : "iphone", 66 | "extent" : "full-screen", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "orientation" : "portrait", 71 | "idiom" : "iphone", 72 | "extent" : "full-screen", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "orientation" : "portrait", 77 | "idiom" : "iphone", 78 | "extent" : "full-screen", 79 | "subtype" : "retina4", 80 | "scale" : "2x" 81 | } 82 | ], 83 | "info" : { 84 | "version" : 1, 85 | "author" : "xcode" 86 | } 87 | } -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/five-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/LaunchImage.launchimage/five-1.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/four.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/LaunchImage.launchimage/four.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/iphonex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/LaunchImage.launchimage/iphonex.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/sim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/LaunchImage.launchimage/sim.png -------------------------------------------------------------------------------- /Examples/Examples/Images.xcassets/LaunchImage.launchimage/sixplus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/Examples/Images.xcassets/LaunchImage.launchimage/sixplus.png -------------------------------------------------------------------------------- /Examples/Examples/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 | Curry 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Examples/Examples/PDFGeneratorViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFGeneratorViewController.h 3 | // Created by Devin Ross on 9/25/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import 33 | 34 | @import MessageUI; 35 | 36 | @interface PDFGeneratorViewController : UIViewController 37 | 38 | @property (nonatomic,strong) UIWebView *webView; 39 | 40 | @end 41 | 42 | 43 | 44 | @interface UIPrintPageRenderer (PDF) 45 | - (NSData*) printToPDF; 46 | @end 47 | 48 | 49 | @interface UIWebView (PDF) 50 | 51 | - (NSData*) generatePDFData; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Examples/Examples/RootTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootTableViewController.h 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface RootTableViewController : UITableViewController 35 | 36 | @property (nonatomic,strong) NSArray *items; 37 | 38 | @end -------------------------------------------------------------------------------- /Examples/Examples/VelocityViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // VelocityViewController.h 3 | // Created by Devin Ross on 2/22/18. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | @import curry; 34 | 35 | @interface VelocityViewController : UIViewController 36 | 37 | @property (nonatomic,strong) NSArray *pegs; 38 | @property (nonatomic,strong) UIView *block; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Examples/Examples/VideoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VideoViewController.swift 3 | // Created by Devin Ross on 9/12/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import UIKit 33 | 34 | class VideoViewController: UIViewController { 35 | 36 | var videoViewController: TKVideoViewController? 37 | 38 | override func loadView() { 39 | super.loadView() 40 | 41 | self.title = "Video" 42 | self.view.backgroundColor = UIColor.white 43 | 44 | 45 | self.videoViewController = TKVideoViewController(videoTitle: "balllin", ofType: "mov") 46 | self.videoViewController?.view.frame = self.view.bounds.insetBy(dx: 40, dy: 60) 47 | self.view.addSubview((self.videoViewController?.view)!) 48 | 49 | } 50 | 51 | override func viewDidAppear(_ animated: Bool) { 52 | super.viewDidAppear(animated) 53 | self.videoViewController?.play() 54 | } 55 | 56 | override func viewWillDisappear(_ animated: Bool) { 57 | super.viewWillDisappear(animated) 58 | self.videoViewController?.pause() 59 | } 60 | 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /Examples/TVExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // TVExample 4 | // 5 | // Created by Devin Ross on 3/23/16. 6 | // Copyright © 2016 Devin Ross. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | @import curryTV; 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /Examples/TVExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TVExample 4 | // 5 | // Created by Devin Ross on 3/23/16. 6 | // Copyright © 2016 Devin Ross. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets" : [ 3 | { 4 | "size" : "1280x768", 5 | "idiom" : "tv", 6 | "filename" : "App Icon - Large.imagestack", 7 | "role" : "primary-app-icon" 8 | }, 9 | { 10 | "size" : "400x240", 11 | "idiom" : "tv", 12 | "filename" : "App Icon - Small.imagestack", 13 | "role" : "primary-app-icon" 14 | }, 15 | { 16 | "size" : "1920x720", 17 | "idiom" : "tv", 18 | "filename" : "Top Shelf Image.imageset", 19 | "role" : "top-shelf-image" 20 | } 21 | ], 22 | "info" : { 23 | "version" : 1, 24 | "author" : "xcode" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/TVExample/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "landscape", 5 | "idiom" : "tv", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "9.0", 8 | "scale" : "1x" 9 | } 10 | ], 11 | "info" : { 12 | "version" : 1, 13 | "author" : "xcode" 14 | } 15 | } -------------------------------------------------------------------------------- /Examples/TVExample/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 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Examples/TVExample/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | arm64 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Examples/TVExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // TVExample 4 | // 5 | // Created by Devin Ross on 3/23/16. 6 | // Copyright © 2016 Devin Ross. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Examples/TVExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // TVExample 4 | // 5 | // Created by Devin Ross on 3/23/16. 6 | // Copyright © 2016 Devin Ross. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Examples/TVExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TVExample 4 | // 5 | // Created by Devin Ross on 3/23/16. 6 | // Copyright © 2016 Devin Ross. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/Examples/appicon.png -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Devin Ross 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | ![curry](https://github.com/devinross/curry/blob/master/Examples/appicon.png?raw=true) 2 | 3 | curry 4 | ============ 5 | Curry is an Cocoa Touch framework built to enhance and compliment Foundation and UIKit. If you're looking to see some of the framework in action see the example project or read the [documentation](http://devinross.com/curry/ 6 | ). 7 | 8 | ## Documentation 9 | Browse the documentation at [devinross.com/curry](http://devinross.com/curry/). To add the documentation directly to Xcode, [download the docset](http://devinross.com/curry/com.devinross.curry.docset.zip) and place the docset into the `~/Library/Developer/Shared/Documentation/DocSets/` folder. 10 | 11 | 12 | Follow me on twitter [@devin_ross](http://twitter.com/devin_ross). -------------------------------------------------------------------------------- /curry.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /curry.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /curry/Categories/Animations/CAAnimation+TKAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // CAAnimation+TKAnimation.h 3 | // Created by Devin Ross on 2/9/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import QuartzCore; 33 | 34 | /** Additional functionality for `CAAnimation`. */ 35 | @interface CAAnimation (TKAnimation) 36 | 37 | /** The callback block executed when the animation completes. */ 38 | @property (nonatomic, copy) void (^completion)(BOOL finished); 39 | 40 | 41 | /** A callback block executed when the animation starts. */ 42 | @property (nonatomic, copy) void (^start)(void); 43 | 44 | /** Set the animation completion block. 45 | @param completion The block executed when the animation is complete. 46 | */ 47 | - (void) setCompletion:(void (^)(BOOL finished))completion; 48 | 49 | @end -------------------------------------------------------------------------------- /curry/Categories/Animations/UIView+Velocity.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Velocity.swift 3 | // Created by Devin Ross on 2/22/18. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import UIKit 33 | 34 | extension UIView { 35 | 36 | 37 | @available(tvOS 10.0, *) 38 | @available(iOS 10.0, *) 39 | @discardableResult @objc public class func animate(withDuration: TimeInterval, dampingRatio: CGFloat, initialVelocity:CGVector, animations: @escaping (()->Void), completion: ((UIViewAnimatingPosition) -> Swift.Void)?) -> UIViewPropertyAnimator { 40 | 41 | let animator = UIViewPropertyAnimator(duration: withDuration, dampingRatio: dampingRatio, animations: animations) 42 | 43 | if let com = completion { 44 | animator.addCompletion(com) 45 | } 46 | 47 | let spring = UISpringTimingParameters(dampingRatio: dampingRatio, initialVelocity: initialVelocity) 48 | animator.continueAnimation(withTimingParameters: spring, durationFactor: 1) 49 | animator.startAnimation() 50 | return animator 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/Bundle+TKCategory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bundle+TKCategory.swift 3 | // Created by Devin Ross on 9/15/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import Foundation 33 | 34 | 35 | extension Bundle { 36 | 37 | @objc public var appName: String? { 38 | 39 | if let info = self.infoDictionary { 40 | if let appName = info[kCFBundleNameKey as String]{ 41 | return appName as? String 42 | } 43 | } 44 | 45 | return nil 46 | } 47 | 48 | @objc public var version: String? { 49 | 50 | if let info = self.infoDictionary { 51 | if let version = info["CFBundleShortVersionString"]{ 52 | return version as? String 53 | } 54 | } 55 | 56 | return nil 57 | } 58 | 59 | @objc public var build: String? { 60 | 61 | if let info = self.infoDictionary { 62 | if let build = info[kCFBundleVersionKey as String]{ 63 | return build as? String 64 | } 65 | } 66 | 67 | return nil 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSArray+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+TKCategory.h 3 | // Created by Devin Ross on 11/9/10. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | /** Additional functionality for `NSArray`. */ 35 | @interface NSArray (TKCategory) 36 | 37 | /** Returns the object in the array with the lowest index value. 38 | @return The object in the array with the lowest index value. If the array is empty, returns nil. 39 | */ 40 | @property (nonatomic, readonly, strong) id firstObject; 41 | 42 | /** Returns a random object in the array. 43 | @return The object in the array with the lowest index value. If the array is empty, returns nil. 44 | */ 45 | @property (nonatomic, readonly, strong) id randomObject; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSArray+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+TKCategory.m 3 | // Created by Devin Ross on 11/9/10. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "NSArray+TKCategory.h" 33 | 34 | @implementation NSArray (TKCategory) 35 | 36 | - (id) firstObject{ 37 | if(self.count<1) return nil; 38 | return self[0]; 39 | } 40 | 41 | - (id) randomObject{ 42 | if(self.count<1) return nil; 43 | 44 | return self[arc4random() % [self count]]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSAttributedString+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+TKCategory.h 3 | // Created by Devin Ross on 12/16/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import UIKit; 34 | 35 | /** Additional functionality for `NSAttributedString`. */ 36 | @interface NSAttributedString (TKCategory) 37 | 38 | 39 | + (instancetype) attributedStringWithFormat:(NSString *)format, ...; 40 | 41 | /** Creates an attributed string with a line height. 42 | @param text The text of the string. 43 | @param lineHeight The line height of the attributed string. 44 | @return A `NSAttributedString` object. 45 | */ 46 | + (NSAttributedString*) attributedStringWithText:(NSString*)text lineHeight:(CGFloat)lineHeight; 47 | 48 | /** Creates an attributed string with a specific kerning. 49 | @param text The text of the string. 50 | @param kerning The kerning of the attributed string. 51 | @return A `NSAttributedString` object. 52 | */ 53 | + (NSAttributedString*) attributedStringWithText:(NSString *)text kerning:(CGFloat)kerning; 54 | 55 | 56 | + (NSAttributedString*) attributedStringWithText:(NSString *)text lineHeight:(CGFloat)space kerning:(CGFloat)kerning; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSBundle+Receipts.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+Receipts.h 3 | // Created by Devin Ross on 10/25/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import StoreKit; 34 | 35 | @interface NSBundle (Receipts) 36 | 37 | - (void) requestReceiptOnAppStore:(void(^)(id receipt, NSURLResponse *response, NSError *error))completion; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSMutableArray+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+TKCategory.h 3 | // Created by Devin Ross on 4/12/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | /** Additional functionality for `NSMutableArray`. */ 35 | @interface NSMutableArray (TKCategory) 36 | 37 | /** Shuffles the order of the objects. */ 38 | - (void) shuffle; 39 | 40 | /** Remove first object. */ 41 | - (void) removeFirstObject; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSMutableArray+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+TKCategory.m 3 | // Created by Devin Ross on 4/12/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | #import "NSMutableArray+TKCategory.h" 32 | 33 | @implementation NSMutableArray (TKCategory) 34 | 35 | - (void) shuffle{ 36 | NSUInteger count = [self count]; 37 | for (NSUInteger i = 0; i < count; ++i) { 38 | NSInteger nElements = count - i; 39 | NSInteger n = (arc4random() % nElements) + i; 40 | [self exchangeObjectAtIndex:i withObjectAtIndex:n]; 41 | } 42 | } 43 | 44 | 45 | - (void) removeFirstObject{ 46 | [self removeObjectAtIndex:0]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSObject+DataHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+DataHelper.h 3 | // Created by Devin Ross on 1/31/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | @interface NSObject (DataHelper) 35 | 36 | + (NSArray*) arrayOfObjectsWithDataArray:(NSArray*)array; 37 | + (NSArray*) arrayOfDataObjectsWithObjectsArray:(NSArray*)array; 38 | 39 | @end 40 | 41 | 42 | @interface NSArray (DataHelper) 43 | 44 | - (NSDictionary *) groupByKey:(NSString *)key; 45 | 46 | @end -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSString+TKUIKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+TKUIKit.h 3 | // Created by Devin Ross on 10/13/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import UIKit; 34 | 35 | @interface NSString (TKUIKit) 36 | 37 | - (CGFloat) heightForWidth:(CGFloat)width andFont:(UIFont *)font; 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSString+TKUIKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+TKUIKit.m 3 | // Created by Devin Ross on 10/13/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "NSString+TKUIKit.h" 33 | 34 | @implementation NSString (TKUIKit) 35 | 36 | 37 | - (CGFloat) heightForWidth:(CGFloat)widthValue andFont:(UIFont *)font{ 38 | CGFloat result = font.pointSize + 4; 39 | CGSize textSize = { widthValue, CGFLOAT_MAX }; //Width and height of text area 40 | NSDictionary *atr = @{ NSFontAttributeName:font }; 41 | CGRect frame = [self boundingRectWithSize:textSize options:NSStringDrawingUsesLineFragmentOrigin attributes:atr context:nil]; 42 | CGSize size = CGSizeMake(frame.size.width, frame.size.height+1); 43 | return MAX(size.height, result); //At least one row 44 | } 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSURLRequest+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLRequest+TKCategory.h 3 | // Created by Devin Ross on 10/30/18. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | @import Foundation; 34 | 35 | NS_ASSUME_NONNULL_BEGIN 36 | 37 | @interface NSURLRequest (TKCategory) 38 | 39 | @property (nonatomic,readonly) NSString *curlString; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSURLRequest+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLRequest+TKCategory.m 3 | // Created by Devin Ross on 10/30/18. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "NSURLRequest+TKCategory.h" 33 | 34 | @implementation NSURLRequest (TKCategory) 35 | 36 | 37 | - (NSString *) curlString{ 38 | 39 | __block NSMutableString *displayString = [NSMutableString stringWithFormat:@"curl -v -X %@", self.HTTPMethod]; 40 | 41 | [displayString appendFormat:@" \'%@\'", self.URL.absoluteString]; 42 | 43 | [self.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id val, BOOL *stop) { 44 | [displayString appendFormat:@" -H \'%@: %@\'", key, val]; 45 | }]; 46 | 47 | if ([self.HTTPMethod isEqualToString:@"POST"] || 48 | [self.HTTPMethod isEqualToString:@"PUT"] || 49 | [self.HTTPMethod isEqualToString:@"PATCH"]) { 50 | 51 | [displayString appendFormat:@" -d \'%@\'", 52 | [[NSString alloc] initWithData:self.HTTPBody encoding:NSUTF8StringEncoding]]; 53 | } 54 | 55 | return displayString; 56 | } 57 | 58 | 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSUserDefaults+iCloud.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSUserDefaults+iCloud.h 3 | // Created by Devin Ross on 11/9/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | @interface NSUserDefaults (iCloud) 35 | 36 | + (NSUbiquitousKeyValueStore*) iCloudStoreStore; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/NSUserDefaults+iCloud.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSUserDefaults+iCloud.m 3 | // Created by Devin Ross on 11/9/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "NSUserDefaults+iCloud.h" 33 | 34 | @implementation NSUserDefaults (iCloud) 35 | 36 | + (NSUbiquitousKeyValueStore*) iCloudStoreStore{ 37 | return [NSUbiquitousKeyValueStore defaultStore]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /curry/Categories/Foundation/URLRequest+TKCategory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // URLRequest+TKCategory.swift 3 | // Created by Devin Ross on 10/30/18. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import Foundation 33 | 34 | extension URLRequest { 35 | 36 | /** 37 | Returns a cURL command representation of this URL request. 38 | */ 39 | public var curlString: String { 40 | guard let url = url else { return "" } 41 | var baseCommand = "curl \(url.absoluteString)" 42 | 43 | if httpMethod == "HEAD" { 44 | baseCommand += " --head" 45 | } 46 | 47 | var command = [baseCommand] 48 | 49 | if let method = httpMethod, method != "GET" && method != "HEAD" { 50 | command.append("-X \(method)") 51 | } 52 | 53 | if let headers = allHTTPHeaderFields { 54 | for (key, value) in headers where key != "Cookie" { 55 | command.append("-H '\(key): \(value)'") 56 | } 57 | } 58 | 59 | if let data = httpBody, let body = String(data: data, encoding: .utf8) { 60 | command.append("-d '\(body)'") 61 | } 62 | 63 | return command.joined(separator: " \\\n\t") 64 | } 65 | 66 | init?(curlString: String) { 67 | return nil 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Base/UIDevice+TKCategory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIDevice+TKCategory.swift 3 | // Created by Devin Ross on 9/13/16. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | import UIKit 33 | 34 | /// Additional functionality for `UIDevice`. 35 | extension UIDevice { 36 | 37 | /// Returns `true` if the device is an iPad. 38 | @objc public var padIdiom: Bool { 39 | return self.userInterfaceIdiom == .pad 40 | } 41 | 42 | /// Returns `true` if the device is an iPhone or iPod touch. 43 | @objc public var phoneIdiom: Bool { 44 | return self.userInterfaceIdiom == .phone 45 | } 46 | 47 | /// Returns `true` if the device is a tvOS device 48 | @objc public var tvIdiom: Bool { 49 | if #available(iOS 9.0, *) { 50 | return self.userInterfaceIdiom == .tv 51 | } else { 52 | return false 53 | } 54 | } 55 | 56 | /// Returns `true` if the device is a car play device 57 | @objc public var carPlayIdiom: Bool { 58 | if #available(iOS 9.0, *) { 59 | return self.userInterfaceIdiom == .carPlay 60 | } else { 61 | return false 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Base/UIScreen+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCategory+UIScreen.h 3 | // Created by Devin Ross on 8/31/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIScreen`. */ 35 | @interface UIScreen (TKCategory) 36 | 37 | /** The point size of one pixel on screen. (ie. @1x => 1, @2x => 0.5) */ 38 | @property (nonatomic, readonly) CGFloat onePixelSize; 39 | 40 | 41 | #if !TARGET_OS_TV 42 | 43 | /** Animate the screen brightness change. 44 | @param brightness The brightness (from 0.0 to 1.0) the screen should illuminate to. 45 | @param animated Animate the screen brightness change. 46 | */ 47 | - (void) setBrightness:(CGFloat)brightness animated:(BOOL)animated; 48 | 49 | #endif 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Base/UITraitCollection+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITraitCollection+TKCategory.h 3 | // Created by Devin Ross on 9/14/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface UITraitCollection (TKCategory) 35 | 36 | @property (nonatomic,readonly) BOOL phoneUserInterfaceIdiom; 37 | @property (nonatomic,readonly) BOOL padUserInterfaceIdiom; 38 | 39 | @property (nonatomic,readonly) BOOL compactHorizontalSizeClass; 40 | @property (nonatomic,readonly) BOOL compactVerticalSizeClass; 41 | @property (nonatomic,readonly) BOOL regularVerticalSizeClass; 42 | @property (nonatomic,readonly) BOOL regularHorizontalSizeClass; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Base/UITraitCollection+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITraitCollection+TKCategory.m 3 | // Created by Devin Ross on 9/14/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UITraitCollection+TKCategory.h" 33 | 34 | @implementation UITraitCollection (TKCategory) 35 | 36 | - (BOOL) phoneUserInterfaceIdiom{ 37 | return self.userInterfaceIdiom == UIUserInterfaceIdiomPhone; 38 | } 39 | - (BOOL) padUserInterfaceIdiom{ 40 | return self.userInterfaceIdiom == UIUserInterfaceIdiomPad; 41 | } 42 | 43 | 44 | - (BOOL) compactHorizontalSizeClass{ 45 | return self.horizontalSizeClass == UIUserInterfaceSizeClassCompact; 46 | } 47 | - (BOOL) compactVerticalSizeClass{ 48 | return self.verticalSizeClass == UIUserInterfaceSizeClassCompact; 49 | } 50 | - (BOOL) regularVerticalSizeClass{ 51 | return self.verticalSizeClass == UIUserInterfaceSizeClassRegular; 52 | } 53 | - (BOOL) regularHorizontalSizeClass{ 54 | return self.horizontalSizeClass == UIUserInterfaceSizeClassRegular; 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIActionSheet+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+TKCategory.h 3 | // Created by Devin Ross on 10/4/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIActionSheet`. */ 35 | @interface UIActionSheet (TKCategory) 36 | 37 | /** Creates and returns a UIActionSheet with the delegate. 38 | @param delegate The delegate for the sheet. 39 | @return The `UIActionSheet` object. 40 | */ 41 | + (UIActionSheet*) sheetWithDelegate:(id)delegate; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIActionSheet+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+TKCategory.m 3 | // Created by Devin Ross on 10/4/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIActionSheet+TKCategory.h" 33 | 34 | @implementation UIActionSheet (TKCategory) 35 | 36 | + (UIActionSheet*) sheetWithDelegate:(id)delegate{ 37 | 38 | return [[UIActionSheet alloc] initWithTitle:nil 39 | delegate:delegate 40 | cancelButtonTitle:nil 41 | destructiveButtonTitle:nil 42 | otherButtonTitles:nil]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIAlertController+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertController+TKCategory.h 3 | // Created by Devin Ross on 10/2/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface UIAlertController (TKCategory) 35 | 36 | + (UIAlertController*) alertControllerWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss; 37 | 38 | - (void) addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(UIAlertAction *action))handler; 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIAlertController+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertController+TKCategory.m 3 | // Created by Devin Ross on 10/2/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | #import "UIAlertController+TKCategory.h" 34 | 35 | @implementation UIAlertController (TKCategory) 36 | 37 | + (UIAlertController*) alertControllerWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss{ 38 | if(!dismiss) dismiss = NSLocalizedString(@"Dismiss", @"Dismiss Alert View"); 39 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; 40 | [alert addAction:[UIAlertAction actionWithTitle:dismiss style:UIAlertActionStyleCancel handler:nil]]; 41 | return alert; 42 | } 43 | 44 | - (void) addActionWithTitle:(nullable NSString *)title style:(UIAlertActionStyle)style handler:(void (^ __nullable)(UIAlertAction *action))handler{ 45 | [self addAction:[UIAlertAction actionWithTitle:title style:style handler:handler]]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIAlertView+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+TKCategory.h 3 | // Created by Devin Ross on 10/4/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIAlertView`. */ 35 | @interface UIAlertView (TKCategory) 36 | 37 | 38 | /** Creates, shows and returns a UIAlertView using with a button with the specified properties. 39 | @param title The title of the alert view. 40 | @param message The message of the alert view. 41 | @param dismiss The cancel button title. 42 | @return The `UIAlertView` object. 43 | */ 44 | + (UIAlertView*) showAlertViewWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIAlertView+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+TKCategory.m 3 | // Created by Devin Ross on 10/4/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIAlertView+TKCategory.h" 33 | 34 | @implementation UIAlertView (TKCategory) 35 | 36 | 37 | + (UIAlertView*) showAlertViewWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss{ 38 | if(!dismiss) dismiss = NSLocalizedString(@"Dismiss", @"Dismiss Alert View"); 39 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:dismiss otherButtonTitles:nil]; 40 | [alert show]; 41 | return alert; 42 | 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIControl+Blocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+Blocks.h 3 | // Created by Devin Ross on 5/1/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Introduces block callbacks to `UIControl`. */ 35 | @interface UIControl (Blocks) 36 | 37 | /** Add a callback block to a control event. 38 | @param handler The block that is called when an event occurs. 39 | @param controlEvents The events that would trigger a block. 40 | */ 41 | - (void) addEventHandler:(void (^)(id sender))handler forControlEvents:(UIControlEvents)controlEvents; 42 | 43 | /* Remove the blocks for a specific event. 44 | @param controlEvents The events that would trigger a block. 45 | */ 46 | - (void) removeEventHandlersForControlEvents:(UIControlEvents)controlEvents; 47 | 48 | /* A way to check if there is a callback for a specific block. 49 | @param controlEvents The events that would trigger a block. 50 | @return Returns YES if the event has a block. NO is it does not. 51 | */ 52 | - (BOOL) hasEventHandlersForControlEvents:(UIControlEvents)controlEvents; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIImagePickerController+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImagePickerController+TKCategory.h 3 | // Created by Devin Ross on 5/17/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIImagePickerController`. */ 35 | @interface UIImagePickerController (TKCategory) 36 | 37 | /** The device has a camera. */ 38 | + (BOOL) hasCamera; 39 | 40 | /** The device has a front facing camera. */ 41 | + (BOOL) hasFrontCamera; 42 | 43 | /** The device has a rear facing camera. */ 44 | + (BOOL) hasRearCamera; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIImagePickerController+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImagePickerController+TKCategory.m 3 | // Created by Devin Ross on 5/17/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIImagePickerController+TKCategory.h" 33 | 34 | @implementation UIImagePickerController (TKCategory) 35 | 36 | + (BOOL) hasCamera{ 37 | return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; 38 | } 39 | 40 | + (BOOL) hasFrontCamera{ 41 | return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]; 42 | } 43 | 44 | + (BOOL) hasRearCamera{ 45 | return [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIViewController+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+TKCategory.h 3 | // Created by Devin Ross on 8/23/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIViewController`. */ 35 | @interface UIViewController (TKCategory) 36 | 37 | 38 | /** Present a `UINavigationController` with a given root view controller. 39 | @param rootViewControllerToPresent The root view controller for the `UINavigationController`. 40 | @param animated Present the navigation controller with animation. 41 | @param completion Completion callback block. 42 | */ 43 | - (void) presentNavigationControllerWithRoot:(UIViewController *)rootViewControllerToPresent animated:(BOOL)animated completion:(void (^)(void))completion; 44 | 45 | 46 | - (void) presentAlertControllWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Controllers/UIViewController+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+TKCategory.m 3 | // Created by Devin Ross on 8/23/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIViewController+TKCategory.h" 33 | #import "UIAlertController+TKCategory.h" 34 | 35 | @implementation UIViewController (TKCategory) 36 | 37 | - (void) presentNavigationControllerWithRoot:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion{ 38 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewControllerToPresent]; 39 | nav.modalPresentationStyle = viewControllerToPresent.modalPresentationStyle; 40 | [self presentViewController:nav animated:flag completion:completion]; 41 | } 42 | 43 | 44 | - (void) presentAlertControllWithTitle:(NSString*)title message:(NSString*)message dismiss:(NSString*)dismiss{ 45 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message dismiss:dismiss]; 46 | [self presentViewController:alert animated:YES completion:nil]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Elements/UIGestureRecognizer+Blocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+Blocks.h 3 | // Created by Devin Ross on 4/16/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional block functionality for `UIGestureRecognizer`. */ 35 | @interface UIGestureRecognizer (Blocks) 36 | 37 | /** Creates a `UIGestureRecognizer` with a callback handler. 38 | @param block The callback handler. 39 | @return A gesture recognizer. 40 | */ 41 | + (nonnull instancetype) recognizerWithHandler:(void (^ _Nonnull )(UIGestureRecognizer *_Nonnull sender))block; 42 | 43 | /** Creates a `UIGestureRecognizer` with a callback handler. 44 | @param block The callback handler. 45 | @return A gesture recognizer. 46 | */ 47 | - (nonnull instancetype) initWithHandler:(void (^ _Nonnull )(UIGestureRecognizer *_Nonnull sender))block NS_REPLACES_RECEIVER; 48 | 49 | 50 | /** Set the gesture recognizer callback handler. */ 51 | @property (nonatomic, copy, setter = setHandler:) void (^ _Nonnull handler)(UIGestureRecognizer *_Nonnull sender); 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Elements/UIGestureRecognizer+Blocks.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+Blocks.m 3 | // Created by Devin Ross on 4/16/15. 4 | // 5 | 6 | #import "UIGestureRecognizer+Blocks.h" 7 | #import 8 | 9 | 10 | static const void *UIGestureRecognizerHandlerBlockKey = &UIGestureRecognizerHandlerBlockKey; 11 | 12 | 13 | @implementation UIGestureRecognizer (Blocks) 14 | 15 | + (instancetype) recognizerWithHandler:(void (^)(UIGestureRecognizer *sender))block{ 16 | return [[[self class] alloc] initWithHandler:block]; 17 | } 18 | 19 | - (instancetype) initWithHandler:(void (^)(UIGestureRecognizer *sender))block{ 20 | if(!(self=[self initWithTarget:self action:@selector(handleAction:)])) return nil; 21 | self.handler = block; 22 | return self; 23 | } 24 | 25 | 26 | - (void) handleAction:(UIGestureRecognizer *)recognizer{ 27 | void (^handler)(UIGestureRecognizer *sender) = recognizer.handler; 28 | if (!handler) return; 29 | 30 | void (^block)(void) = ^{ 31 | handler(self); 32 | }; 33 | 34 | block(); 35 | return; 36 | 37 | } 38 | 39 | - (void) setHandler:(void (^)(UIGestureRecognizer *sender))handler{ 40 | objc_setAssociatedObject(self, UIGestureRecognizerHandlerBlockKey, handler, OBJC_ASSOCIATION_COPY_NONATOMIC); 41 | } 42 | 43 | - (void (^)(UIGestureRecognizer *sender)) handler{ 44 | return objc_getAssociatedObject(self, UIGestureRecognizerHandlerBlockKey); 45 | } 46 | 47 | 48 | @end -------------------------------------------------------------------------------- /curry/Categories/UIKit/Elements/UIGestureRecognizer+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+TKCategory.m 3 | // Created by Devin Ross on 7/25/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIGestureRecognizer+TKCategory.h" 33 | 34 | @implementation UIGestureRecognizer (TKCategory) 35 | 36 | - (BOOL) began{ 37 | return self.state == UIGestureRecognizerStateBegan; 38 | } 39 | 40 | - (BOOL) changed{ 41 | return self.state == UIGestureRecognizerStateChanged; 42 | } 43 | 44 | - (BOOL) ended{ 45 | return self.state == UIGestureRecognizerStateEnded; 46 | } 47 | 48 | - (BOOL) cancelled{ 49 | return self.state == UIGestureRecognizerStateCancelled; 50 | } 51 | 52 | - (BOOL) failed{ 53 | return self.state == UIGestureRecognizerStateFailed; 54 | } 55 | 56 | - (BOOL) possible{ 57 | return self.state == UIGestureRecognizerStatePossible; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Elements/UIMotionEffectGroup+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIMotionEffectGroup+TKCategory.h 3 | // Created by Devin Ross on 11/9/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface UIMotionEffectGroup (TKCategory) 35 | 36 | + (UIMotionEffectGroup*) parallaxMotionEffectGroupWithXAngle:(CGFloat)xAngle yAngle:(CGFloat)yAngle xMove:(CGFloat)xMove yMove:(CGFloat)yMove; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIImageView+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+TKCategory.m 3 | // Created by Devin Ross on 12/12/10. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIImageView+TKCategory.h" 33 | 34 | 35 | @implementation UIImageView (TKCategory) 36 | 37 | + (instancetype) imageViewWithImageNamed:(NSString*)imageName{ 38 | return [[[self class] alloc] initWithImage:[UIImage imageNamed:imageName]]; 39 | } 40 | 41 | + (instancetype) imageViewWithImageNamed:(NSString*)imageName renderMode:(UIImageRenderingMode)mode{ 42 | UIImage *img = [[UIImage imageNamed:imageName] imageWithRenderingMode:mode]; 43 | return [[[self class] alloc] initWithImage:img]; 44 | } 45 | 46 | + (instancetype) imageViewWithFrame:(CGRect)frame{ 47 | return [[[self class] alloc] initWithFrame:frame]; 48 | } 49 | 50 | 51 | 52 | - (void) setAnimationImageNames:(NSArray *)names{ 53 | NSMutableArray *images = [NSMutableArray arrayWithCapacity:names.count]; 54 | for(NSString *name in names){ 55 | [images addObject:[UIImage imageNamed:name]]; 56 | } 57 | self.animationImages = images; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UILabel+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+TKCategory.h 3 | // Created by Devin Ross on 10/7/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UILabel`. */ 35 | @interface UILabel (TKCategory) 36 | 37 | /** This function will size to fit based on the `textAlignment`'s property. */ 38 | - (void) sizeToFitWithAlignment; 39 | 40 | /** This function will size to fit based on the `textAlignment`'s property and vertically center the label. */ 41 | - (void) sizeToFitWithAlignmentAndVerticalCentering; 42 | 43 | /** This function will adjust the labels height but keep the width the same. */ 44 | - (void) sizeToFitHeight; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UINavigationBar+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+TKCategory.h 3 | // Created by Devin Ross on 3/4/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UINavigationBar`. */ 35 | @interface UINavigationBar (TKCategory) 36 | 37 | /** Returns the one pixel line at the bottom of a `UINavigationBar`. */ 38 | @property (nonatomic, readonly, strong) UIView *hairlineDividerView; 39 | 40 | @end -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UINavigationBar+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationBar+TKCategory.m 3 | // Created by Devin Ross on 3/4/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UINavigationBar+TKCategory.h" 33 | 34 | @implementation UINavigationBar (TKCategory) 35 | 36 | - (UIView*) hairlineDividerView{ 37 | return [self _harry:self]; 38 | } 39 | 40 | - (UIImageView*) _harry:(UIView *)view { 41 | CGFloat diff = view.bounds.size.height - (1.0f / [UIScreen mainScreen].scale); 42 | 43 | if ([view isKindOfClass:UIImageView.class] && diff < 1.0f) { 44 | return (UIImageView *)view; 45 | } 46 | for (UIView *subview in view.subviews) { 47 | UIImageView *imageView = [self _harry:subview]; 48 | if (imageView) { 49 | return imageView; 50 | } 51 | } 52 | return nil; 53 | } 54 | 55 | - (UIView*) _hairlineViewUnder:(UIView *)view { 56 | if (([view isKindOfClass:UIImageView.class] && CGRectGetHeight(view.bounds) == 0.5) || (CGRectGetHeight(view.frame) == 1)) { 57 | return view; 58 | } 59 | for (UIView *subview in view.subviews) { 60 | UIView *hairline = [self _hairlineViewUnder:subview]; 61 | if (hairline) { 62 | return hairline; 63 | } 64 | } 65 | return nil; 66 | } 67 | 68 | @end -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIPanGestureRecognizer+VelocityDirection.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPanGestureRecognizer+VelocityDirection.h 3 | // Created by Devin Ross on 4/23/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry-fire 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additionality functionality for `UIPanGestureRecognizer` to determine the velocity. */ 35 | @interface UIPanGestureRecognizer (VelocityDirection) 36 | 37 | /** The velocity direction is trending upward. */ 38 | - (BOOL) velocityIsUp; 39 | 40 | /** The velocity is trending more downward. */ 41 | - (BOOL) velocityIsDown; 42 | 43 | /** The velocity is trending more to the left. */ 44 | - (BOOL) velocityIsLeft; 45 | 46 | /** The velocity is trending more to the right. */ 47 | - (BOOL) velocityIsRight; 48 | 49 | /** The velocity is trending more up-and-down. */ 50 | - (BOOL) velocityIsVertical; 51 | 52 | /** The velocity is trending more left-to-right. */ 53 | - (BOOL) velocityIsHorizontal; 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIScrollView+Positioning.h: -------------------------------------------------------------------------------- 1 | // 2 | // Positioning+UIScrollView.h 3 | // Created by Devin Ross on 7/1/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry-fire 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality dealing with `UIScrollView` positioning. */ 35 | @interface UIScrollView (Positioning) 36 | 37 | /** Returns the content width of a scroll-view. */ 38 | @property (nonatomic,assign) CGFloat contentWidth; 39 | 40 | /** Returns the content height of a scroll-view. */ 41 | @property (nonatomic,assign) CGFloat contentHeight; 42 | 43 | /** Returns the content x offset of a scroll-view. */ 44 | @property (nonatomic,assign) CGFloat contentXOffset; 45 | 46 | /** Returns the content y offset of a scroll-view. */ 47 | @property (nonatomic,assign) CGFloat contentYOffset; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIScrollView+Positioning.m: -------------------------------------------------------------------------------- 1 | // 2 | // Positioning+UIScrollView.m 3 | // Created by Devin Ross on 7/1/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry-fire 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIScrollView+Positioning.h" 33 | 34 | @implementation UIScrollView (Positioning) 35 | 36 | - (CGFloat) contentWidth{ 37 | return self.contentSize.width; 38 | } 39 | - (void) setContentWidth:(CGFloat)contentWidth{ 40 | self.contentSize = CGSizeMake(contentWidth, self.contentSize.height); 41 | } 42 | - (CGFloat) contentHeight{ 43 | return self.contentSize.height; 44 | } 45 | - (void) setContentHeight:(CGFloat)contentHeight{ 46 | self.contentSize = CGSizeMake(self.contentSize.width, contentHeight); 47 | } 48 | 49 | - (CGFloat) contentXOffset{ 50 | return self.contentOffset.x; 51 | } 52 | - (CGFloat) contentYOffset{ 53 | return self.contentOffset.y; 54 | } 55 | 56 | 57 | - (void) setContentXOffset:(CGFloat)contentXOffset{ 58 | self.contentOffset = CGPointMake(contentXOffset, self.contentOffset.y); 59 | } 60 | 61 | - (void) setContentYOffset:(CGFloat)contentYOffset{ 62 | self.contentOffset = CGPointMake(self.contentOffset.x, contentYOffset); 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIScrollview+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollview+TKCategory.h 3 | // Created by Devin Ross on 11/17/10. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UIScrollView`. */ 35 | @interface UIScrollView (TKCategory) 36 | 37 | /** Sets the content offset of the scrollview to zero (0,0). */ 38 | - (void) scrollToTop; 39 | 40 | /** Current horizontally scrolled page. */ 41 | @property (nonatomic,readonly) NSInteger currentHorizontalPage; 42 | 43 | /** Current vertical scrolled page. */ 44 | @property (nonatomic,readonly) NSInteger currentVerticalPage; 45 | 46 | /** States the content offset from the end of the scroll view. */ 47 | @property (nonatomic,assign,readonly) CGPoint contentOffsetFromEnd; 48 | 49 | @end -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIScrollview+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollview+TKCategory.m 3 | // Created by Devin Ross on 11/17/10. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | #import "UIScrollview+TKCategory.h" 32 | #import "TKFoundation.h" 33 | #import "TKUIKit.h" 34 | 35 | @implementation UIScrollView (TKCategory) 36 | 37 | - (void) scrollToTop{ 38 | self.contentOffset = CGPointMake( -self.contentInset.left, -self.contentInset.top); 39 | } 40 | 41 | - (NSInteger) currentHorizontalPage{ 42 | return (CGFrameGetWidth(self) / 2 + self.contentOffset.x) / CGFrameGetWidth(self); 43 | } 44 | - (NSInteger) currentVerticalPage{ 45 | return (CGFrameGetHeight(self) / 2 + self.contentOffset.y) / CGFrameGetHeight(self); 46 | } 47 | 48 | - (CGPoint) contentOffsetFromEnd{ 49 | CGFloat x = self.contentSize.width - self.contentOffset.x - CGFrameGetWidth(self); 50 | CGFloat y = self.contentSize.height - self.contentOffset.y - CGFrameGetHeight(self); 51 | 52 | if(self.contentSize.width < CGFrameGetWidth(self)){ 53 | x = -self.contentOffset.x; 54 | } 55 | 56 | if(self.contentSize.height < CGFrameGetHeight(self)){ 57 | y = -self.contentOffset.y; 58 | } 59 | 60 | return CGPointMake(x, y); 61 | } 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UITextField+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+TKCategory.h 3 | // Created by Devin Ross on 7/5/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality for `UITextField`. */ 35 | @interface UITextField (TKCategory) 36 | 37 | 38 | /** Changes the cursor position. A range length of zero will move the cursor and not select text. 39 | @param range The range of the selection. 40 | */ 41 | - (void) selectTextAtRange:(NSRange)range; 42 | 43 | @end -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UITextField+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+TKCategory.m 3 | // Created by Devin Ross on 7/5/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UITextField+TKCategory.h" 33 | 34 | @implementation UITextField (TKCategory) 35 | 36 | - (void) selectTextAtRange:(NSRange)range{ 37 | UITextPosition *start = [self positionFromPosition:[self beginningOfDocument] offset:range.location]; 38 | UITextPosition *end = [self positionFromPosition:start offset:range.length]; 39 | [self setSelectedTextRange:[self textRangeFromPosition:start toPosition:end]]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIView+GestureRecognizerBlock.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+GestureRecognizerBlock.h 3 | // Created by Devin Ross on 4/17/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry-fire 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** Additional functionality to `UIView` to add gesture */ 35 | @interface UIView (GestureRecognizerBlock) 36 | 37 | /** Add a `UITapGesture` with a callback handler. 38 | @param block The callback handler. 39 | */ 40 | - (UITapGestureRecognizer*) addTapGestureWithHandler:(void (^)(UIGestureRecognizer *sender))block; 41 | 42 | /** Add a `UITapGesture` with a target and action. 43 | @param target The target. 44 | @param action The action. 45 | */ 46 | - (UITapGestureRecognizer*) addTapGestureWithTarget:(id)target action:(SEL)action; 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /curry/Categories/UIKit/Views/UIView+GestureRecognizerBlock.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+GestureRecognizerBlock.m 3 | // Created by Devin Ross on 4/17/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry-fire 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "UIView+GestureRecognizerBlock.h" 33 | #import "UIGestureRecognizer+Blocks.h" 34 | 35 | @implementation UIView (GestureRecognizerBlock) 36 | 37 | - (UITapGestureRecognizer*) addTapGestureWithHandler:(void (^)(UIGestureRecognizer *sender))block{ 38 | UITapGestureRecognizer *tap = [UITapGestureRecognizer recognizerWithHandler:block]; 39 | [self addGestureRecognizer:tap]; 40 | return tap; 41 | } 42 | 43 | - (UITapGestureRecognizer*) addTapGestureWithTarget:(id)target action:(SEL)action{ 44 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:target action:action]; 45 | [self addGestureRecognizer:tap]; 46 | return tap; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardCVVTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardCVVTextField.h 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** This class is a subclass of `UITextField` for specifically entering credit card cvv numbers. */ 35 | @interface TKCreditCardCVVTextField : UITextField 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardCVVTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardCVVTextField.m 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKCreditCardCVVTextField.h" 33 | 34 | @implementation TKCreditCardCVVTextField 35 | 36 | - (instancetype) initWithFrame:(CGRect)frame{ 37 | if(!(self=[super initWithFrame:frame])) return nil; 38 | 39 | self.placeholder = NSLocalizedString(@"CVV", @""); 40 | self.keyboardType = UIKeyboardTypeNumberPad; 41 | self.autocorrectionType = UITextAutocorrectionTypeNo; 42 | [self addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; 43 | 44 | 45 | return self; 46 | } 47 | - (void) textFieldDidChange:(id)sender{ 48 | 49 | NSCharacterSet *nonDigitSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; 50 | NSString *txt = [[self.text componentsSeparatedByCharactersInSet:nonDigitSet] componentsJoinedByString:@""]; 51 | self.text = [txt substringToIndex:MIN(4,txt.length)]; 52 | 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardExpirationTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardExpirationTextField.h 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** This class is a subclass of `UITextField` for specifically entering expiration dates in the format MM / YY. */ 35 | @interface TKCreditCardExpirationTextField : UITextField 36 | 37 | /** The month typed in. */ 38 | @property (nonatomic,readonly) NSString *month; 39 | 40 | /** The year typed in. */ 41 | @property (nonatomic,readonly) NSString *year; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardNumberTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardNumberTextField.h 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import UIKit; 34 | 35 | /** This class is a subclass of `UITextField` for specifically entering credit card numbers. */ 36 | @interface TKCreditCardNumberTextField : UITextField 37 | 38 | /** Return YES if the current given text is a valid credit card number. */ 39 | @property (nonatomic,readonly) BOOL isValidCreditCard; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardZipTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardZipTextField.h 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** This class is a subclass of `UITextField` for specifically entering a five digit zip code. */ 35 | @interface TKCreditCardZipTextField : UITextField 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /curry/CreditCard/TKCreditCardZipTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKCreditCardZipTextField.m 3 | // Created by Devin Ross on 4/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKCreditCardZipTextField.h" 33 | 34 | @implementation TKCreditCardZipTextField 35 | 36 | 37 | - (instancetype) initWithFrame:(CGRect)frame{ 38 | if(!(self=[super initWithFrame:frame])) return nil; 39 | 40 | self.placeholder = NSLocalizedString(@"Zip", @""); 41 | self.keyboardType = UIKeyboardTypeNumberPad; 42 | self.autocorrectionType = UITextAutocorrectionTypeNo; 43 | [self addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; 44 | 45 | 46 | return self; 47 | } 48 | - (void) textFieldDidChange:(id)sender{ 49 | 50 | 51 | NSCharacterSet *nonDigitSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; 52 | NSString *txt = [[self.text componentsSeparatedByCharactersInSet:nonDigitSet] componentsJoinedByString:@""]; 53 | self.text = [txt substringToIndex:MIN(5,txt.length)]; 54 | 55 | 56 | } 57 | 58 | 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /curry/CreditCard/TKPhoneNumberTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKPhoneNumberTextField.h 3 | // Created by Devin Ross on 7/23/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface TKPhoneNumberTextField : UITextField 35 | 36 | @property (nonatomic,assign) NSInteger digitLimit; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /curry/CreditCard/TKPhoneNumberTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKPhoneNumberTextField.m 3 | // Created by Devin Ross on 7/23/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKPhoneNumberTextField.h" 33 | #import "NSString+TKCategory.h" 34 | 35 | @implementation TKPhoneNumberTextField 36 | 37 | - (id) initWithFrame:(CGRect)frame{ 38 | if(!(self=[super initWithFrame:frame])) return nil; 39 | 40 | self.placeholder = NSLocalizedString(@"Phone Number", @""); 41 | self.keyboardType = UIKeyboardTypeNumberPad; 42 | self.autocorrectionType = UITextAutocorrectionTypeNo; 43 | [self addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; 44 | 45 | return self; 46 | } 47 | 48 | 49 | - (void) textFieldDidChange:(id)sender{ 50 | 51 | NSCharacterSet *nonDigitSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; 52 | NSString *txt = [[self.text componentsSeparatedByCharactersInSet:nonDigitSet] componentsJoinedByString:@""]; 53 | 54 | if(self.digitLimit > 0){ 55 | txt = [txt substringToIndex:MIN(0,self.digitLimit)]; 56 | } 57 | 58 | 59 | self.text = [txt formattedPhoneNumberWithLastCharacterRemoved:NO]; 60 | 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /curry/Extra/TKSafariWebCredentials.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKSafariWebCredentials.h 3 | // Created by Devin Ross on 5/6/17. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | @interface TKSafariWebCredentials : NSObject 35 | 36 | + (void) getSafariCredentialsWithURL:(NSURL*)url failure:(void(^)(NSError *error))failure success:(void(^)(NSString *username, NSString *password))success; 37 | 38 | + (void) updateSafariCredentialsWithURL:(NSURL*)url email:(NSString*)email password:(NSString*)password failure:(void(^)(NSError *error))failure success:(void(^)(void))success; 39 | 40 | + (NSString*) generateSafariPassword; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "backspace-key.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "backspace-key@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "Delete@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/Delete@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/Delete@3x.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/backspace-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/backspace-key.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/backspace-key@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-backspace-key.imageset/backspace-key@2x.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-down-keyboard.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "down-keyboard.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "down-keyboard@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-down-keyboard.imageset/down-keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-down-keyboard.imageset/down-keyboard.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-down-keyboard.imageset/down-keyboard@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-down-keyboard.imageset/down-keyboard@2x.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-move-keyboard-dots.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "move-keyboard-dots.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "move-keyboard-dots@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-move-keyboard-dots.imageset/move-keyboard-dots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-move-keyboard-dots.imageset/move-keyboard-dots.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-move-keyboard-dots.imageset/move-keyboard-dots@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-move-keyboard-dots.imageset/move-keyboard-dots@2x.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "next-key.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "next-key@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "arrow@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/arrow@3x.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/next-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/next-key.png -------------------------------------------------------------------------------- /curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/next-key@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devinross/curry/ec4a33f94e50f622c1b720121a699e7e55947525/curry/Supporting Files/CurryImages.xcassets/keyboard-next-key.imageset/next-key@2x.png -------------------------------------------------------------------------------- /curry/Supporting Files/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 | 0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /curry/TKFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKFoundation.h 3 | // Created by Devin Ross on 7/25/09. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | 34 | 35 | 36 | #define TKLog(s, ...) NSLog( @"[%@ %@] %@",NSStringFromClass([self class]), NSStringFromSelector(_cmd),[NSString stringWithFormat:(s), ##__VA_ARGS__] ) 37 | #define MINANDMAXRANGE(_MIN,_VALUE,_MAX) MAX(_MIN,MIN(_VALUE,_MAX)) 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /curry/ViewControllers/TKCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCollectionViewController.h 3 | // Created by Devin Ross on 10/23/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface TKCollectionViewController : UIViewController 35 | 36 | - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout NS_DESIGNATED_INITIALIZER; 37 | 38 | @property (nonatomic,strong) UICollectionView *collectionView; 39 | @property (nonatomic,readonly) UICollectionViewLayout *collectionViewLayout; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /curry/Views/TKCurrentTimeLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKCurrentTimeLabel.h 3 | // Created by Devin Ross on 2/10/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** `TKCurrentTimeLabel` is a label that prints out the current time. */ 35 | @interface TKCurrentTimeLabel : UILabel 36 | 37 | /** For subclassing, return the current time string. */ 38 | @property (nonatomic, readonly, copy) NSString *currentTime; 39 | 40 | /** For subclassing, apply and text styling here. 41 | @param time The current time text. 42 | @return A attributed text string of the time string. 43 | */ 44 | - (NSAttributedString*) attributeStringWithTime:(NSString*)time; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /curry/Views/TKDecimalInputView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKDecimalInputView.h 3 | // Created by Devin Ross on 3/21/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | #import 34 | 35 | /** `TKDecimalInputView` is subclass `TKNumberInputView` with a decimal key. */ 36 | @interface TKDecimalInputView : TKNumberInputView 37 | 38 | ///---------------------------- 39 | /// @name Properties 40 | ///---------------------------- 41 | 42 | /** Decimal key. */ 43 | @property (nonatomic,strong) TKInputKey *decimalKey; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /curry/Views/TKDecimalInputWithNextKeyView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKDecimalInputWithNextKeyView.h 3 | // Created by Devin Ross on 3/21/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | #import 34 | 35 | /** `TKDecimalInputWithNextKeyView` is subclass `TKDecimalInputView` with a next key. */ 36 | @interface TKDecimalInputWithNextKeyView : TKDecimalInputView 37 | 38 | ///---------------------------- 39 | /// @name Properties 40 | ///---------------------------- 41 | /** The next key. */ 42 | @property (nonatomic,strong) TKInputKey *nextKey; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /curry/Views/TKExtendedScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKExtendedScrollView.h 3 | // Created by Devin Ross on 12/7/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** The planes that will receive the touch gestures. */ 35 | typedef NS_ENUM(NSInteger, TKExtendedScrollViewExtensionPlane) { 36 | TKExtendedScrollViewExtensionPlaneNone,// = 0, 37 | TKExtendedScrollViewExtensionPlaneX,// = 1 << 0, 38 | TKExtendedScrollViewExtensionPlaneY,// = 1 << 1, 39 | TKExtendedScrollViewExtensionPlaneXY// = 1 << 1 40 | 41 | }; 42 | 43 | 44 | /** This class is a subclass of `UIScrollView` that allows for tracking of gestures outside its bounds. Good for paged scroll view with pages that peek on both sides. */ 45 | @interface TKExtendedScrollView : UIScrollView 46 | 47 | /** A bitwise operator for the receiving touch gestures outside the scroll view for the x and y planes. */ 48 | @property (nonatomic,assign) TKExtendedScrollViewExtensionPlane extensionPlane; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /curry/Views/TKNumberInputWithNextKeyView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKNumberInputWithNextKeyView.h 3 | // Created by Devin Ross on 3/21/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | #import "TKNumberInputView.h" 34 | 35 | /** `TKNumberInputWithNextKeyView` is subclass `TKNumberInputView` with a next key. */ 36 | @interface TKNumberInputWithNextKeyView : TKNumberInputView 37 | 38 | ///---------------------------- 39 | /// @name Properties 40 | ///---------------------------- 41 | /** The next key. */ 42 | @property (nonatomic,strong) TKInputKey *nextKey; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /curry/Views/TKShapeView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKShapeView.h 3 | // Created by Devin Ross on 6/24/12. 4 | // 5 | // 6 | /* 7 | 8 | curry || https://github.com/devinross/curry 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation 12 | files (the "Software"), to deal in the Software without 13 | restriction, including without limitation the rights to use, 14 | copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the 16 | Software is furnished to do so, subject to the following 17 | conditions: 18 | 19 | The above copyright notice and this permission notice shall be 20 | included in all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | @import UIKit; 34 | @import QuartzCore; 35 | 36 | /** This class implements `UIView` backed by a `CAShapeLayer`. */ 37 | @interface TKShapeView : UIView 38 | 39 | /** The path defining the shape of the view. */ 40 | @property CGPathRef path; 41 | 42 | /** The CAShapeLayer object. */ 43 | @property (nonatomic,readonly) CAShapeLayer *shapeLayer; 44 | 45 | /** The stroke color */ 46 | @property (nonatomic,strong) UIColor *strokeColor; 47 | 48 | /** The stoke's line width. */ 49 | @property (nonatomic,assign) CGFloat lineWidth; 50 | 51 | /** The fill color. */ 52 | @property (nonatomic,strong) UIColor *fillColor; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /curry/Views/TKShapeView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKShapeView.m 3 | // Created by Devin on 6/24/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKShapeView.h" 33 | 34 | @implementation TKShapeView 35 | 36 | 37 | + (Class)layerClass { 38 | return [CAShapeLayer class]; 39 | } 40 | - (CAShapeLayer *) _shapeLayer{ 41 | return (CAShapeLayer *)self.layer; 42 | } 43 | 44 | 45 | 46 | - (CGPathRef) path{ 47 | return [self _shapeLayer].path; 48 | } 49 | - (void) setPath:(CGPathRef)path{ 50 | [self _shapeLayer].path = path; 51 | } 52 | 53 | - (CAShapeLayer*) shapeLayer{ 54 | return [self _shapeLayer]; 55 | } 56 | 57 | - (void) setStrokeColor:(UIColor*)strokeColor{ 58 | self.shapeLayer.strokeColor = strokeColor.CGColor; 59 | } 60 | - (void) setFillColor:(UIColor*)fillColor{ 61 | self.shapeLayer.fillColor = fillColor.CGColor; 62 | } 63 | 64 | - (UIColor*) strokeColor{ 65 | return [UIColor colorWithCGColor:self.shapeLayer.strokeColor]; 66 | } 67 | - (UIColor*) fillColor{ 68 | return [UIColor colorWithCGColor:self.shapeLayer.fillColor]; 69 | } 70 | 71 | - (void) setLineWidth:(CGFloat)strokeWidth{ 72 | self.shapeLayer.lineWidth = strokeWidth; 73 | } 74 | - (CGFloat) lineWidth{ 75 | return self.shapeLayer.lineWidth; 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /curry/Views/TKStepperCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKStepperCell.h 3 | // Created by Devin Ross on 4/9/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | @interface TKStepperCell : UITableViewCell 35 | 36 | @property (nonatomic,strong) UIStepper *stepper; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /curry/Views/TKStepperCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKStepperCell.m 3 | // Created by Devin Ross on 4/9/14. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKStepperCell.h" 33 | 34 | @interface TKStepperCell () 35 | @property (nonatomic,assign) UITableViewCellStyle theStyle; 36 | @end 37 | 38 | @implementation TKStepperCell 39 | 40 | 41 | - (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 42 | if(!(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; 43 | self.theStyle = style; 44 | self.stepper = [[UIStepper alloc] initWithFrame:CGRectZero]; 45 | self.accessoryView = self.stepper; 46 | 47 | return self; 48 | } 49 | - (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { 50 | return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; 51 | } 52 | 53 | - (void) layoutSubviews{ 54 | [super layoutSubviews]; 55 | 56 | if(self.theStyle == UITableViewCellStyleValue1){ 57 | CGRect rect = self.detailTextLabel.frame; 58 | rect.origin.x -= 4; 59 | self.detailTextLabel.frame = rect; 60 | } 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /curry/Views/TKSwitchCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKSwitchCell.h 3 | // Created by Devin Ross on 6/13/09. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** A `UITableViewCell` with a `UISwitch` */ 35 | @interface TKSwitchCell : UITableViewCell 36 | 37 | /** A `UISwitch`. */ 38 | @property (nonatomic,strong) UISwitch *switcher; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /curry/Views/TKSwitchCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKSwitchCell.m 3 | // Created by Devin Ross on 6/13/09. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | #import "TKSwitchCell.h" 32 | 33 | @implementation TKSwitchCell 34 | 35 | 36 | - (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 37 | if(!(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])) return nil; 38 | 39 | self.textLabel.backgroundColor = [UIColor clearColor]; 40 | self.switcher = [[UISwitch alloc] initWithFrame:CGRectMake(0,0,94,27)]; 41 | self.accessoryView = self.switcher; 42 | 43 | return self; 44 | } 45 | - (id) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { 46 | return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; 47 | } 48 | 49 | 50 | 51 | @end -------------------------------------------------------------------------------- /curry/Views/TKTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKTextfieldCell.h 3 | // Created by Devin Ross on 5/18/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** A table view cell with a text field. */ 35 | @interface TKTextFieldCell : UITableViewCell 36 | 37 | /** The text field. */ 38 | @property (nonatomic,strong) UITextField *textField; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /curry/Views/TKTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKTextView.h 3 | // Created by Devin Ross on 5/18/13. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import UIKit; 33 | 34 | /** This class creates a `UITextView` with placeholder text. */ 35 | @interface TKTextView : UITextView 36 | 37 | ///---------------------------- 38 | /// @name Properties 39 | ///---------------------------- 40 | 41 | /** The placeholder label. */ 42 | @property (nonatomic,strong) UILabel *placeholderLabel; 43 | 44 | 45 | /** The placeholder text. */ 46 | @property (nonatomic,copy) NSString *placeholder; 47 | 48 | /** The text color of the placehold text. */ 49 | @property (nonatomic,strong) UIColor *placeholderColor; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /curry/Views/TKWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // TKWindow.h 3 | // Created by Devin Ross on 6/4/09. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | @import UIKit; 34 | 35 | /** Posted when the a motion event begins. */ 36 | extern NSString *TKWindowShakeBegan; 37 | 38 | /** Posted when the a motion event cancels. */ 39 | extern NSString *TKWindowShakeCancelled; 40 | 41 | /** Posted when the a motion event ends. */ 42 | extern NSString *TKWindowShakeEnded; 43 | 44 | /** Posted when the a remote control event is received. */ 45 | extern NSString *TKWindowRemoteControlEvent; 46 | 47 | 48 | 49 | /** A subclass of `UIWindow` that posts notifications of any motion (ie. shake) events for the device. */ 50 | @interface TKWindow : UIWindow 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /curry/Views/TKWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // TKWindow.m 3 | // Created by Devin Ross on 6/4/09. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "TKWindow.h" 33 | 34 | NSString *TKWindowShakeBegan = @"TKWindowShakeBegan"; 35 | NSString *TKWindowShakeCancelled = @"TKWindowShakeCancelled"; 36 | NSString *TKWindowShakeEnded = @"TKWindowShakeEnded"; 37 | NSString *TKWindowRemoteControlEvent = @"TKWindowRemoteControlEvent"; 38 | 39 | 40 | @implementation TKWindow 41 | 42 | - (void) remoteControlReceivedWithEvent:(UIEvent *)event{ 43 | [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowRemoteControlEvent object:event]; 44 | } 45 | 46 | 47 | 48 | #pragma mark Motion Events 49 | - (void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { 50 | [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeBegan object:self]; 51 | } 52 | - (void) motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event { 53 | [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeCancelled object:self]; 54 | } 55 | - (void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { 56 | [[NSNotificationCenter defaultCenter] postNotificationName:TKWindowShakeEnded object:self]; 57 | } 58 | 59 | @end -------------------------------------------------------------------------------- /curry/curry.h: -------------------------------------------------------------------------------- 1 | // 2 | // curry.h 3 | // Created by Devin Ross on 4/10/15. 4 | // Copyright (c) 2015 Devin Ross. All rights reserved. 5 | // 6 | /* 7 | 8 | curry || https://github.com/devinross/curry 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation 12 | files (the "Software"), to deal in the Software without 13 | restriction, including without limitation the rights to use, 14 | copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the 16 | Software is furnished to do so, subject to the following 17 | conditions: 18 | 19 | The above copyright notice and this permission notice shall be 20 | included in all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | 34 | #import 35 | 36 | //! Project version number for curry. 37 | FOUNDATION_EXPORT double curryVersionNumber; 38 | 39 | //! Project version string for curry. 40 | FOUNDATION_EXPORT const unsigned char curryVersionString[]; 41 | 42 | // In this header, you should import all the public headers of your framework using statements like #import 43 | 44 | 45 | #import 46 | -------------------------------------------------------------------------------- /curryMac/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSHumanReadableCopyright 24 | Copyright © 2015 Devin Ross. All rights reserved. 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /curryMac/NSView+TKCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+TKCategory.h 3 | // Created by Devin Ross on 10/21/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Cocoa; 33 | 34 | @interface NSView (TKCategory) 35 | 36 | /** The opposite of hidden. */ 37 | @property (nonatomic,assign) BOOL visible; 38 | 39 | /** Adds a view to the beginning of the receiver’s list of subviews. 40 | @param view The view to be added. This view is retained by the receiver. After being added, this view appears below of any other subviews. 41 | */ 42 | - (void) addSubviewToBack:(NSView*)view; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /curryMac/NSView+TKCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSView+TKCategory.m 3 | // Created by Devin Ross on 10/21/15. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | #import "NSView+TKCategory.h" 33 | 34 | @implementation NSView (TKCategory) 35 | 36 | 37 | - (BOOL) visible{ 38 | return !self.hidden; 39 | } 40 | - (void) setVisible:(BOOL)visible{ 41 | self.hidden = !visible; 42 | } 43 | 44 | - (void) addSubviewToBack:(NSView*)view{ 45 | 46 | if(self.subviews.count < 1) 47 | [self addSubview:view]; 48 | else{ 49 | NSView *lowSubview = self.subviews.firstObject; 50 | [self addSubview:view positioned:NSWindowBelow relativeTo:lowSubview]; 51 | } 52 | 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /curryMac/curryMac.h: -------------------------------------------------------------------------------- 1 | // 2 | // curryMac.h 3 | // Created by Devin Ross on 9/23/15. 4 | // Copyright © 2015 Devin Ross. All rights reserved. 5 | // 6 | /* 7 | 8 | curry || https://github.com/devinross/curry 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation 12 | files (the "Software"), to deal in the Software without 13 | restriction, including without limitation the rights to use, 14 | copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the 16 | Software is furnished to do so, subject to the following 17 | conditions: 18 | 19 | The above copyright notice and this permission notice shall be 20 | included in all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #import 34 | 35 | //! Project version number for curryMac. 36 | FOUNDATION_EXPORT double curryMacVersionNumber; 37 | 38 | //! Project version string for curryMac. 39 | FOUNDATION_EXPORT const unsigned char curryMacVersionString[]; 40 | 41 | // In this header, you should import all the public headers of your framework using statements like #import 42 | 43 | 44 | #import "Headers.h" -------------------------------------------------------------------------------- /curryTV/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | arm64 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /curryTV/curryTV.h: -------------------------------------------------------------------------------- 1 | // 2 | // curryTV.h 3 | // 4 | // Created by Devin Ross on 9/9/15. 5 | // Copyright © 2015 Devin Ross. All rights reserved. 6 | // 7 | /* 8 | 9 | curry || https://github.com/devinross/curry 10 | 11 | Permission is hereby granted, free of charge, to any person 12 | obtaining a copy of this software and associated documentation 13 | files (the "Software"), to deal in the Software without 14 | restriction, including without limitation the rights to use, 15 | copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the 17 | Software is furnished to do so, subject to the following 18 | conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 25 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 27 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 28 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 30 | OTHER DEALINGS IN THE SOFTWARE. 31 | 32 | */ 33 | 34 | #import 35 | 36 | //! Project version number for curryTV. 37 | FOUNDATION_EXPORT double curryTVVersionNumber; 38 | 39 | //! Project version string for curryTV. 40 | FOUNDATION_EXPORT const unsigned char curryTVVersionString[]; 41 | 42 | // In this header, you should import all the public headers of your framework using statements like #import 43 | 44 | 45 | #import "Headers.h" -------------------------------------------------------------------------------- /curryTests/DataTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // DataTests.h 3 | // Created by Devin Ross on 12/29/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import XCTest; 33 | @import Foundation; 34 | 35 | @interface DataTests : XCTestCase 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /curryTests/NSArrayTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArrayTests.h 3 | // Created by Devin on 7/18/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import XCTest; 34 | 35 | @interface NSArrayTests : XCTestCase 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /curryTests/NSArrayTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArrayTests.m 3 | // Created by Devin on 7/18/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | 33 | #import "NSArrayTests.h" 34 | #import "NSArray+TKCategory.h" 35 | 36 | @implementation NSArrayTests 37 | 38 | 39 | - (void) testShouldReturnFirstObject{ 40 | 41 | XCTAssertNil([@[] firstObject]); 42 | NSArray *ar = @[@"BOB"]; 43 | XCTAssertEqualObjects([ar firstObject], @"BOB"); 44 | XCTAssertEqual([ar firstObject], ar[0]); 45 | 46 | } 47 | 48 | - (void) testShouldReturnRandomObjects{ 49 | NSMutableArray *array = [NSMutableArray arrayWithCapacity:5000]; 50 | for(NSInteger i=0;i<5000;i++){ 51 | [array addObject:@(i)]; 52 | } 53 | 54 | 55 | NSNumber *lastNumber = [array randomObject]; 56 | NSInteger equal = 0, different = 0; 57 | for(NSInteger i=0;i<500;i++){ 58 | 59 | NSNumber *number = [array randomObject]; 60 | 61 | if([number isEqualToNumber:lastNumber]){ 62 | equal++; 63 | }else{ 64 | different++; 65 | } 66 | 67 | lastNumber = number; 68 | 69 | } 70 | 71 | XCTAssert(different>equal); 72 | 73 | 74 | } 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /curryTests/NSStringTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // String.h 3 | // Created by Devin on 7/18/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | @import Foundation; 32 | @import XCTest; 33 | 34 | #import "NSString+TKCategory.h" 35 | 36 | @interface NSStringTests : XCTestCase 37 | 38 | - (void) testShouldValidateEmailAddress; 39 | 40 | - (void) testShouldGenerateMD5Sum; 41 | 42 | - (void) testShouldEncodeString; 43 | 44 | - (void) testShouldHaveString; 45 | 46 | - (void) testShouldHaveStripWhitespace; 47 | 48 | - (void) testShouldPassCreditCardValidation; 49 | 50 | - (void) testShouldFormatPhoneString; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /curryTests/Supporting Files/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /curryTests/UIViewTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewTests.h 3 | // Created by Devin on 7/18/12. 4 | // 5 | /* 6 | 7 | curry || https://github.com/devinross/curry 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | 30 | */ 31 | 32 | @import Foundation; 33 | @import UIKit; 34 | @import QuartzCore; 35 | @import XCTest; 36 | #import "UIView+TKCategory.h" 37 | 38 | @interface UIViewTests : XCTestCase 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /curryTests/UIViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewTests.m 3 | // Created by Devin on 7/18/12. 4 | // 5 | // 6 | /* 7 | 8 | curry || https://github.com/devinross/curry 9 | 10 | Permission is hereby granted, free of charge, to any person 11 | obtaining a copy of this software and associated documentation 12 | files (the "Software"), to deal in the Software without 13 | restriction, including without limitation the rights to use, 14 | copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the 16 | Software is furnished to do so, subject to the following 17 | conditions: 18 | 19 | The above copyright notice and this permission notice shall be 20 | included in all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | */ 32 | 33 | #import "UIViewTests.h" 34 | 35 | @implementation UIViewTests 36 | 37 | - (void) testShouldAddSubviewToBack{ 38 | 39 | CGRect zero = CGRectMake(0, 0, 0, 0); 40 | 41 | UIView *superview = [[UIView alloc] initWithFrame:zero]; 42 | UIView *one = [[UIView alloc] initWithFrame:zero]; 43 | UIView *two = [[UIView alloc] initWithFrame:zero]; 44 | UIView *three = [[UIView alloc] initWithFrame:zero]; 45 | 46 | [superview addSubview:one]; 47 | [superview addSubview:two]; 48 | [superview addSubviewToBack:three]; 49 | 50 | XCTAssertTrue(superview.subviews[0] == three); 51 | } 52 | 53 | 54 | - (void) testShouldMakeViewVisible{ 55 | 56 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; 57 | view.visible = NO; 58 | 59 | XCTAssertTrue(view.hidden, @"View is visible"); 60 | 61 | view.visible = YES; 62 | 63 | XCTAssertFalse(view.hidden, @"View is not visible"); 64 | 65 | 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /curryTests/curryTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // curryTests.m 3 | // curryTests 4 | // 5 | // Created by Devin Ross on 4/10/15. 6 | // Copyright (c) 2015 Devin Ross. All rights reserved. 7 | // 8 | 9 | 10 | @import UIKit; 11 | @import XCTest; 12 | 13 | @interface curryTests : XCTestCase 14 | 15 | @end 16 | 17 | @implementation curryTests 18 | 19 | - (void)setUp { 20 | [super setUp]; 21 | // Put setup code here. This method is called before the invocation of each test method in the class. 22 | } 23 | 24 | - (void)tearDown { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample { 30 | // This is an example of a functional test case. 31 | XCTAssert(YES, @"Pass"); 32 | } 33 | 34 | - (void)testPerformanceExample { 35 | // This is an example of a performance test case. 36 | [self measureBlock:^{ 37 | // Put the code you want to measure the time of here. 38 | }]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /curryWatch/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /curryWatch/curryWatch.h: -------------------------------------------------------------------------------- 1 | // 2 | // curryWatch.h 3 | // curryWatch 4 | // 5 | // Created by Devin Ross on 9/21/15. 6 | // Copyright © 2015 Devin Ross. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for curryWatch. 12 | FOUNDATION_EXPORT double curryWatchVersionNumber; 13 | 14 | //! Project version string for curryWatch. 15 | FOUNDATION_EXPORT const unsigned char curryWatchVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | #import "Headers.h" --------------------------------------------------------------------------------