├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── Cartfile.private ├── Cartfile.resolved ├── Example.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Example.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Example ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CustomViewViewController.swift ├── GraphViewViewController.swift ├── ImageViewViewController.swift ├── Info.plist ├── ResultView.swift ├── ResultView.xib ├── ViewController.swift ├── ViewViewController.swift ├── flower.png └── trees.png ├── LICENSE ├── Package.resolved ├── Package.swift ├── Podfile ├── Podfile.lock ├── Pods ├── Eureka │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── Core │ │ ├── BaseRow.swift │ │ ├── Cell.swift │ │ ├── CellType.swift │ │ ├── Core.swift │ │ ├── Form.swift │ │ ├── HeaderFooterView.swift │ │ ├── Helpers.swift │ │ ├── InlineRowType.swift │ │ ├── NavigationAccessoryView.swift │ │ ├── Operators.swift │ │ ├── PresenterRowType.swift │ │ ├── Row.swift │ │ ├── RowControllerType.swift │ │ ├── RowProtocols.swift │ │ ├── RowType.swift │ │ ├── Section.swift │ │ ├── SelectableRowType.swift │ │ ├── SelectableSection.swift │ │ ├── SwipeActions.swift │ │ └── Validation.swift │ │ ├── Rows │ │ ├── ActionSheetRow.swift │ │ ├── AlertRow.swift │ │ ├── ButtonRow.swift │ │ ├── ButtonRowWithPresent.swift │ │ ├── CheckRow.swift │ │ ├── Common │ │ │ ├── AlertOptionsRow.swift │ │ │ ├── DateFieldRow.swift │ │ │ ├── DateInlineFieldRow.swift │ │ │ ├── DecimalFormatter.swift │ │ │ ├── FieldRow.swift │ │ │ ├── GenericMultipleSelectorRow.swift │ │ │ ├── OptionsRow.swift │ │ │ ├── Protocols.swift │ │ │ └── SelectorRow.swift │ │ ├── Controllers │ │ │ ├── MultipleSelectorViewController.swift │ │ │ ├── SelectorAlertController.swift │ │ │ └── SelectorViewController.swift │ │ ├── DateInlineRow.swift │ │ ├── DatePickerRow.swift │ │ ├── DateRow.swift │ │ ├── DoublePickerInputRow.swift │ │ ├── DoublePickerRow.swift │ │ ├── FieldsRow.swift │ │ ├── LabelRow.swift │ │ ├── MultipleSelectorRow.swift │ │ ├── PickerInlineRow.swift │ │ ├── PickerInputRow.swift │ │ ├── PickerRow.swift │ │ ├── PopoverSelectorRow.swift │ │ ├── PushRow.swift │ │ ├── SegmentedRow.swift │ │ ├── SelectableRows │ │ │ └── ListCheckRow.swift │ │ ├── SliderRow.swift │ │ ├── StepperRow.swift │ │ ├── SwitchRow.swift │ │ ├── TextAreaRow.swift │ │ ├── TriplePickerInputRow.swift │ │ └── TriplePickerRow.swift │ │ └── Validations │ │ ├── RuleClosure.swift │ │ ├── RuleEmail.swift │ │ ├── RuleEqualsToRow.swift │ │ ├── RuleLength.swift │ │ ├── RuleRange.swift │ │ ├── RuleRegExp.swift │ │ ├── RuleRequired.swift │ │ └── RuleURL.swift ├── Local Podspecs │ └── SwiftChart.podspec.json ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj ├── SwiftChart │ ├── LICENSE.txt │ ├── README.md │ └── Source │ │ ├── Chart.swift │ │ ├── ChartColors.swift │ │ └── ChartSeries.swift └── Target Support Files │ ├── Eureka │ ├── Eureka-Info.plist │ ├── Eureka-dummy.m │ ├── Eureka-prefix.pch │ ├── Eureka-umbrella.h │ ├── Eureka.modulemap │ ├── Eureka.xcconfig │ └── Info.plist │ ├── Pods-Example │ ├── Info.plist │ ├── Pods-Example-Info.plist │ ├── Pods-Example-acknowledgements.markdown │ ├── Pods-Example-acknowledgements.plist │ ├── Pods-Example-dummy.m │ ├── Pods-Example-frameworks.sh │ ├── Pods-Example-resources.sh │ ├── Pods-Example-umbrella.h │ ├── Pods-Example.debug.xcconfig │ ├── Pods-Example.modulemap │ └── Pods-Example.release.xcconfig │ └── SwiftChart │ ├── Info.plist │ ├── SwiftChart-Info.plist │ ├── SwiftChart-dummy.m │ ├── SwiftChart-prefix.pch │ ├── SwiftChart-umbrella.h │ ├── SwiftChart.modulemap │ └── SwiftChart.xcconfig ├── README.md ├── Screenshots └── ViewRow.gif ├── ViewRow.podspec └── ViewRow ├── Info.plist ├── ViewRow.h └── ViewRow.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | Carthage/Checkouts 54 | Carthage/Build 55 | 56 | # fastlane 57 | # 58 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 59 | # screenshots whenever they are needed. 60 | # For more information about the recommended setup visit: 61 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 62 | 63 | fastlane/report.xml 64 | fastlane/Preview.html 65 | fastlane/screenshots 66 | fastlane/test_output 67 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Cartfile.private: -------------------------------------------------------------------------------- 1 | github "xmartlabs/Eureka" ~> 4.1.1 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "xmartlabs/Eureka" "4.1.1" 2 | -------------------------------------------------------------------------------- /Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CustomViewRow 4 | // 5 | // Created by Mark Alldritt on 2017-09-18. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /Example/CustomViewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomViewViewController.swift 3 | // CustomViewRow 4 | // 5 | // Created by Mark Alldritt on 2017-09-18. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Eureka 11 | import SwiftChart 12 | 13 | 14 | class CustomViewViewController: FormViewController { 15 | 16 | let initialHeight = Float(200.0) 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | form 22 | 23 | +++ Section("Settings") 24 | 25 | <<< SliderRow("height") { (row) in 26 | row.title = "Height" 27 | row.cell.slider.minimumValue = 150.0 28 | row.cell.slider.maximumValue = 500.0 29 | row.value = self.initialHeight 30 | } 31 | .onChange { (row) in 32 | if let newHeight = row.value { 33 | //(self.form.rowBy(tag: "view") as? ViewRow)?.cell.height = { return CGFloat(newHeight) } 34 | self.tableView.reloadRows(at: [row.indexPath!], with: .none) // forces the tableview to resize the rows 35 | 36 | // Alter the contents of the view in some way... 37 | if let resultRow = self.form.rowBy(tag: "view") as? ViewRow, 38 | let resultView = resultRow.view { 39 | resultView.n200Label.text = "-\(Int(newHeight))-" 40 | resultView.p300Label.text = "*\(Int(newHeight))*" 41 | } 42 | } 43 | } 44 | 45 | 46 | 47 | +++ Section("Custom View from Nib") 48 | 49 | <<< LabelRow() { (row) in 50 | row.title = "A Row" 51 | row.value = "Hello World" 52 | } 53 | 54 | <<< ViewRow("view") { (row) in 55 | } 56 | .cellSetup { (cell, row) in 57 | // Construct the view - in this instance the view is loaded from a nib 58 | let bundle = Bundle.main 59 | let nib = UINib(nibName: "ResultView", bundle: bundle) 60 | 61 | cell.view = nib.instantiate(withOwner: self, options: nil)[0] as? ResultView 62 | 63 | // Define the cell's height - in this example I use the value of the height slider. 64 | cell.height = { return CGFloat((self.form.rowBy(tag: "height") as? SliderRow)?.value ?? self.initialHeight) /*return CGFloat(self.initialHeight)*/ } 65 | } 66 | 67 | <<< LabelRow() { (row) in 68 | row.title = "Another Row" 69 | row.value = "Hello Again" 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Example/ImageViewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageViewViewController.swift 3 | // CustomViewRow 4 | // 5 | // Created by Mark Alldritt on 2017-09-18. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Eureka 11 | import SwiftChart 12 | 13 | 14 | class ImageViewViewController: FormViewController { 15 | 16 | let initialHeight = Float(200.0) 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | form 22 | 23 | +++ Section("Image View with title") 24 | 25 | <<< LabelRow() { (row) in 26 | row.title = "A Row" 27 | row.value = "Hello World" 28 | } 29 | 30 | <<< ViewRow() { (row) in 31 | row.title = "Title For Image View Row" 32 | } 33 | .cellSetup { (cell, row) in 34 | // Construct the view for the cell 35 | cell.view = UIImageView(frame:CGRect(x: 0, y: 0, width: 100, height: 300)) 36 | cell.view!.contentMode = .scaleAspectFill 37 | cell.view!.clipsToBounds = true 38 | 39 | // Get something to display 40 | let image = UIImage(named: "trees") 41 | cell.view!.image = image 42 | } 43 | 44 | <<< LabelRow() { (row) in 45 | row.title = "Another Row" 46 | row.value = "Hello Again" 47 | } 48 | 49 | 50 | 51 | +++ Section("Image View without title or margins") 52 | 53 | <<< LabelRow() { (row) in 54 | row.title = "A Row" 55 | row.value = "Hello World" 56 | } 57 | 58 | <<< ViewRow() 59 | .cellSetup { (cell, row) in 60 | // Construct the view for the cell 61 | cell.view = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 300)) 62 | cell.view!.contentMode = .scaleAspectFill 63 | cell.view!.clipsToBounds = true 64 | 65 | // Get something to display 66 | let image = UIImage(named: "trees") 67 | cell.view!.image = image 68 | 69 | // Make the image view occupy the entire row: 70 | cell.viewRightMargin = 0.0 71 | cell.viewLeftMargin = 0.0 72 | cell.viewTopMargin = 0.0 73 | cell.viewBottomMargin = 0.0 74 | } 75 | 76 | <<< LabelRow() { (row) in 77 | row.title = "Another Row" 78 | row.value = "Hello Again" 79 | } 80 | 81 | +++ Section("Image View with changable image") 82 | 83 | <<< SegmentedRow { (row) in 84 | row.title = "Image" 85 | row.options = ["trees", "flower"] 86 | row.value = "trees" 87 | } 88 | .cellSetup { (cell, row) in 89 | cell.segmentedControl.setContentHuggingPriority(UILayoutPriority(rawValue: 750), for: .horizontal) 90 | cell.segmentedControl.apportionsSegmentWidthsByContent = true 91 | } 92 | .onChange { [unowned self] (row) in 93 | guard let imageName = row.value else { return } 94 | guard let imageRow = self.form.rowBy(tag: "xxxx") as? ViewRow else { return } 95 | 96 | let image = UIImage(named: imageName) 97 | imageRow.cell.view!.image = image 98 | } 99 | 100 | <<< ViewRow("xxxx") 101 | .cellSetup { (cell, row) in 102 | // Construct the view for the cell 103 | cell.view = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 300)) 104 | cell.view!.contentMode = .scaleAspectFill 105 | cell.view!.clipsToBounds = true 106 | 107 | // Get something to display 108 | let image = UIImage(named: "trees") 109 | cell.view!.image = image 110 | 111 | // Make the image view occupy the entire row: 112 | cell.viewRightMargin = 0.0 113 | cell.viewLeftMargin = 0.0 114 | cell.viewTopMargin = 0.0 115 | cell.viewBottomMargin = 0.0 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/ResultView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ResultView.swift 3 | // Analizer 4 | // 5 | // Created by Mark Alldritt on 2017-09-13. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ResultView: UIView { 12 | 13 | @IBOutlet weak var n200Label: UILabel! 14 | @IBOutlet weak var p300Label: UILabel! 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CustomViewRow 4 | // 5 | // Created by Mark Alldritt on 2017-09-18. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Eureka 11 | import SwiftChart 12 | 13 | 14 | class ViewController: FormViewController { 15 | 16 | let initialHeight = Float(200.0) 17 | 18 | override func viewDidLoad() { 19 | // Present the form in a insetGrouped styled table 20 | if #available(iOS 13.0, *) { 21 | tableView = UITableView(frame: view.bounds, style: .insetGrouped) 22 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 23 | tableView.cellLayoutMarginsFollowReadableWidth = true 24 | } 25 | 26 | super.viewDidLoad() 27 | 28 | form 29 | 30 | +++ Section("Examples") 31 | 32 | <<< ButtonRow() { (row) in 33 | row.title = "UIView Rows" 34 | row.presentationMode = PresentationMode.segueName(segueName: "UIView", 35 | onDismiss: nil) 36 | } 37 | <<< ButtonRow() { (row) in 38 | row.title = "Custom View Rows" 39 | row.presentationMode = PresentationMode.segueName(segueName: "CustomView", 40 | onDismiss: nil) 41 | } 42 | <<< ButtonRow() { (row) in 43 | row.title = "UIImageView Rows" 44 | row.presentationMode = PresentationMode.segueName(segueName: "UIImageView", 45 | onDismiss: nil) 46 | } 47 | <<< ButtonRow() { (row) in 48 | row.title = "GraphView Row" 49 | row.presentationMode = PresentationMode.segueName(segueName: "GraphView", 50 | onDismiss: nil) 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Example/ViewViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewViewController.swift 3 | // CustomViewRow 4 | // 5 | // Created by Mark Alldritt on 2017-09-18. 6 | // Copyright © 2017 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Eureka 11 | import SwiftChart 12 | 13 | 14 | class ViewViewController: FormViewController { 15 | 16 | let initialHeight = Float(200.0) 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | form 22 | 23 | +++ Section("Custom View") 24 | 25 | <<< LabelRow() { (row) in 26 | row.title = "A Row" 27 | row.value = "Hello World" 28 | } 29 | 30 | <<< ViewRow() 31 | .cellSetup { (cell, row) in 32 | // Construct the view - in this instance the a rudimentry view created here 33 | cell.view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 200)) 34 | cell.view!.backgroundColor = UIColor.orange 35 | } 36 | 37 | <<< LabelRow() { (row) in 38 | row.title = "Another Row" 39 | row.value = "Hello Again" 40 | } 41 | 42 | +++ Section("Custom View with title") 43 | 44 | <<< LabelRow() { (row) in 45 | row.title = "A Row" 46 | row.value = "Hello World" 47 | } 48 | 49 | <<< ViewRow() { (row) in 50 | row.title = "Title For Custom View Row" 51 | } 52 | .cellSetup { (cell, row) in 53 | // Construct the view - in this instance the a rudimentry view created here 54 | cell.view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 200)) 55 | cell.view!.backgroundColor = UIColor.green 56 | } 57 | 58 | <<< LabelRow() { (row) in 59 | row.title = "Another Row" 60 | row.value = "Hello Again" 61 | } 62 | 63 | 64 | 65 | +++ Section("Custom View without title or margins") 66 | 67 | <<< LabelRow() { (row) in 68 | row.title = "A Row" 69 | row.value = "Hello World" 70 | } 71 | 72 | <<< ViewRow() 73 | .cellSetup { (cell, row) in 74 | // Construct the view - in this instance the a rudimentry view created here 75 | cell.view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 200)) 76 | cell.view!.backgroundColor = UIColor.blue 77 | 78 | // Adjust the cell margins to suit 79 | cell.viewTopMargin = 0.0 80 | cell.viewBottomMargin = 0.0 81 | cell.viewLeftMargin = 0.0 82 | cell.viewRightMargin = 0.0 83 | } 84 | 85 | <<< LabelRow() { (row) in 86 | row.title = "Another Row" 87 | row.value = "Hello Again" 88 | } 89 | } 90 | } 91 | 92 | -------------------------------------------------------------------------------- /Example/flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EurekaCommunity/ViewRow/3428a3b825a5641ae7fb65f3f787aba2b1b4dab9/Example/flower.png -------------------------------------------------------------------------------- /Example/trees.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EurekaCommunity/ViewRow/3428a3b825a5641ae7fb65f3f787aba2b1b4dab9/Example/trees.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Mark Alldritt and Late Night Software Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "Eureka", 6 | "repositoryURL": "https://github.com/xmartlabs/Eureka.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "81f3ea3d69dc99f8684b8bce1224908e101c679f", 10 | "version": "5.3.2" 11 | } 12 | } 13 | ] 14 | }, 15 | "version": 1 16 | } 17 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "ViewRow", 8 | products: [ 9 | .library( 10 | name: "ViewRow", 11 | targets: ["ViewRow"]), 12 | ], 13 | dependencies: [ 14 | .package(url: "https://github.com/xmartlabs/Eureka.git", from: "5.3.2"), 15 | ], 16 | targets: [ 17 | .target( 18 | name: "ViewRow", 19 | dependencies: ["Eureka"], 20 | path: "ViewRow", 21 | exclude: ["Info.plist", "ViewRow.h"]), 22 | ] 23 | ) 24 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '10.0' 2 | source 'https://github.com/CocoaPods/Specs.git' 3 | 4 | target 'Example' do 5 | use_frameworks! 6 | 7 | pod 'Eureka', '>= 5.0' 8 | pod 'SwiftChart', :git => 'git@github.com:alldritt/SwiftChart' 9 | end 10 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Eureka (5.2.1) 3 | - SwiftChart (1.0.1) 4 | 5 | DEPENDENCIES: 6 | - Eureka (>= 5.0) 7 | - "SwiftChart (from `git@github.com:alldritt/SwiftChart`)" 8 | 9 | SPEC REPOS: 10 | https://github.com/CocoaPods/Specs.git: 11 | - Eureka 12 | 13 | EXTERNAL SOURCES: 14 | SwiftChart: 15 | :git: "git@github.com:alldritt/SwiftChart" 16 | 17 | CHECKOUT OPTIONS: 18 | SwiftChart: 19 | :commit: f2f9797b1edf7c538d06c08c79faf36175d71227 20 | :git: "git@github.com:alldritt/SwiftChart" 21 | 22 | SPEC CHECKSUMS: 23 | Eureka: c883105488e05bc65539f583246ecf9657cabbfe 24 | SwiftChart: dfa58fed4299f6cf242ad4a2e02609496bf66036 25 | 26 | PODFILE CHECKSUM: c2bb1aa99a913f9c6cfa21403be0686948a9cec7 27 | 28 | COCOAPODS: 1.8.4 29 | -------------------------------------------------------------------------------- /Pods/Eureka/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 XMARTLABS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/CellType.swift: -------------------------------------------------------------------------------- 1 | // CellType.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: Cell Protocols 29 | 30 | public protocol BaseCellType : class { 31 | 32 | /// Method that will return the height of the cell 33 | var height : (() -> CGFloat)? { get } 34 | 35 | /** 36 | Method called once when creating a cell. Responsible for setting up the cell. 37 | */ 38 | func setup() 39 | 40 | /** 41 | Method called each time the cell is updated (e.g. 'cellForRowAtIndexPath' is called). Responsible for updating the cell. 42 | */ 43 | func update() 44 | 45 | /** 46 | Method called each time the cell is selected (tapped on by the user). 47 | */ 48 | func didSelect() 49 | 50 | /** 51 | Called when cell is about to become first responder 52 | 53 | - returns: If the cell should become first responder. 54 | */ 55 | func cellCanBecomeFirstResponder() -> Bool 56 | 57 | /** 58 | Method called when the cell becomes first responder 59 | */ 60 | func cellBecomeFirstResponder(withDirection: Direction) -> Bool 61 | 62 | /** 63 | Method called when the cell resigns first responder 64 | */ 65 | func cellResignFirstResponder() -> Bool 66 | 67 | /** 68 | A reference to the controller in which the cell is displayed. 69 | */ 70 | func formViewController () -> FormViewController? 71 | } 72 | 73 | public protocol TypedCellType: BaseCellType { 74 | 75 | associatedtype Value: Equatable 76 | 77 | /// The row associated to this cell. 78 | var row: RowOf! { get set } 79 | } 80 | 81 | public protocol CellType: TypedCellType {} 82 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/HeaderFooterView.swift: -------------------------------------------------------------------------------- 1 | // HeaderFooterView.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /** 29 | Enumeration used to generate views for the header and footer of a section. 30 | 31 | - Class: Will generate a view of the specified class. 32 | - Callback->ViewType: Will generate the view as a result of the given closure. 33 | - NibFile: Will load the view from a nib file. 34 | */ 35 | public enum HeaderFooterProvider { 36 | 37 | /** 38 | * Will generate a view of the specified class. 39 | */ 40 | case `class` 41 | 42 | /** 43 | * Will generate the view as a result of the given closure. 44 | */ 45 | case callback(()->ViewType) 46 | 47 | /** 48 | * Will load the view from a nib file. 49 | */ 50 | case nibFile(name: String, bundle: Bundle?) 51 | 52 | internal func createView() -> ViewType { 53 | switch self { 54 | case .class: 55 | return ViewType() 56 | case .callback(let builder): 57 | return builder() 58 | case .nibFile(let nibName, let bundle): 59 | return (bundle ?? Bundle(for: ViewType.self)).loadNibNamed(nibName, owner: nil, options: nil)![0] as! ViewType 60 | } 61 | } 62 | } 63 | 64 | /** 65 | * Represents headers and footers of sections 66 | */ 67 | public enum HeaderFooterType { 68 | case header, footer 69 | } 70 | 71 | /** 72 | * Struct used to generate headers and footers either from a view or a String. 73 | */ 74 | public struct HeaderFooterView : ExpressibleByStringLiteral, HeaderFooterViewRepresentable { 75 | 76 | /// Holds the title of the view if it was set up with a String. 77 | public var title: String? 78 | 79 | /// Generates the view. 80 | public var viewProvider: HeaderFooterProvider? 81 | 82 | /// Closure called when the view is created. Useful to customize its appearance. 83 | public var onSetupView: ((_ view: ViewType, _ section: Section) -> Void)? 84 | 85 | /// A closure that returns the height for the header or footer view. 86 | public var height: (() -> CGFloat)? 87 | 88 | /** 89 | This method can be called to get the view corresponding to the header or footer of a section in a specific controller. 90 | 91 | - parameter section: The section from which to get the view. 92 | - parameter type: Either header or footer. 93 | - parameter controller: The controller from which to get that view. 94 | 95 | - returns: The header or footer of the specified section. 96 | */ 97 | public func viewForSection(_ section: Section, type: HeaderFooterType) -> UIView? { 98 | var view: ViewType? 99 | if type == .header { 100 | view = section.headerView as? ViewType ?? { 101 | let result = viewProvider?.createView() 102 | section.headerView = result 103 | return result 104 | }() 105 | } else { 106 | view = section.footerView as? ViewType ?? { 107 | let result = viewProvider?.createView() 108 | section.footerView = result 109 | return result 110 | }() 111 | } 112 | guard let v = view else { return nil } 113 | onSetupView?(v, section) 114 | return v 115 | } 116 | 117 | /** 118 | Initiates the view with a String as title 119 | */ 120 | public init?(title: String?) { 121 | guard let t = title else { return nil } 122 | self.init(stringLiteral: t) 123 | } 124 | 125 | /** 126 | Initiates the view with a view provider, ideal for customized headers or footers 127 | */ 128 | public init(_ provider: HeaderFooterProvider) { 129 | viewProvider = provider 130 | } 131 | 132 | /** 133 | Initiates the view with a String as title 134 | */ 135 | public init(unicodeScalarLiteral value: String) { 136 | self.title = value 137 | } 138 | 139 | /** 140 | Initiates the view with a String as title 141 | */ 142 | public init(extendedGraphemeClusterLiteral value: String) { 143 | self.title = value 144 | } 145 | 146 | /** 147 | Initiates the view with a String as title 148 | */ 149 | public init(stringLiteral value: String) { 150 | self.title = value 151 | } 152 | } 153 | 154 | extension UIView { 155 | 156 | func eurekaInvalidate() { 157 | setNeedsUpdateConstraints() 158 | updateConstraintsIfNeeded() 159 | setNeedsLayout() 160 | } 161 | 162 | } 163 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/Helpers.swift: -------------------------------------------------------------------------------- 1 | // Helpers.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | extension UIView { 29 | 30 | public func findFirstResponder() -> UIView? { 31 | if isFirstResponder { return self } 32 | for subView in subviews { 33 | if let firstResponder = subView.findFirstResponder() { 34 | return firstResponder 35 | } 36 | } 37 | return nil 38 | } 39 | 40 | public func formCell() -> BaseCell? { 41 | if self is UITableViewCell { 42 | return self as? BaseCell 43 | } 44 | return superview?.formCell() 45 | } 46 | } 47 | 48 | extension NSPredicate { 49 | 50 | var predicateVars: [String] { 51 | var ret = [String]() 52 | if let compoundPredicate = self as? NSCompoundPredicate { 53 | for subPredicate in compoundPredicate.subpredicates where subPredicate is NSPredicate { 54 | ret.append(contentsOf: (subPredicate as! NSPredicate).predicateVars) 55 | } 56 | } else if let comparisonPredicate = self as? NSComparisonPredicate { 57 | ret.append(contentsOf: comparisonPredicate.leftExpression.expressionVars) 58 | ret.append(contentsOf: comparisonPredicate.rightExpression.expressionVars) 59 | } 60 | return ret 61 | } 62 | } 63 | 64 | extension NSExpression { 65 | 66 | var expressionVars: [String] { 67 | switch expressionType { 68 | case .function, .variable: 69 | let str = "\(self)" 70 | if let range = str.range(of: ".") { 71 | return [String(str[str.index(str.startIndex, offsetBy: 1).. Void) -> Self { 122 | callbackOnExpandInlineRow = callback 123 | return self 124 | } 125 | 126 | /** 127 | Sets a block to be executed when a row is collapsed. 128 | */ 129 | @discardableResult 130 | public func onCollapseInlineRow(_ callback: @escaping (Cell, Self, InlineRow) -> Void) -> Self { 131 | callbackOnCollapseInlineRow = callback 132 | return self 133 | } 134 | 135 | /// Returns the block that will be executed when this row expands 136 | public var onCollapseInlineRowCallback: ((Cell, Self, InlineRow) -> Void)? { 137 | return callbackOnCollapseInlineRow as! ((Cell, Self, InlineRow) -> Void)? 138 | } 139 | 140 | /// Returns the block that will be executed when this row collapses 141 | public var onExpandInlineRowCallback: ((Cell, Self, InlineRow) -> Void)? { 142 | return callbackOnExpandInlineRow as! ((Cell, Self, InlineRow) -> Void)? 143 | } 144 | 145 | public var isExpanded: Bool { return _inlineRow != nil } 146 | public var isCollapsed: Bool { return !isExpanded } 147 | } 148 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/Operators.swift: -------------------------------------------------------------------------------- 1 | // Operators.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | // MARK: Operators 28 | 29 | precedencegroup FormPrecedence { 30 | associativity: left 31 | higherThan: LogicalConjunctionPrecedence 32 | } 33 | 34 | precedencegroup SectionPrecedence { 35 | associativity: left 36 | higherThan: FormPrecedence 37 | } 38 | 39 | infix operator +++ : FormPrecedence 40 | 41 | /** 42 | Appends a section to a form 43 | 44 | - parameter left: the form 45 | - parameter right: the section to be appended 46 | 47 | - returns: the updated form 48 | */ 49 | @discardableResult 50 | public func +++ (left: Form, right: Section) -> Form { 51 | left.append(right) 52 | return left 53 | } 54 | 55 | /** 56 | Appends a row to the last section of a form 57 | 58 | - parameter left: the form 59 | - parameter right: the row 60 | */ 61 | @discardableResult 62 | public func +++ (left: Form, right: BaseRow) -> Form { 63 | let section = Section() 64 | let _ = left +++ section <<< right 65 | return left 66 | } 67 | 68 | /** 69 | Creates a form with two sections 70 | 71 | - parameter left: the first section 72 | - parameter right: the second section 73 | 74 | - returns: the created form 75 | */ 76 | @discardableResult 77 | public func +++ (left: Section, right: Section) -> Form { 78 | let form = Form() 79 | let _ = form +++ left +++ right 80 | return form 81 | } 82 | 83 | /** 84 | Appends the row wrapped in a new section 85 | 86 | - parameter left: a section of the form 87 | - parameter right: a row to be appended 88 | 89 | - returns: the form 90 | */ 91 | @discardableResult 92 | public func +++ (left: Section, right: BaseRow) -> Form { 93 | let section = Section() 94 | section <<< right 95 | return left +++ section 96 | } 97 | 98 | /** 99 | Creates a form with two sections, each containing one row. 100 | 101 | - parameter left: The row for the first section 102 | - parameter right: The row for the second section 103 | 104 | - returns: the created form 105 | */ 106 | @discardableResult 107 | public func +++ (left: BaseRow, right: BaseRow) -> Form { 108 | let form = Section() <<< left +++ Section() <<< right 109 | return form 110 | } 111 | 112 | infix operator <<< : SectionPrecedence 113 | 114 | /** 115 | Appends a row to a section. 116 | 117 | - parameter left: the section 118 | - parameter right: the row to be appended 119 | 120 | - returns: the section 121 | */ 122 | @discardableResult 123 | public func <<< (left: Section, right: BaseRow) -> Section { 124 | left.append(right) 125 | return left 126 | } 127 | 128 | /** 129 | Creates a section with two rows 130 | 131 | - parameter left: The first row 132 | - parameter right: The second row 133 | 134 | - returns: the created section 135 | */ 136 | @discardableResult 137 | public func <<< (left: BaseRow, right: BaseRow) -> Section { 138 | let section = Section() 139 | section <<< left <<< right 140 | return section 141 | } 142 | 143 | /** 144 | Appends a collection of rows to a section 145 | 146 | - parameter lhs: the section 147 | - parameter rhs: the rows to be appended 148 | */ 149 | public func += (lhs: inout Section, rhs: C) where C.Iterator.Element == BaseRow { 150 | lhs.append(contentsOf: rhs) 151 | } 152 | 153 | /** 154 | Appends a collection of section to a form 155 | 156 | - parameter lhs: the form 157 | - parameter rhs: the sections to be appended 158 | */ 159 | public func += (lhs: inout Form, rhs: C) where C.Iterator.Element == Section { 160 | lhs.append(contentsOf: rhs) 161 | } 162 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/PresenterRowType.swift: -------------------------------------------------------------------------------- 1 | // PresenterRowType.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /** 29 | * Protocol that every row that displays a new view controller must conform to. 30 | * This includes presenting or pushing view controllers. 31 | */ 32 | public protocol PresenterRowType: TypedRowType { 33 | 34 | associatedtype PresentedControllerType : UIViewController, TypedRowControllerType 35 | 36 | /// Defines how the view controller will be presented, pushed, etc. 37 | var presentationMode: PresentationMode? { get set } 38 | 39 | /// Will be called before the presentation occurs. 40 | var onPresentCallback: ((FormViewController, PresentedControllerType) -> Void)? { get set } 41 | } 42 | 43 | extension PresenterRowType { 44 | 45 | /** 46 | Sets a block to be executed when the row presents a view controller 47 | 48 | - parameter callback: the block 49 | 50 | - returns: this row 51 | */ 52 | @discardableResult 53 | public func onPresent(_ callback: ((FormViewController, PresentedControllerType) -> Void)?) -> Self { 54 | onPresentCallback = callback 55 | return self 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/RowControllerType.swift: -------------------------------------------------------------------------------- 1 | // RowControllerType.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /** 29 | * Base protocol for view controllers presented by Eureka rows. 30 | */ 31 | public protocol RowControllerType: NSObjectProtocol { 32 | 33 | /// A closure to be called when the controller disappears. 34 | var onDismissCallback: ((UIViewController) -> Void)? { get set } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/RowProtocols.swift: -------------------------------------------------------------------------------- 1 | // RowProtocols.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /** 29 | * Protocol that view controllers pushed or presented by a row should conform to. 30 | */ 31 | public protocol TypedRowControllerType: RowControllerType { 32 | associatedtype RowValue: Equatable 33 | 34 | /// The row that pushed or presented this controller 35 | var row: RowOf! { get set } 36 | } 37 | 38 | // MARK: Header Footer Protocols 39 | 40 | /** 41 | * Protocol used to set headers and footers to sections. 42 | * Can be set with a view or a String 43 | */ 44 | public protocol HeaderFooterViewRepresentable { 45 | 46 | /** 47 | This method can be called to get the view corresponding to the header or footer of a section in a specific controller. 48 | 49 | - parameter section: The section from which to get the view. 50 | - parameter type: Either header or footer. 51 | - parameter controller: The controller from which to get that view. 52 | 53 | - returns: The header or footer of the specified section. 54 | */ 55 | func viewForSection(_ section: Section, type: HeaderFooterType) -> UIView? 56 | 57 | /// If the header or footer of a section was created with a String then it will be stored in the title. 58 | var title: String? { get set } 59 | 60 | /// The height of the header or footer. 61 | var height: (() -> CGFloat)? { get set } 62 | } 63 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/SelectableRowType.swift: -------------------------------------------------------------------------------- 1 | // SelectableRowType.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | /** 28 | * Every row that shall be used in a SelectableSection must conform to this protocol. 29 | */ 30 | public protocol SelectableRowType: RowType { 31 | var selectableValue: Cell.Value? { get set } 32 | } 33 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/SwipeActions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Swipe.swift 3 | // Eureka 4 | // 5 | // Created by Marco Betschart on 14.06.17. 6 | // Copyright © 2017 Xmartlabs. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public typealias SwipeActionHandler = (SwipeAction, BaseRow, ((Bool) -> Void)?) -> Void 13 | 14 | public class SwipeAction: ContextualAction { 15 | let handler: SwipeActionHandler 16 | let style: Style 17 | 18 | public var actionBackgroundColor: UIColor? 19 | public var image: UIImage? 20 | public var title: String? 21 | 22 | @available (*, deprecated, message: "Use actionBackgroundColor instead") 23 | public var backgroundColor: UIColor? { 24 | get { return actionBackgroundColor } 25 | set { self.actionBackgroundColor = newValue } 26 | } 27 | 28 | public init(style: Style, title: String?, handler: @escaping SwipeActionHandler){ 29 | self.style = style 30 | self.title = title 31 | self.handler = handler 32 | } 33 | 34 | func contextualAction(forRow: BaseRow) -> ContextualAction { 35 | var action: ContextualAction 36 | if #available(iOS 11, *){ 37 | action = UIContextualAction(style: style.contextualStyle as! UIContextualAction.Style, title: title){ [weak self] action, view, completion -> Void in 38 | guard let strongSelf = self else{ return } 39 | strongSelf.handler(strongSelf, forRow) { shouldComplete in 40 | if #available(iOS 13, *) { // starting in iOS 13, completion handler is not removing the row automatically, so we need to remove it ourselves 41 | if shouldComplete && action.style == .destructive { 42 | forRow.section?.remove(at: forRow.indexPath!.row) 43 | } 44 | } 45 | completion(shouldComplete) 46 | } 47 | } 48 | } else { 49 | action = UITableViewRowAction(style: style.contextualStyle as! UITableViewRowAction.Style,title: title){ [weak self] (action, indexPath) -> Void in 50 | guard let strongSelf = self else{ return } 51 | strongSelf.handler(strongSelf, forRow) { _ in 52 | DispatchQueue.main.async { 53 | guard action.style == .destructive else { 54 | forRow.baseCell?.formViewController()?.tableView?.setEditing(false, animated: true) 55 | return 56 | } 57 | forRow.section?.remove(at: indexPath.row) 58 | } 59 | } 60 | } 61 | } 62 | if let color = self.actionBackgroundColor { 63 | action.actionBackgroundColor = color 64 | } 65 | if let image = self.image { 66 | action.image = image 67 | } 68 | return action 69 | } 70 | 71 | public enum Style { 72 | case normal 73 | case destructive 74 | 75 | var contextualStyle: ContextualStyle { 76 | if #available(iOS 11, *){ 77 | switch self{ 78 | case .normal: 79 | return UIContextualAction.Style.normal 80 | case .destructive: 81 | return UIContextualAction.Style.destructive 82 | } 83 | } else { 84 | switch self{ 85 | case .normal: 86 | return UITableViewRowAction.Style.normal 87 | case .destructive: 88 | return UITableViewRowAction.Style.destructive 89 | } 90 | } 91 | } 92 | } 93 | } 94 | 95 | public struct SwipeConfiguration { 96 | 97 | unowned var row: BaseRow 98 | 99 | init(_ row: BaseRow){ 100 | self.row = row 101 | } 102 | 103 | public var performsFirstActionWithFullSwipe = false 104 | public var actions: [SwipeAction] = [] 105 | } 106 | 107 | extension SwipeConfiguration { 108 | @available(iOS 11.0, *) 109 | var contextualConfiguration: UISwipeActionsConfiguration? { 110 | let contextualConfiguration = UISwipeActionsConfiguration(actions: self.contextualActions as! [UIContextualAction]) 111 | contextualConfiguration.performsFirstActionWithFullSwipe = self.performsFirstActionWithFullSwipe 112 | return contextualConfiguration 113 | } 114 | 115 | var contextualActions: [ContextualAction]{ 116 | return self.actions.map { $0.contextualAction(forRow: self.row) } 117 | } 118 | } 119 | 120 | protocol ContextualAction { 121 | var actionBackgroundColor: UIColor? { get set } 122 | var image: UIImage? { get set } 123 | var title: String? { get set } 124 | } 125 | 126 | extension UITableViewRowAction: ContextualAction { 127 | public var image: UIImage? { 128 | get { return nil } 129 | set { return } 130 | } 131 | 132 | public var actionBackgroundColor: UIColor? { 133 | get { return backgroundColor } 134 | set { self.backgroundColor = newValue } 135 | } 136 | } 137 | 138 | @available(iOS 11.0, *) 139 | extension UIContextualAction: ContextualAction { 140 | 141 | public var actionBackgroundColor: UIColor? { 142 | get { return backgroundColor } 143 | set { self.backgroundColor = newValue } 144 | } 145 | 146 | } 147 | 148 | public protocol ContextualStyle{} 149 | extension UITableViewRowAction.Style: ContextualStyle {} 150 | 151 | @available(iOS 11.0, *) 152 | extension UIContextualAction.Style: ContextualStyle {} 153 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Core/Validation.swift: -------------------------------------------------------------------------------- 1 | // RowValidationType.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct ValidationError: Equatable { 28 | 29 | public let msg: String 30 | 31 | public init(msg: String) { 32 | self.msg = msg 33 | } 34 | } 35 | 36 | public func == (lhs: ValidationError, rhs: ValidationError) -> Bool { 37 | return lhs.msg == rhs.msg 38 | } 39 | 40 | public protocol BaseRuleType { 41 | var id: String? { get set } 42 | var validationError: ValidationError { get set } 43 | } 44 | 45 | public protocol RuleType: BaseRuleType { 46 | associatedtype RowValueType 47 | 48 | func isValid(value: RowValueType?) -> ValidationError? 49 | } 50 | 51 | public struct ValidationOptions: OptionSet { 52 | 53 | public let rawValue: Int 54 | 55 | public init(rawValue: Int) { 56 | self.rawValue = rawValue 57 | } 58 | 59 | public static let validatesOnDemand = ValidationOptions(rawValue: 1 << 0) 60 | public static let validatesOnChange = ValidationOptions(rawValue: 1 << 1) 61 | public static let validatesOnBlur = ValidationOptions(rawValue: 1 << 2) 62 | public static let validatesOnChangeAfterBlurred = ValidationOptions(rawValue: 1 << 3) 63 | 64 | public static let validatesAlways: ValidationOptions = [.validatesOnChange, .validatesOnBlur] 65 | } 66 | 67 | public struct ValidationRuleHelper where T: Equatable { 68 | let validateFn: ((T?) -> ValidationError?) 69 | let rule: BaseRuleType 70 | } 71 | 72 | public struct RuleSet { 73 | 74 | internal var rules: [ValidationRuleHelper] = [] 75 | 76 | public init() {} 77 | 78 | /// Add a validation Rule to a Row 79 | /// - Parameter rule: RuleType object typed to the same type of the Row.value 80 | public mutating func add(rule: Rule) where T == Rule.RowValueType { 81 | let validFn: ((T?) -> ValidationError?) = { (val: T?) in 82 | return rule.isValid(value: val) 83 | } 84 | rules.append(ValidationRuleHelper(validateFn: validFn, rule: rule)) 85 | } 86 | 87 | public mutating func remove(ruleWithIdentifier identifier: String) { 88 | if let index = rules.firstIndex(where: { (validationRuleHelper) -> Bool in 89 | return validationRuleHelper.rule.id == identifier 90 | }) { 91 | rules.remove(at: index) 92 | } 93 | } 94 | 95 | public mutating func removeAllRules() { 96 | rules.removeAll() 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/ActionSheetRow.swift: -------------------------------------------------------------------------------- 1 | // ActionSheetRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class AlertSelectorCell : Cell, CellType where T: Equatable { 29 | 30 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 31 | super.init(style: style, reuseIdentifier: reuseIdentifier) 32 | } 33 | 34 | required public init?(coder aDecoder: NSCoder) { 35 | super.init(coder: aDecoder) 36 | } 37 | 38 | open override func update() { 39 | super.update() 40 | accessoryType = .none 41 | editingAccessoryType = accessoryType 42 | selectionStyle = row.isDisabled ? .none : .default 43 | } 44 | 45 | open override func didSelect() { 46 | super.didSelect() 47 | row.deselect() 48 | } 49 | } 50 | 51 | open class _ActionSheetRow: AlertOptionsRow, PresenterRowType where Cell: BaseCell { 52 | 53 | public typealias ProviderType = SelectorAlertController<_ActionSheetRow> 54 | 55 | public var onPresentCallback: ((FormViewController, ProviderType) -> Void)? 56 | lazy public var presentationMode: PresentationMode? = { 57 | return .presentModally(controllerProvider: ControllerProvider.callback { [weak self] in 58 | let vc = SelectorAlertController<_ActionSheetRow>(title: self?.selectorTitle, message: nil, preferredStyle: .actionSheet) 59 | if let popView = vc.popoverPresentationController { 60 | guard let cell = self?.cell, let tableView = cell.formViewController()?.tableView else { fatalError() } 61 | popView.sourceView = tableView 62 | popView.sourceRect = tableView.convert(cell.detailTextLabel?.frame ?? cell.textLabel?.frame ?? cell.contentView.frame, from: cell) 63 | } 64 | vc.row = self 65 | return vc 66 | }, 67 | onDismiss: { [weak self] in 68 | $0.dismiss(animated: true) 69 | self?.cell?.formViewController()?.tableView?.reloadData() 70 | }) 71 | }() 72 | 73 | public required init(tag: String?) { 74 | super.init(tag: tag) 75 | } 76 | 77 | open override func customDidSelect() { 78 | super.customDidSelect() 79 | if let presentationMode = presentationMode, !isDisabled { 80 | if let controller = presentationMode.makeController() { 81 | controller.row = self 82 | onPresentCallback?(cell.formViewController()!, controller) 83 | presentationMode.present(controller, row: self, presentingController: cell.formViewController()!) 84 | } else { 85 | presentationMode.present(nil, row: self, presentingController: cell.formViewController()!) 86 | } 87 | } 88 | } 89 | } 90 | 91 | /// An options row where the user can select an option from an ActionSheet 92 | public final class ActionSheetRow: _ActionSheetRow>, RowType where T: Equatable { 93 | required public init(tag: String?) { 94 | super.init(tag: tag) 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/AlertRow.swift: -------------------------------------------------------------------------------- 1 | // AlertRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | import Foundation 25 | import UIKit 26 | 27 | open class _AlertRow: AlertOptionsRow, PresenterRowType where Cell: BaseCell { 28 | 29 | public typealias PresentedController = SelectorAlertController<_AlertRow> 30 | 31 | open var onPresentCallback: ((FormViewController, PresentedController) -> Void)? 32 | lazy open var presentationMode: PresentationMode? = { 33 | return .presentModally(controllerProvider: ControllerProvider.callback { [weak self] in 34 | let vc = PresentedController(title: self?.selectorTitle, message: nil, preferredStyle: .alert) 35 | vc.row = self 36 | return vc 37 | }, onDismiss: { [weak self] in 38 | $0.dismiss(animated: true) 39 | self?.cell?.formViewController()?.tableView?.reloadData() 40 | }) 41 | }() 42 | 43 | public required init(tag: String?) { 44 | super.init(tag: tag) 45 | } 46 | 47 | open override func customDidSelect() { 48 | super.customDidSelect() 49 | if let presentationMode = presentationMode, !isDisabled { 50 | if let controller = presentationMode.makeController() { 51 | controller.row = self 52 | onPresentCallback?(cell.formViewController()!, controller) 53 | presentationMode.present(controller, row: self, presentingController: cell.formViewController()!) 54 | } else { 55 | presentationMode.present(nil, row: self, presentingController: cell.formViewController()!) 56 | } 57 | } 58 | } 59 | } 60 | 61 | /// An options row where the user can select an option from a modal Alert 62 | public final class AlertRow: _AlertRow>, RowType { 63 | required public init(tag: String?) { 64 | super.init(tag: tag) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/ButtonRow.swift: -------------------------------------------------------------------------------- 1 | // ButtonRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: ButtonCell 29 | 30 | open class ButtonCellOf: Cell, CellType { 31 | 32 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 33 | super.init(style: style, reuseIdentifier: reuseIdentifier) 34 | } 35 | 36 | required public init?(coder aDecoder: NSCoder) { 37 | super.init(coder: aDecoder) 38 | } 39 | 40 | open override func update() { 41 | super.update() 42 | selectionStyle = row.isDisabled ? .none : .default 43 | accessoryType = .none 44 | editingAccessoryType = accessoryType 45 | textLabel?.textAlignment = .center 46 | textLabel?.textColor = tintColor.withAlphaComponent(row.isDisabled ? 0.3 : 1.0) 47 | } 48 | 49 | open override func didSelect() { 50 | super.didSelect() 51 | row.deselect() 52 | } 53 | } 54 | 55 | public typealias ButtonCell = ButtonCellOf 56 | 57 | // MARK: ButtonRow 58 | 59 | open class _ButtonRowOf : Row> { 60 | open var presentationMode: PresentationMode? 61 | 62 | required public init(tag: String?) { 63 | super.init(tag: tag) 64 | displayValueFor = nil 65 | cellStyle = .default 66 | } 67 | 68 | open override func customDidSelect() { 69 | super.customDidSelect() 70 | if !isDisabled { 71 | if let presentationMode = presentationMode { 72 | if let controller = presentationMode.makeController() { 73 | presentationMode.present(controller, row: self, presentingController: self.cell.formViewController()!) 74 | } else { 75 | presentationMode.present(nil, row: self, presentingController: self.cell.formViewController()!) 76 | } 77 | } 78 | } 79 | } 80 | 81 | open override func customUpdateCell() { 82 | super.customUpdateCell() 83 | let leftAligmnment = presentationMode != nil 84 | cell.textLabel?.textAlignment = leftAligmnment ? .left : .center 85 | cell.accessoryType = !leftAligmnment || isDisabled ? .none : .disclosureIndicator 86 | cell.editingAccessoryType = cell.accessoryType 87 | cell.textLabel?.textColor = !leftAligmnment ? cell.tintColor.withAlphaComponent(isDisabled ? 0.3 : 1.0) : nil 88 | } 89 | 90 | open override func prepare(for segue: UIStoryboardSegue) { 91 | super.prepare(for: segue) 92 | (segue.destination as? RowControllerType)?.onDismissCallback = presentationMode?.onDismissCallback 93 | } 94 | } 95 | 96 | /// A generic row with a button. The action of this button can be anything but normally will push a new view controller 97 | public final class ButtonRowOf : _ButtonRowOf, RowType { 98 | public required init(tag: String?) { 99 | super.init(tag: tag) 100 | } 101 | } 102 | 103 | /// A row with a button and String value. The action of this button can be anything but normally will push a new view controller 104 | public typealias ButtonRow = ButtonRowOf 105 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/ButtonRowWithPresent.swift: -------------------------------------------------------------------------------- 1 | // Rows.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class _ButtonRowWithPresent: Row>, PresenterRowType where VCType: UIViewController { 29 | 30 | open var presentationMode: PresentationMode? 31 | open var onPresentCallback: ((FormViewController, VCType) -> Void)? 32 | 33 | required public init(tag: String?) { 34 | super.init(tag: tag) 35 | displayValueFor = nil 36 | cellStyle = .default 37 | } 38 | 39 | open override func customUpdateCell() { 40 | super.customUpdateCell() 41 | let leftAligmnment = presentationMode != nil 42 | cell.textLabel?.textAlignment = leftAligmnment ? .left : .center 43 | cell.accessoryType = !leftAligmnment || isDisabled ? .none : .disclosureIndicator 44 | cell.editingAccessoryType = cell.accessoryType 45 | if !leftAligmnment { 46 | var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0 47 | cell.tintColor.getRed(&red, green: &green, blue: &blue, alpha: &alpha) 48 | cell.textLabel?.textColor = UIColor(red: red, green: green, blue: blue, alpha:isDisabled ? 0.3 : 1.0) 49 | } else { 50 | cell.textLabel?.textColor = nil 51 | } 52 | } 53 | 54 | open override func customDidSelect() { 55 | super.customDidSelect() 56 | if let presentationMode = presentationMode, !isDisabled { 57 | if let controller = presentationMode.makeController() { 58 | controller.row = self 59 | onPresentCallback?(cell.formViewController()!, controller) 60 | presentationMode.present(controller, row: self, presentingController: cell.formViewController()!) 61 | } else { 62 | presentationMode.present(nil, row: self, presentingController: cell.formViewController()!) 63 | } 64 | } 65 | } 66 | 67 | open override func prepare(for segue: UIStoryboardSegue) { 68 | super.prepare(for: segue) 69 | guard let rowVC = segue.destination as? VCType else { 70 | return 71 | } 72 | if let callback = presentationMode?.onDismissCallback { 73 | rowVC.onDismissCallback = callback 74 | } 75 | rowVC.row = self 76 | onPresentCallback?(cell.formViewController()!, rowVC) 77 | } 78 | 79 | } 80 | 81 | // MARK: Rows 82 | 83 | /// A generic row with a button that presents a view controller when tapped 84 | public final class ButtonRowWithPresent : _ButtonRowWithPresent, RowType where VCType: UIViewController { 85 | public required init(tag: String?) { 86 | super.init(tag: tag) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/CheckRow.swift: -------------------------------------------------------------------------------- 1 | // CheckRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: CheckCell 29 | 30 | open class CheckCell: Cell, CellType { 31 | 32 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 33 | super.init(style: style, reuseIdentifier: reuseIdentifier) 34 | } 35 | 36 | required public init?(coder aDecoder: NSCoder) { 37 | super.init(coder: aDecoder) 38 | } 39 | 40 | open override func update() { 41 | super.update() 42 | accessoryType = row.value == true ? .checkmark : .none 43 | editingAccessoryType = accessoryType 44 | selectionStyle = .default 45 | if row.isDisabled { 46 | tintAdjustmentMode = .dimmed 47 | selectionStyle = .none 48 | } else { 49 | tintAdjustmentMode = .automatic 50 | } 51 | } 52 | 53 | open override func setup() { 54 | super.setup() 55 | accessoryType = .checkmark 56 | editingAccessoryType = accessoryType 57 | } 58 | 59 | open override func didSelect() { 60 | row.value = row.value ?? false ? false : true 61 | row.deselect() 62 | row.updateCell() 63 | } 64 | 65 | } 66 | 67 | // MARK: CheckRow 68 | 69 | open class _CheckRow: Row { 70 | 71 | required public init(tag: String?) { 72 | super.init(tag: tag) 73 | displayValueFor = nil 74 | } 75 | } 76 | 77 | ///// Boolean row that has a checkmark as accessoryType 78 | public final class CheckRow: _CheckRow, RowType { 79 | 80 | required public init(tag: String?) { 81 | super.init(tag: tag) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/AlertOptionsRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertOptionsRow.swift 3 | // Eureka ( https://github.com/xmartlabs/Eureka ) 4 | // 5 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | import Foundation 27 | 28 | 29 | import Foundation 30 | 31 | open class AlertOptionsRow : OptionsRow, AlertOptionsProviderRow where Cell: BaseCell { 32 | 33 | typealias OptionsProviderType = OptionsProvider 34 | 35 | open var cancelTitle: String? 36 | 37 | required public init(tag: String?) { 38 | super.init(tag: tag) 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/DateFieldRow.swift: -------------------------------------------------------------------------------- 1 | // DateFieldRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | public protocol DatePickerRowProtocol: class { 29 | var minimumDate: Date? { get set } 30 | var maximumDate: Date? { get set } 31 | var minuteInterval: Int? { get set } 32 | } 33 | 34 | open class DateCell: Cell, CellType { 35 | 36 | public var datePicker: UIDatePicker 37 | 38 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 39 | datePicker = UIDatePicker() 40 | super.init(style: style, reuseIdentifier: reuseIdentifier) 41 | } 42 | 43 | required public init?(coder aDecoder: NSCoder) { 44 | datePicker = UIDatePicker() 45 | super.init(coder: aDecoder) 46 | } 47 | 48 | open override func setup() { 49 | super.setup() 50 | accessoryType = .none 51 | editingAccessoryType = .none 52 | datePicker.datePickerMode = datePickerMode() 53 | datePicker.addTarget(self, action: #selector(DateCell.datePickerValueChanged(_:)), for: .valueChanged) 54 | } 55 | 56 | deinit { 57 | datePicker.removeTarget(self, action: nil, for: .allEvents) 58 | } 59 | 60 | open override func update() { 61 | super.update() 62 | selectionStyle = row.isDisabled ? .none : .default 63 | datePicker.setDate(row.value ?? Date(), animated: row is CountDownPickerRow) 64 | datePicker.minimumDate = (row as? DatePickerRowProtocol)?.minimumDate 65 | datePicker.maximumDate = (row as? DatePickerRowProtocol)?.maximumDate 66 | if let minuteIntervalValue = (row as? DatePickerRowProtocol)?.minuteInterval { 67 | datePicker.minuteInterval = minuteIntervalValue 68 | } 69 | if row.isHighlighted { 70 | textLabel?.textColor = tintColor 71 | } 72 | } 73 | 74 | open override func didSelect() { 75 | super.didSelect() 76 | row.deselect() 77 | } 78 | 79 | override open var inputView: UIView? { 80 | if let v = row.value { 81 | datePicker.setDate(v, animated:row is CountDownRow) 82 | } 83 | return datePicker 84 | } 85 | 86 | @objc func datePickerValueChanged(_ sender: UIDatePicker) { 87 | row.value = sender.date 88 | detailTextLabel?.text = row.displayValueFor?(row.value) 89 | } 90 | 91 | private func datePickerMode() -> UIDatePicker.Mode { 92 | switch row { 93 | case is DateRow: 94 | return .date 95 | case is TimeRow: 96 | return .time 97 | case is DateTimeRow: 98 | return .dateAndTime 99 | case is CountDownRow: 100 | return .countDownTimer 101 | default: 102 | return .date 103 | } 104 | } 105 | 106 | open override func cellCanBecomeFirstResponder() -> Bool { 107 | return canBecomeFirstResponder 108 | } 109 | 110 | override open var canBecomeFirstResponder: Bool { 111 | return !row.isDisabled 112 | } 113 | } 114 | 115 | open class _DateFieldRow: Row, DatePickerRowProtocol, NoValueDisplayTextConformance { 116 | 117 | /// The minimum value for this row's UIDatePicker 118 | open var minimumDate: Date? 119 | 120 | /// The maximum value for this row's UIDatePicker 121 | open var maximumDate: Date? 122 | 123 | /// The interval between options for this row's UIDatePicker 124 | open var minuteInterval: Int? 125 | 126 | /// The formatter for the date picked by the user 127 | open var dateFormatter: DateFormatter? 128 | 129 | open var noValueDisplayText: String? = nil 130 | 131 | required public init(tag: String?) { 132 | super.init(tag: tag) 133 | displayValueFor = { [unowned self] value in 134 | guard let val = value, let formatter = self.dateFormatter else { return nil } 135 | return formatter.string(from: val) 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/DateInlineFieldRow.swift: -------------------------------------------------------------------------------- 1 | // DateInlineFieldRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class DateInlineCell: Cell, CellType { 29 | 30 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 31 | super.init(style: style, reuseIdentifier: reuseIdentifier) 32 | } 33 | 34 | required public init?(coder aDecoder: NSCoder) { 35 | super.init(coder: aDecoder) 36 | } 37 | 38 | open override func setup() { 39 | super.setup() 40 | accessoryType = .none 41 | editingAccessoryType = .none 42 | } 43 | 44 | open override func update() { 45 | super.update() 46 | selectionStyle = row.isDisabled ? .none : .default 47 | } 48 | 49 | open override func didSelect() { 50 | super.didSelect() 51 | row.deselect() 52 | } 53 | } 54 | 55 | open class _DateInlineFieldRow: Row, DatePickerRowProtocol, NoValueDisplayTextConformance { 56 | 57 | /// The minimum value for this row's UIDatePicker 58 | open var minimumDate: Date? 59 | 60 | /// The maximum value for this row's UIDatePicker 61 | open var maximumDate: Date? 62 | 63 | /// The interval between options for this row's UIDatePicker 64 | open var minuteInterval: Int? 65 | 66 | /// The formatter for the date picked by the user 67 | open var dateFormatter: DateFormatter? 68 | 69 | open var noValueDisplayText: String? 70 | 71 | required public init(tag: String?) { 72 | super.init(tag: tag) 73 | dateFormatter = DateFormatter() 74 | dateFormatter?.locale = Locale.current 75 | displayValueFor = { [unowned self] value in 76 | guard let val = value, let formatter = self.dateFormatter else { return nil } 77 | return formatter.string(from: val) 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/DecimalFormatter.swift: -------------------------------------------------------------------------------- 1 | // DecimalFormatter.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /// A custom formatter for numbers with two digits after the decimal mark 29 | open class DecimalFormatter: NumberFormatter, FormatterProtocol { 30 | 31 | /// Creates the formatter with 2 Fraction Digits, Locale set to .current and .decimal NumberFormatter.Style 32 | public override init() { 33 | super.init() 34 | locale = Locale.current 35 | numberStyle = .decimal 36 | minimumFractionDigits = 2 37 | maximumFractionDigits = 2 38 | } 39 | 40 | required public init?(coder aDecoder: NSCoder) { 41 | fatalError("init(coder:) has not been implemented") 42 | } 43 | 44 | /// Creates an NSNumber from the given String 45 | /// - Parameter obj: Pointer to NSNumber object to assign 46 | /// - Parameter string: String with number assumed to have the configured min. fraction digits. 47 | /// - Parameter rangep: Unused range parameter 48 | override open func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer?, for string: String, range rangep: UnsafeMutablePointer?) throws { 49 | guard obj != nil else { return } 50 | let str = string.components(separatedBy: CharacterSet.decimalDigits.inverted).joined(separator: "") 51 | // Recover the number from the string in a way that forces the formatter's fraction digits 52 | // numberWithoutDecimals / 10 ^ minimumFractionDigits 53 | obj?.pointee = NSNumber(value: (Double(str) ?? 0.0)/Double(pow(10.0, Double(minimumFractionDigits)))) 54 | } 55 | 56 | open func getNewPosition(forPosition position: UITextPosition, inTextInput textInput: UITextInput, oldValue: String?, newValue: String?) -> UITextPosition { 57 | return textInput.position(from: position, offset:((newValue?.count ?? 0) - (oldValue?.count ?? 0))) ?? position 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/GenericMultipleSelectorRow.swift: -------------------------------------------------------------------------------- 1 | // GenericMultipleSelectorRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /// Generic options selector row that allows multiple selection. 29 | open class GenericMultipleSelectorRow: Row, PresenterRowType, NoValueDisplayTextConformance, OptionsProviderRow 30 | where Cell: BaseCell, Cell.Value == Set { 31 | 32 | public typealias PresentedController = MultipleSelectorViewController> 33 | 34 | /// Defines how the view controller will be presented, pushed, etc. 35 | open var presentationMode: PresentationMode? 36 | 37 | /// Will be called before the presentation occurs. 38 | open var onPresentCallback: ((FormViewController, PresentedController) -> Void)? 39 | 40 | /// Title to be displayed for the options 41 | open var selectorTitle: String? 42 | open var noValueDisplayText: String? 43 | 44 | /// Options from which the user will choose 45 | open var optionsProvider: OptionsProvider? 46 | 47 | required public init(tag: String?) { 48 | super.init(tag: tag) 49 | displayValueFor = { (rowValue: Set?) in 50 | return rowValue?.map({ String(describing: $0) }).sorted().joined(separator: ", ") 51 | } 52 | presentationMode = .show(controllerProvider: ControllerProvider.callback { 53 | return MultipleSelectorViewController>() 54 | }, onDismiss: { vc in 55 | let _ = vc.navigationController?.popViewController(animated: true) 56 | }) 57 | } 58 | 59 | /** 60 | Extends `didSelect` method 61 | */ 62 | open override func customDidSelect() { 63 | super.customDidSelect() 64 | guard let presentationMode = presentationMode, !isDisabled else { return } 65 | if let controller = presentationMode.makeController() { 66 | controller.row = self 67 | controller.title = selectorTitle ?? controller.title 68 | onPresentCallback?(cell.formViewController()!, controller) 69 | presentationMode.present(controller, row: self, presentingController: self.cell.formViewController()!) 70 | } else { 71 | presentationMode.present(nil, row: self, presentingController: self.cell.formViewController()!) 72 | } 73 | } 74 | 75 | /** 76 | Prepares the pushed row setting its title and completion callback. 77 | */ 78 | open override func prepare(for segue: UIStoryboardSegue) { 79 | super.prepare(for: segue) 80 | guard let rowVC = segue.destination as Any as? PresentedController else { return } 81 | rowVC.title = selectorTitle ?? rowVC.title 82 | rowVC.onDismissCallback = presentationMode?.onDismissCallback ?? rowVC.onDismissCallback 83 | onPresentCallback?(cell.formViewController()!, rowVC) 84 | rowVC.row = self 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/OptionsRow.swift: -------------------------------------------------------------------------------- 1 | // OptionsRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | open class OptionsRow : Row, NoValueDisplayTextConformance, OptionsProviderRow where Cell: BaseCell { 28 | 29 | open var optionsProvider: OptionsProvider? 30 | 31 | open var selectorTitle: String? 32 | open var noValueDisplayText: String? 33 | 34 | required public init(tag: String?) { 35 | super.init(tag: tag) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/Protocols.swift: -------------------------------------------------------------------------------- 1 | // Protocols.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public protocol FormatterConformance: class { 28 | var formatter: Formatter? { get set } 29 | var useFormatterDuringInput: Bool { get set } 30 | var useFormatterOnDidBeginEditing: Bool? { get set } 31 | } 32 | 33 | public protocol NoValueDisplayTextConformance: class { 34 | var noValueDisplayText: String? { get set } 35 | } 36 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Common/SelectorRow.swift: -------------------------------------------------------------------------------- 1 | // SelectorRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class PushSelectorCell : Cell, CellType { 29 | 30 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 31 | super.init(style: style, reuseIdentifier: reuseIdentifier) 32 | } 33 | 34 | required public init?(coder aDecoder: NSCoder) { 35 | super.init(coder: aDecoder) 36 | } 37 | 38 | open override func update() { 39 | super.update() 40 | accessoryType = .disclosureIndicator 41 | editingAccessoryType = accessoryType 42 | selectionStyle = row.isDisabled ? .none : .default 43 | } 44 | } 45 | 46 | /// Generic row type where a user must select a value among several options. 47 | open class SelectorRow: OptionsRow, PresenterRowType where Cell: BaseCell { 48 | 49 | 50 | /// Defines how the view controller will be presented, pushed, etc. 51 | open var presentationMode: PresentationMode>>? 52 | 53 | /// Will be called before the presentation occurs. 54 | open var onPresentCallback: ((FormViewController, SelectorViewController>) -> Void)? 55 | 56 | required public init(tag: String?) { 57 | super.init(tag: tag) 58 | } 59 | 60 | /** 61 | Extends `didSelect` method 62 | */ 63 | open override func customDidSelect() { 64 | super.customDidSelect() 65 | guard let presentationMode = presentationMode, !isDisabled else { return } 66 | if let controller = presentationMode.makeController() { 67 | controller.row = self 68 | controller.title = selectorTitle ?? controller.title 69 | onPresentCallback?(cell.formViewController()!, controller) 70 | presentationMode.present(controller, row: self, presentingController: self.cell.formViewController()!) 71 | } else { 72 | presentationMode.present(nil, row: self, presentingController: self.cell.formViewController()!) 73 | } 74 | } 75 | 76 | /** 77 | Prepares the pushed row setting its title and completion callback. 78 | */ 79 | open override func prepare(for segue: UIStoryboardSegue) { 80 | super.prepare(for: segue) 81 | guard let rowVC = segue.destination as Any as? SelectorViewController> else { return } 82 | rowVC.title = selectorTitle ?? rowVC.title 83 | rowVC.onDismissCallback = presentationMode?.onDismissCallback ?? rowVC.onDismissCallback 84 | onPresentCallback?(cell.formViewController()!, rowVC) 85 | rowVC.row = self 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/Controllers/SelectorAlertController.swift: -------------------------------------------------------------------------------- 1 | // SelectorAlertController.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | /// Specific type, Responsible for the options passed to a selector alert view controller 29 | public protocol AlertOptionsProviderRow: OptionsProviderRow { 30 | 31 | var cancelTitle: String? { get set } 32 | 33 | } 34 | 35 | /// Selector UIAlertController 36 | open class SelectorAlertController: UIAlertController, TypedRowControllerType where AlertOptionsRow.OptionsProviderType.Option == AlertOptionsRow.Cell.Value, AlertOptionsRow: BaseRow { 37 | 38 | /// The row that pushed or presented this controller 39 | public var row: RowOf! 40 | 41 | @available(*, deprecated, message: "Use AlertOptionsRow.cancelTitle instead.") 42 | public var cancelTitle = NSLocalizedString("Cancel", comment: "") 43 | 44 | /// A closure to be called when the controller disappears. 45 | public var onDismissCallback: ((UIViewController) -> Void)? 46 | 47 | /// Options provider to use to get available options. 48 | /// If not set will use synchronous data provider built with `row.dataProvider.arrayData`. 49 | // public var optionsProvider: OptionsProvider? 50 | public var optionsProviderRow: AlertOptionsRow { 51 | return row as Any as! AlertOptionsRow 52 | } 53 | 54 | override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 55 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 56 | } 57 | 58 | required public init?(coder aDecoder: NSCoder) { 59 | super.init(coder: aDecoder) 60 | } 61 | 62 | convenience public init(_ callback: ((UIViewController) -> Void)?) { 63 | self.init() 64 | onDismissCallback = callback 65 | } 66 | 67 | open override func viewDidLoad() { 68 | super.viewDidLoad() 69 | guard let options = optionsProviderRow.options else { return } 70 | let cancelTitle = optionsProviderRow.cancelTitle ?? NSLocalizedString("Cancel", comment: "") 71 | addAction(UIAlertAction(title: cancelTitle, style: .cancel, handler: nil)) 72 | for option in options { 73 | addAction(UIAlertAction(title: row.displayValueFor?(option), style: .default, handler: { [weak self] _ in 74 | self?.row.value = option 75 | self?.onDismissCallback?(self!) 76 | })) 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/DateRow.swift: -------------------------------------------------------------------------------- 1 | // DateRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | import Foundation 25 | 26 | open class _DateRow: _DateFieldRow { 27 | required public init(tag: String?) { 28 | super.init(tag: tag) 29 | dateFormatter = DateFormatter() 30 | dateFormatter?.timeStyle = .none 31 | dateFormatter?.dateStyle = .medium 32 | dateFormatter?.locale = Locale.current 33 | } 34 | } 35 | 36 | open class _TimeRow: _DateFieldRow { 37 | required public init(tag: String?) { 38 | super.init(tag: tag) 39 | dateFormatter = DateFormatter() 40 | dateFormatter?.timeStyle = .short 41 | dateFormatter?.dateStyle = .none 42 | dateFormatter?.locale = Locale.current 43 | } 44 | } 45 | 46 | open class _DateTimeRow: _DateFieldRow { 47 | required public init(tag: String?) { 48 | super.init(tag: tag) 49 | dateFormatter = DateFormatter() 50 | dateFormatter?.timeStyle = .short 51 | dateFormatter?.dateStyle = .short 52 | dateFormatter?.locale = Locale.current 53 | } 54 | } 55 | 56 | open class _CountDownRow: _DateFieldRow { 57 | required public init(tag: String?) { 58 | super.init(tag: tag) 59 | displayValueFor = { [unowned self] value in 60 | guard let val = value else { 61 | return nil 62 | } 63 | if let formatter = self.dateFormatter { 64 | return formatter.string(from: val) 65 | } 66 | 67 | let dateComponents = Calendar.current.dateComponents([.hour, .minute], from: val) 68 | return DateComponentsFormatter.localizedString(from: dateComponents, unitsStyle: .full)?.replacingOccurrences(of: ",", with: "") 69 | } 70 | } 71 | } 72 | 73 | /// A row with an Date as value where the user can select a date from a picker view. 74 | public final class DateRow: _DateRow, RowType { 75 | required public init(tag: String?) { 76 | super.init(tag: tag) 77 | } 78 | } 79 | 80 | /// A row with an Date as value where the user can select a time from a picker view. 81 | public final class TimeRow: _TimeRow, RowType { 82 | required public init(tag: String?) { 83 | super.init(tag: tag) 84 | } 85 | } 86 | 87 | /// A row with an Date as value where the user can select date and time from a picker view. 88 | public final class DateTimeRow: _DateTimeRow, RowType { 89 | required public init(tag: String?) { 90 | super.init(tag: tag) 91 | } 92 | } 93 | 94 | /// A row with an Date as value where the user can select hour and minute as a countdown timer in a picker view. 95 | public final class CountDownRow: _CountDownRow, RowType { 96 | required public init(tag: String?) { 97 | super.init(tag: tag) 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/DoublePickerInputRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DoublePickerInputRow.swift 3 | // Eureka 4 | // 5 | // Created by Mathias Claassen on 5/10/18. 6 | // Copyright © 2018 Xmartlabs. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | open class DoublePickerInputCell : _PickerInputCell> where A: Equatable, B: Equatable { 13 | 14 | private var pickerRow: _DoublePickerInputRow! { return row as? _DoublePickerInputRow } 15 | 16 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 17 | super.init(style: style, reuseIdentifier: reuseIdentifier) 18 | } 19 | 20 | required public init?(coder aDecoder: NSCoder) { 21 | super.init(coder: aDecoder) 22 | } 23 | 24 | open override func update() { 25 | super.update() 26 | if let selectedValue = pickerRow.value, let indexA = pickerRow.firstOptions().firstIndex(of: selectedValue.a), 27 | let indexB = pickerRow.secondOptions(selectedValue.a).firstIndex(of: selectedValue.b) { 28 | picker.selectRow(indexA, inComponent: 0, animated: true) 29 | picker.selectRow(indexB, inComponent: 1, animated: true) 30 | } 31 | } 32 | 33 | open override func numberOfComponents(in pickerView: UIPickerView) -> Int { 34 | return 2 35 | } 36 | 37 | open override func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 38 | return component == 0 ? pickerRow.firstOptions().count : pickerRow.secondOptions(pickerRow.selectedFirst()).count 39 | } 40 | 41 | open override func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 42 | if component == 0 { 43 | return pickerRow.displayValueForFirstRow(pickerRow.firstOptions()[row]) 44 | } else { 45 | return pickerRow.displayValueForSecondRow(pickerRow.secondOptions(pickerRow.selectedFirst())[row]) 46 | } 47 | } 48 | 49 | open override func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 50 | if component == 0 { 51 | let a = pickerRow.firstOptions()[row] 52 | if let value = pickerRow.value { 53 | guard value.a != a else { 54 | return 55 | } 56 | if pickerRow.secondOptions(a).contains(value.b) { 57 | pickerRow.value = Tuple(a: a, b: value.b) 58 | pickerView.reloadComponent(1) 59 | update() 60 | return 61 | } else { 62 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[0]) 63 | } 64 | } else { 65 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[0]) 66 | } 67 | pickerView.reloadComponent(1) 68 | pickerView.selectRow(0, inComponent: 1, animated: true) 69 | } else { 70 | let a = pickerRow.selectedFirst() 71 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[row]) 72 | } 73 | update() 74 | } 75 | } 76 | 77 | open class _DoublePickerInputRow : Row>, NoValueDisplayTextConformance { 78 | 79 | open var noValueDisplayText: String? = nil 80 | /// Options for first component. Will be called often so should be O(1) 81 | public var firstOptions: (() -> [A]) = {[]} 82 | /// Options for second component given the selected value from the first component. Will be called often so should be O(1) 83 | public var secondOptions: ((A) -> [B]) = {_ in []} 84 | 85 | /// Modify the displayed values for the first picker row. 86 | public var displayValueForFirstRow: ((A) -> (String)) = { a in return String(describing: a) } 87 | /// Modify the displayed values for the second picker row. 88 | public var displayValueForSecondRow: ((B) -> (String)) = { b in return String(describing: b) } 89 | 90 | required public init(tag: String?) { 91 | super.init(tag: tag) 92 | } 93 | 94 | func selectedFirst() -> A { 95 | return value?.a ?? firstOptions()[0] 96 | } 97 | 98 | } 99 | 100 | /// A generic row where the user can pick an option from a picker view displayed in the keyboard area 101 | public final class DoublePickerInputRow: _DoublePickerInputRow, RowType where A: Equatable, B: Equatable { 102 | 103 | required public init(tag: String?) { 104 | super.init(tag: tag) 105 | self.displayValueFor = { [weak self] tuple in 106 | guard let tuple = tuple else { 107 | return self?.noValueDisplayText 108 | } 109 | return String(describing: tuple.a) + ", " + String(describing: tuple.b) 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/DoublePickerRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MultiplePickerRow.swift 3 | // Eureka 4 | // 5 | // Created by Mathias Claassen on 5/8/18. 6 | // Copyright © 2018 Xmartlabs. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | public struct Tuple { 13 | 14 | public let a: A 15 | public let b: B 16 | 17 | public init(a: A, b: B) { 18 | self.a = a 19 | self.b = b 20 | } 21 | 22 | } 23 | 24 | extension Tuple: Equatable {} 25 | 26 | public func == (lhs: Tuple, rhs: Tuple) -> Bool { 27 | return lhs.a == rhs.a && lhs.b == rhs.b 28 | } 29 | 30 | // MARK: MultiplePickerCell 31 | 32 | open class DoublePickerCell : _PickerCell> where A: Equatable, B: Equatable { 33 | 34 | private var pickerRow: _DoublePickerRow? { return row as? _DoublePickerRow } 35 | 36 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 37 | super.init(style: style, reuseIdentifier: reuseIdentifier) 38 | } 39 | 40 | required public init?(coder aDecoder: NSCoder) { 41 | super.init(coder: aDecoder) 42 | } 43 | 44 | open override func update() { 45 | super.update() 46 | if let selectedValue = pickerRow?.value, let indexA = pickerRow?.firstOptions().firstIndex(of: selectedValue.a), 47 | let indexB = pickerRow?.secondOptions(selectedValue.a).firstIndex(of: selectedValue.b) { 48 | picker.selectRow(indexA, inComponent: 0, animated: true) 49 | picker.selectRow(indexB, inComponent: 1, animated: true) 50 | } 51 | } 52 | 53 | open override func numberOfComponents(in pickerView: UIPickerView) -> Int { 54 | return 2 55 | } 56 | 57 | open override func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 58 | guard let pickerRow = pickerRow else { return 0 } 59 | return component == 0 ? pickerRow.firstOptions().count : pickerRow.secondOptions(pickerRow.selectedFirst()).count 60 | } 61 | 62 | open override func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 63 | guard let pickerRow = pickerRow else { return "" } 64 | if component == 0 { 65 | return pickerRow.displayValueForFirstRow(pickerRow.firstOptions()[row]) 66 | } else { 67 | return pickerRow.displayValueForSecondRow(pickerRow.secondOptions(pickerRow.selectedFirst())[row]) 68 | } 69 | } 70 | 71 | open override func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 72 | guard let pickerRow = pickerRow else { return } 73 | if component == 0 { 74 | let a = pickerRow.firstOptions()[row] 75 | if let value = pickerRow.value { 76 | guard value.a != a else { 77 | return 78 | } 79 | if pickerRow.secondOptions(a).contains(value.b) { 80 | pickerRow.value = Tuple(a: a, b: value.b) 81 | pickerView.reloadComponent(1) 82 | return 83 | } else { 84 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[0]) 85 | } 86 | } else { 87 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[0]) 88 | } 89 | pickerView.reloadComponent(1) 90 | pickerView.selectRow(0, inComponent: 1, animated: true) 91 | } else { 92 | let a = pickerRow.selectedFirst() 93 | pickerRow.value = Tuple(a: a, b: pickerRow.secondOptions(a)[row]) 94 | } 95 | } 96 | 97 | } 98 | 99 | // MARK: PickerRow 100 | open class _DoublePickerRow : Row> where A: Equatable, B: Equatable { 101 | 102 | /// Options for first component. Will be called often so should be O(1) 103 | public var firstOptions: (() -> [A]) = {[]} 104 | /// Options for second component given the selected value from the first component. Will be called often so should be O(1) 105 | public var secondOptions: ((A) -> [B]) = {_ in []} 106 | 107 | /// Modify the displayed values for the first picker row. 108 | public var displayValueForFirstRow: ((A) -> (String)) = { a in return String(describing: a) } 109 | /// Modify the displayed values for the second picker row. 110 | public var displayValueForSecondRow: ((B) -> (String)) = { b in return String(describing: b) } 111 | 112 | required public init(tag: String?) { 113 | super.init(tag: tag) 114 | } 115 | 116 | func selectedFirst() -> A { 117 | return value?.a ?? firstOptions()[0] 118 | } 119 | 120 | } 121 | 122 | /// A generic row where the user can pick an option from a picker view 123 | public final class DoublePickerRow: _DoublePickerRow, RowType where A: Equatable, B: Equatable { 124 | 125 | required public init(tag: String?) { 126 | super.init(tag: tag) 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/LabelRow.swift: -------------------------------------------------------------------------------- 1 | // LabelRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: LabelCell 29 | 30 | open class LabelCellOf: Cell, CellType { 31 | 32 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 33 | super.init(style: style, reuseIdentifier: reuseIdentifier) 34 | } 35 | 36 | required public init?(coder aDecoder: NSCoder) { 37 | super.init(coder: aDecoder) 38 | } 39 | 40 | open override func setup() { 41 | super.setup() 42 | selectionStyle = .none 43 | } 44 | } 45 | 46 | public typealias LabelCell = LabelCellOf 47 | 48 | // MARK: LabelRow 49 | 50 | open class _LabelRow: Row { 51 | required public init(tag: String?) { 52 | super.init(tag: tag) 53 | } 54 | } 55 | 56 | /// Simple row that can show title and value but is not editable by user. 57 | public final class LabelRow: _LabelRow, RowType { 58 | required public init(tag: String?) { 59 | super.init(tag: tag) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/MultipleSelectorRow.swift: -------------------------------------------------------------------------------- 1 | // MultipleSelectorRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | open class _MultipleSelectorRow: GenericMultipleSelectorRow where Cell: BaseCell, Cell.Value == Set { 28 | public required init(tag: String?) { 29 | super.init(tag: tag) 30 | } 31 | } 32 | 33 | /// A selector row where the user can pick several options from a pushed view controller 34 | public final class MultipleSelectorRow : _MultipleSelectorRow>>, RowType { 35 | public required init(tag: String?) { 36 | super.init(tag: tag) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/PickerInputRow.swift: -------------------------------------------------------------------------------- 1 | // PickerInputRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: PickerInputCell 29 | 30 | open class _PickerInputCell : Cell, CellType, UIPickerViewDataSource, UIPickerViewDelegate where T: Equatable { 31 | 32 | lazy public var picker: UIPickerView = { 33 | let picker = UIPickerView() 34 | picker.translatesAutoresizingMaskIntoConstraints = false 35 | return picker 36 | }() 37 | 38 | fileprivate var pickerInputRow: _PickerInputRow? { return row as? _PickerInputRow } 39 | 40 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 41 | super.init(style: style, reuseIdentifier: reuseIdentifier) 42 | } 43 | 44 | required public init?(coder aDecoder: NSCoder) { 45 | super.init(coder: aDecoder) 46 | } 47 | 48 | open override func setup() { 49 | super.setup() 50 | accessoryType = .none 51 | editingAccessoryType = .none 52 | picker.delegate = self 53 | picker.dataSource = self 54 | } 55 | 56 | deinit { 57 | picker.delegate = nil 58 | picker.dataSource = nil 59 | } 60 | 61 | open override func update() { 62 | super.update() 63 | selectionStyle = row.isDisabled ? .none : .default 64 | 65 | if row.title?.isEmpty == false { 66 | detailTextLabel?.text = row.displayValueFor?(row.value) ?? (row as? NoValueDisplayTextConformance)?.noValueDisplayText 67 | } else { 68 | textLabel?.text = row.displayValueFor?(row.value) ?? (row as? NoValueDisplayTextConformance)?.noValueDisplayText 69 | detailTextLabel?.text = nil 70 | } 71 | 72 | if #available(iOS 13.0, *) { 73 | textLabel?.textColor = row.isDisabled ? .tertiaryLabel : .label 74 | } else { 75 | textLabel?.textColor = row.isDisabled ? .gray : .black 76 | } 77 | if row.isHighlighted { 78 | textLabel?.textColor = tintColor 79 | } 80 | 81 | picker.reloadAllComponents() 82 | } 83 | 84 | open override func didSelect() { 85 | super.didSelect() 86 | row.deselect() 87 | } 88 | 89 | open override var inputView: UIView? { 90 | return picker 91 | } 92 | 93 | open override func cellCanBecomeFirstResponder() -> Bool { 94 | return canBecomeFirstResponder 95 | } 96 | 97 | override open var canBecomeFirstResponder: Bool { 98 | return !row.isDisabled 99 | } 100 | 101 | open func numberOfComponents(in pickerView: UIPickerView) -> Int { 102 | return 1 103 | } 104 | 105 | open func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 106 | return pickerInputRow?.options.count ?? 0 107 | } 108 | 109 | open func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 110 | return pickerInputRow?.displayValueFor?(pickerInputRow?.options[row]) 111 | } 112 | 113 | open func pickerView(_ pickerView: UIPickerView, didSelectRow rowNumber: Int, inComponent component: Int) { 114 | if let picker = pickerInputRow, picker.options.count > rowNumber { 115 | picker.value = picker.options[rowNumber] 116 | update() 117 | } 118 | } 119 | } 120 | 121 | open class PickerInputCell: _PickerInputCell where T: Equatable { 122 | 123 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 124 | super.init(style: style, reuseIdentifier: reuseIdentifier) 125 | } 126 | 127 | required public init?(coder aDecoder: NSCoder) { 128 | super.init(coder: aDecoder) 129 | } 130 | 131 | open override func update() { 132 | super.update() 133 | if let selectedValue = pickerInputRow?.value, let index = pickerInputRow?.options.firstIndex(of: selectedValue) { 134 | picker.selectRow(index, inComponent: 0, animated: true) 135 | } 136 | } 137 | 138 | } 139 | 140 | // MARK: PickerInputRow 141 | 142 | open class _PickerInputRow : Row>, NoValueDisplayTextConformance where T: Equatable { 143 | open var noValueDisplayText: String? = nil 144 | 145 | open var options = [T]() 146 | 147 | required public init(tag: String?) { 148 | super.init(tag: tag) 149 | 150 | } 151 | } 152 | 153 | /// A generic row where the user can pick an option from a picker view displayed in the keyboard area 154 | public final class PickerInputRow: _PickerInputRow, RowType where T: Equatable { 155 | 156 | required public init(tag: String?) { 157 | super.init(tag: tag) 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/PickerRow.swift: -------------------------------------------------------------------------------- 1 | // PickerRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: PickerCell 29 | 30 | open class _PickerCell : Cell, CellType, UIPickerViewDataSource, UIPickerViewDelegate where T: Equatable { 31 | 32 | @IBOutlet public weak var picker: UIPickerView! 33 | 34 | fileprivate var pickerRow: _PickerRow? { return row as? _PickerRow } 35 | 36 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 37 | let pickerView = UIPickerView() 38 | self.picker = pickerView 39 | self.picker?.translatesAutoresizingMaskIntoConstraints = false 40 | 41 | super.init(style: style, reuseIdentifier: reuseIdentifier) 42 | 43 | self.contentView.addSubview(pickerView) 44 | self.contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[picker]-0-|", options: [], metrics: nil, views: ["picker": pickerView])) 45 | self.contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[picker]-0-|", options: [], metrics: nil, views: ["picker": pickerView])) 46 | } 47 | 48 | required public init?(coder aDecoder: NSCoder) { 49 | super.init(coder: aDecoder) 50 | } 51 | 52 | open override func setup() { 53 | super.setup() 54 | accessoryType = .none 55 | editingAccessoryType = .none 56 | height = { UITableView.automaticDimension } 57 | picker.delegate = self 58 | picker.dataSource = self 59 | } 60 | 61 | open override func update() { 62 | super.update() 63 | textLabel?.text = nil 64 | detailTextLabel?.text = nil 65 | picker.reloadAllComponents() 66 | } 67 | 68 | deinit { 69 | picker?.delegate = nil 70 | picker?.dataSource = nil 71 | } 72 | 73 | open var pickerTextAttributes: [NSAttributedString.Key: Any]? 74 | 75 | open func numberOfComponents(in pickerView: UIPickerView) -> Int { 76 | return 1 77 | } 78 | 79 | open func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 80 | return pickerRow?.options.count ?? 0 81 | } 82 | 83 | open func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 84 | return pickerRow?.displayValueFor?(pickerRow?.options[row]) 85 | } 86 | 87 | open func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 88 | if let picker = pickerRow, !picker.options.isEmpty { 89 | picker.value = picker.options[row] 90 | } 91 | } 92 | 93 | open func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { 94 | guard let pickerTextAttributes = pickerTextAttributes, let text = self.pickerView(pickerView, titleForRow: row, forComponent: component) else { 95 | return nil 96 | } 97 | return NSAttributedString(string: text, attributes: pickerTextAttributes) 98 | } 99 | } 100 | 101 | open class PickerCell : _PickerCell where T: Equatable { 102 | 103 | required public init?(coder aDecoder: NSCoder) { 104 | super.init(coder: aDecoder) 105 | } 106 | 107 | public required init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 108 | super.init(style: style, reuseIdentifier: reuseIdentifier) 109 | } 110 | 111 | open override func update() { 112 | super.update() 113 | if let selectedValue = pickerRow?.value, let index = pickerRow?.options.firstIndex(of: selectedValue) { 114 | picker.selectRow(index, inComponent: 0, animated: true) 115 | } 116 | } 117 | 118 | } 119 | 120 | // MARK: PickerRow 121 | 122 | open class _PickerRow : Row> where T: Equatable { 123 | 124 | open var options = [T]() 125 | 126 | required public init(tag: String?) { 127 | super.init(tag: tag) 128 | } 129 | } 130 | 131 | /// A generic row where the user can pick an option from a picker view 132 | public final class PickerRow: _PickerRow, RowType where T: Equatable { 133 | 134 | required public init(tag: String?) { 135 | super.init(tag: tag) 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/PopoverSelectorRow.swift: -------------------------------------------------------------------------------- 1 | // PopoverSelectorRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class _PopoverSelectorRow : SelectorRow where Cell: BaseCell { 29 | 30 | public required init(tag: String?) { 31 | super.init(tag: tag) 32 | onPresentCallback = { [weak self] (_, viewController) -> Void in 33 | guard let porpoverController = viewController.popoverPresentationController, let tableView = self?.baseCell.formViewController()?.tableView, let cell = self?.cell else { 34 | fatalError() 35 | } 36 | porpoverController.sourceView = tableView 37 | porpoverController.sourceRect = tableView.convert(cell.detailTextLabel?.frame ?? cell.textLabel?.frame ?? cell.contentView.frame, from: cell) 38 | } 39 | presentationMode = .popover(controllerProvider: ControllerProvider.callback { return SelectorViewController> { _ in } }, onDismiss: { [weak self] in 40 | $0.dismiss(animated: true) 41 | self?.reload() 42 | }) 43 | } 44 | 45 | open override func didSelect() { 46 | deselect() 47 | super.didSelect() 48 | } 49 | } 50 | 51 | public final class PopoverSelectorRow : _PopoverSelectorRow>, RowType { 52 | public required init(tag: String?) { 53 | super.init(tag: tag) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/PushRow.swift: -------------------------------------------------------------------------------- 1 | // PushRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class _PushRow: SelectorRow where Cell: BaseCell { 29 | 30 | public required init(tag: String?) { 31 | super.init(tag: tag) 32 | presentationMode = .show(controllerProvider: ControllerProvider.callback { return SelectorViewController> { _ in } }, onDismiss: { vc in 33 | let _ = vc.navigationController?.popViewController(animated: true) }) 34 | } 35 | } 36 | 37 | /// A selector row where the user can pick an option from a pushed view controller 38 | public final class PushRow : _PushRow>, RowType { 39 | public required init(tag: String?) { 40 | super.init(tag: tag) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/SelectableRows/ListCheckRow.swift: -------------------------------------------------------------------------------- 1 | // ListCheckRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | open class ListCheckCell : Cell, CellType { 29 | 30 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 31 | super.init(style: style, reuseIdentifier: reuseIdentifier) 32 | } 33 | 34 | required public init?(coder aDecoder: NSCoder) { 35 | super.init(coder: aDecoder) 36 | } 37 | 38 | open override func update() { 39 | super.update() 40 | accessoryType = row.value != nil ? .checkmark : .none 41 | editingAccessoryType = accessoryType 42 | selectionStyle = .default 43 | if row.isDisabled { 44 | tintAdjustmentMode = .dimmed 45 | selectionStyle = .none 46 | } else { 47 | tintAdjustmentMode = .automatic 48 | } 49 | } 50 | 51 | open override func setup() { 52 | super.setup() 53 | accessoryType = .checkmark 54 | editingAccessoryType = accessoryType 55 | } 56 | 57 | open override func didSelect() { 58 | row.deselect() 59 | row.updateCell() 60 | } 61 | 62 | } 63 | 64 | public final class ListCheckRow: Row>, SelectableRowType, RowType where T: Equatable { 65 | public var selectableValue: T? 66 | required public init(tag: String?) { 67 | super.init(tag: tag) 68 | displayValueFor = nil 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Rows/SwitchRow.swift: -------------------------------------------------------------------------------- 1 | // SwitchRow.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | // MARK: SwitchCell 29 | 30 | open class SwitchCell: Cell, CellType { 31 | 32 | @IBOutlet public weak var switchControl: UISwitch! 33 | 34 | required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 35 | super.init(style: style, reuseIdentifier: reuseIdentifier) 36 | let switchC = UISwitch() 37 | switchControl = switchC 38 | accessoryView = switchControl 39 | editingAccessoryView = accessoryView 40 | } 41 | 42 | required public init?(coder aDecoder: NSCoder) { 43 | super.init(coder: aDecoder) 44 | } 45 | 46 | open override func setup() { 47 | super.setup() 48 | selectionStyle = .none 49 | switchControl.addTarget(self, action: #selector(SwitchCell.valueChanged), for: .valueChanged) 50 | } 51 | 52 | deinit { 53 | switchControl?.removeTarget(self, action: nil, for: .allEvents) 54 | } 55 | 56 | open override func update() { 57 | super.update() 58 | switchControl.isOn = row.value ?? false 59 | switchControl.isEnabled = !row.isDisabled 60 | } 61 | 62 | @objc func valueChanged() { 63 | row.value = switchControl?.isOn ?? false 64 | } 65 | } 66 | 67 | // MARK: SwitchRow 68 | 69 | open class _SwitchRow: Row { 70 | required public init(tag: String?) { 71 | super.init(tag: tag) 72 | displayValueFor = nil 73 | } 74 | } 75 | 76 | /// Boolean row that has a UISwitch as accessoryType 77 | public final class SwitchRow: _SwitchRow, RowType { 78 | required public init(tag: String?) { 79 | super.init(tag: tag) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleClosure.swift: -------------------------------------------------------------------------------- 1 | // RuleClosure.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct RuleClosure: RuleType { 28 | 29 | public var id: String? 30 | public var validationError: ValidationError 31 | 32 | public var closure: (T?) -> ValidationError? 33 | 34 | public func isValid(value: T?) -> ValidationError? { 35 | return closure(value) 36 | } 37 | 38 | public init(validationError: ValidationError = ValidationError(msg: "Field validation fails.."), id: String? = nil, closure: @escaping ((T?) -> ValidationError?)) { 39 | self.validationError = validationError 40 | self.closure = closure 41 | self.id = id 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleEmail.swift: -------------------------------------------------------------------------------- 1 | // RuleEmail.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public class RuleEmail: RuleRegExp { 28 | 29 | public init(msg: String = "Field value should be a valid email!", id: String? = nil) { 30 | super.init(regExpr: RegExprPattern.EmailAddress.rawValue, allowsEmpty: true, msg: msg, id: id) 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleEqualsToRow.swift: -------------------------------------------------------------------------------- 1 | // RuleRequire.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct RuleEqualsToRow: RuleType { 28 | 29 | public init(form: Form, tag: String, msg: String = "Fields don't match!", id: String? = nil) { 30 | self.validationError = ValidationError(msg: msg) 31 | self.form = form 32 | self.tag = tag 33 | self.row = nil 34 | self.id = id 35 | } 36 | 37 | public init(row: RowOf, msg: String = "Fields don't match!", id: String? = nil) { 38 | self.validationError = ValidationError(msg: msg) 39 | self.form = nil 40 | self.tag = nil 41 | self.row = row 42 | self.id = id 43 | } 44 | 45 | public var id: String? 46 | public var validationError: ValidationError 47 | public weak var form: Form? 48 | public var tag: String? 49 | public weak var row: RowOf? 50 | 51 | public func isValid(value: T?) -> ValidationError? { 52 | let rowAux: RowOf = row ?? form!.rowBy(tag: tag!)! 53 | return rowAux.value == value ? nil : validationError 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleLength.swift: -------------------------------------------------------------------------------- 1 | // RuleLength.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct RuleMinLength: RuleType { 28 | 29 | let min: UInt 30 | 31 | public var id: String? 32 | public var validationError: ValidationError 33 | 34 | public init(minLength: UInt, msg: String? = nil, id: String? = nil) { 35 | let ruleMsg = msg ?? "Field value must have at least \(minLength) characters" 36 | min = minLength 37 | validationError = ValidationError(msg: ruleMsg) 38 | self.id = id 39 | } 40 | 41 | public func isValid(value: String?) -> ValidationError? { 42 | guard let value = value, !value.isEmpty else { return nil } 43 | return value.count < Int(min) ? validationError : nil 44 | } 45 | } 46 | 47 | public struct RuleMaxLength: RuleType { 48 | 49 | let max: UInt 50 | 51 | public var id: String? 52 | public var validationError: ValidationError 53 | 54 | public init(maxLength: UInt, msg: String? = nil, id: String? = nil) { 55 | let ruleMsg = msg ?? "Field value must have less than \(maxLength) characters" 56 | max = maxLength 57 | validationError = ValidationError(msg: ruleMsg) 58 | self.id = id 59 | } 60 | 61 | public func isValid(value: String?) -> ValidationError? { 62 | guard let value = value, !value.isEmpty else { return nil } 63 | return value.count > Int(max) ? validationError : nil 64 | } 65 | } 66 | 67 | public struct RuleExactLength: RuleType { 68 | let length: UInt 69 | 70 | public var id: String? 71 | public var validationError: ValidationError 72 | 73 | public init(exactLength: UInt, msg: String? = nil, id: String? = nil) { 74 | let ruleMsg = msg ?? "Field value must have exactly \(exactLength) characters" 75 | length = exactLength 76 | validationError = ValidationError(msg: ruleMsg) 77 | self.id = id 78 | } 79 | 80 | public func isValid(value: String?) -> ValidationError? { 81 | guard let value = value, !value.isEmpty else { return nil } 82 | return value.count != Int(length) ? validationError : nil 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleRange.swift: -------------------------------------------------------------------------------- 1 | // RuleRange.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct RuleGreaterThan: RuleType { 28 | 29 | let min: T 30 | 31 | public var id: String? 32 | public var validationError: ValidationError 33 | 34 | public init(min: T, msg: String? = nil, id: String? = nil) { 35 | let ruleMsg = msg ?? "Field value must be greater than \(min)" 36 | self.min = min 37 | self.validationError = ValidationError(msg: ruleMsg) 38 | self.id = id 39 | } 40 | 41 | public func isValid(value: T?) -> ValidationError? { 42 | guard let val = value else { return nil } 43 | guard val > min else { return validationError } 44 | return nil 45 | } 46 | } 47 | 48 | public struct RuleGreaterOrEqualThan: RuleType { 49 | 50 | let min: T 51 | 52 | public var id: String? 53 | public var validationError: ValidationError 54 | 55 | public init(min: T, msg: String? = nil, id: String? = nil) { 56 | let ruleMsg = msg ?? "Field value must be greater or equals than \(min)" 57 | self.min = min 58 | self.validationError = ValidationError(msg: ruleMsg) 59 | self.id = id 60 | } 61 | 62 | public func isValid(value: T?) -> ValidationError? { 63 | guard let val = value else { return nil } 64 | guard val >= min else { return validationError } 65 | return nil 66 | } 67 | } 68 | 69 | public struct RuleSmallerThan: RuleType { 70 | 71 | let max: T 72 | 73 | public var id: String? 74 | public var validationError: ValidationError 75 | 76 | public init(max: T, msg: String? = nil, id: String? = nil) { 77 | let ruleMsg = msg ?? "Field value must be smaller than \(max)" 78 | self.max = max 79 | self.validationError = ValidationError(msg: ruleMsg) 80 | self.id = id 81 | } 82 | 83 | public func isValid(value: T?) -> ValidationError? { 84 | guard let val = value else { return nil } 85 | guard val < max else { return validationError } 86 | return nil 87 | } 88 | } 89 | 90 | public struct RuleSmallerOrEqualThan: RuleType { 91 | 92 | let max: T 93 | 94 | public var id: String? 95 | public var validationError: ValidationError 96 | 97 | public init(max: T, msg: String? = nil, id: String? = nil) { 98 | let ruleMsg = msg ?? "Field value must be smaller or equals than \(max)" 99 | self.max = max 100 | self.validationError = ValidationError(msg: ruleMsg) 101 | self.id = id 102 | } 103 | 104 | public func isValid(value: T?) -> ValidationError? { 105 | guard let val = value else { return nil } 106 | guard val <= max else { return validationError } 107 | return nil 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleRegExp.swift: -------------------------------------------------------------------------------- 1 | // RegexRule.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public enum RegExprPattern: String { 28 | case EmailAddress = "^[_A-Za-z0-9-+]+(\\.[_A-Za-z0-9-+]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z‌​]{2,})$" 29 | case URL = "((https|http)://)((\\w|-)+)(([.]|[/])((\\w|-)+))+([/?#]\\S*)?" 30 | case ContainsNumber = ".*\\d.*" 31 | case ContainsCapital = "^.*?[A-Z].*?$" 32 | case ContainsLowercase = "^.*?[a-z].*?$" 33 | } 34 | 35 | open class RuleRegExp: RuleType { 36 | 37 | public var regExpr: String = "" 38 | public var id: String? 39 | public var validationError: ValidationError 40 | public var allowsEmpty = true 41 | 42 | public init(regExpr: String, allowsEmpty: Bool = true, msg: String = "Invalid field value!", id: String? = nil) { 43 | self.validationError = ValidationError(msg: msg) 44 | self.regExpr = regExpr 45 | self.allowsEmpty = allowsEmpty 46 | self.id = id 47 | } 48 | 49 | public func isValid(value: String?) -> ValidationError? { 50 | if let value = value, !value.isEmpty { 51 | let predicate = NSPredicate(format: "SELF MATCHES %@", regExpr) 52 | guard predicate.evaluate(with: value) else { 53 | return validationError 54 | } 55 | return nil 56 | } else if !allowsEmpty { 57 | return validationError 58 | } 59 | return nil 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleRequired.swift: -------------------------------------------------------------------------------- 1 | // RuleRequire.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | 27 | public struct RuleRequired: RuleType { 28 | 29 | public init(msg: String = "Field required!", id: String? = nil) { 30 | self.validationError = ValidationError(msg: msg) 31 | self.id = id 32 | } 33 | 34 | public var id: String? 35 | public var validationError: ValidationError 36 | 37 | public func isValid(value: T?) -> ValidationError? { 38 | if let str = value as? String { 39 | return str.isEmpty ? validationError : nil 40 | } 41 | return value != nil ? nil : validationError 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Pods/Eureka/Source/Validations/RuleURL.swift: -------------------------------------------------------------------------------- 1 | // RuleURL.swift 2 | // Eureka ( https://github.com/xmartlabs/Eureka ) 3 | // 4 | // Copyright (c) 2016 Xmartlabs SRL ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | import Foundation 26 | import UIKit 27 | 28 | public struct RuleURL: RuleType { 29 | 30 | public init(allowsEmpty: Bool = true, requiresProtocol: Bool = false, msg: String = "Field value must be an URL!", id: String? = nil) { 31 | validationError = ValidationError(msg: msg) 32 | self.allowsEmpty = allowsEmpty 33 | self.requiresProtocol = requiresProtocol 34 | self.id = id 35 | } 36 | 37 | public var id: String? 38 | public var allowsEmpty = true 39 | public var requiresProtocol = false 40 | public var validationError: ValidationError 41 | 42 | public func isValid(value: URL?) -> ValidationError? { 43 | if let value = value, value.absoluteString.isEmpty == false { 44 | let predicate = NSPredicate(format:"SELF MATCHES %@", RegExprPattern.URL.rawValue) 45 | guard predicate.evaluate(with: value.absoluteString) else { 46 | return validationError 47 | } 48 | return nil 49 | } else if !allowsEmpty { 50 | return validationError 51 | } 52 | return nil 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Pods/Local Podspecs/SwiftChart.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SwiftChart", 3 | "version": "1.0.1", 4 | "summary": "Line and area chart library", 5 | "description": "Support multiple and partially filled series, signed floats, touch events.", 6 | "homepage": "https://github.com/gpbl/SwiftChart", 7 | "license": "MIT", 8 | "authors": { 9 | "Giampaolo Bellavite": "io@gpbl.org" 10 | }, 11 | "source": { 12 | "git": "https://github.com/gpbl/SwiftChart.git", 13 | "tag": "1.0.1" 14 | }, 15 | "social_media_url": "https://twitter.com/gpblv", 16 | "platforms": { 17 | "ios": "8.3" 18 | }, 19 | "swift_versions": "5", 20 | "requires_arc": true, 21 | "source_files": "Source/*.swift", 22 | "frameworks": "UIKit", 23 | "swift_version": "5" 24 | } 25 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Eureka (5.2.1) 3 | - SwiftChart (1.0.1) 4 | 5 | DEPENDENCIES: 6 | - Eureka (>= 5.0) 7 | - "SwiftChart (from `git@github.com:alldritt/SwiftChart`)" 8 | 9 | SPEC REPOS: 10 | https://github.com/CocoaPods/Specs.git: 11 | - Eureka 12 | 13 | EXTERNAL SOURCES: 14 | SwiftChart: 15 | :git: "git@github.com:alldritt/SwiftChart" 16 | 17 | CHECKOUT OPTIONS: 18 | SwiftChart: 19 | :commit: f2f9797b1edf7c538d06c08c79faf36175d71227 20 | :git: "git@github.com:alldritt/SwiftChart" 21 | 22 | SPEC CHECKSUMS: 23 | Eureka: c883105488e05bc65539f583246ecf9657cabbfe 24 | SwiftChart: dfa58fed4299f6cf242ad4a2e02609496bf66036 25 | 26 | PODFILE CHECKSUM: c2bb1aa99a913f9c6cfa21403be0686948a9cec7 27 | 28 | COCOAPODS: 1.8.4 29 | -------------------------------------------------------------------------------- /Pods/SwiftChart/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Giampaolo Bellavite 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Pods/SwiftChart/Source/ChartColors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartColors.swift 3 | // 4 | // Created by Giampaolo Bellavite on 07/11/14. 5 | // Copyright (c) 2014 Giampaolo Bellavite. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | Shorthands for various colors to use in the charts. 12 | */ 13 | public struct ChartColors { 14 | 15 | static fileprivate func colorFromHex(_ hex: Int) -> UIColor { 16 | let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0 17 | let green = CGFloat((hex & 0xFF00) >> 8) / 255.0 18 | let blue = CGFloat((hex & 0xFF)) / 255.0 19 | return UIColor(red: red, green: green, blue: blue, alpha: 1) 20 | } 21 | 22 | static public func blueColor() -> UIColor { 23 | return colorFromHex(0x4A90E2) 24 | } 25 | static public func orangeColor() -> UIColor { 26 | return colorFromHex(0xF5A623) 27 | } 28 | static public func greenColor() -> UIColor { 29 | return colorFromHex(0x7ED321) 30 | } 31 | static public func darkGreenColor() -> UIColor { 32 | return colorFromHex(0x417505) 33 | } 34 | static public func redColor() -> UIColor { 35 | return colorFromHex(0xFF3200) 36 | } 37 | static public func darkRedColor() -> UIColor { 38 | return colorFromHex(0xD0021B) 39 | } 40 | static public func purpleColor() -> UIColor { 41 | return colorFromHex(0x9013FE) 42 | } 43 | static public func maroonColor() -> UIColor { 44 | return colorFromHex(0x8B572A) 45 | } 46 | static public func pinkColor() -> UIColor { 47 | return colorFromHex(0xBD10E0) 48 | } 49 | static public func greyColor() -> UIColor { 50 | return colorFromHex(0x7f7f7f) 51 | } 52 | static public func cyanColor() -> UIColor { 53 | return colorFromHex(0x50E3C2) 54 | } 55 | static public func goldColor() -> UIColor { 56 | return colorFromHex(0xbcbd22) 57 | } 58 | static public func yellowColor() -> UIColor { 59 | return colorFromHex(0xF8E71C) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Pods/SwiftChart/Source/ChartSeries.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChartSeries.swift 3 | // 4 | // Created by Giampaolo Bellavite on 07/11/14. 5 | // Copyright (c) 2014 Giampaolo Bellavite. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | /** 11 | The `ChartSeries` class create a chart series and configure its appearance and behavior. 12 | */ 13 | 14 | public enum ChartCalloutKind { 15 | case circle, 16 | square, 17 | line, // line with title on top 18 | lineTop, // line with title on top 19 | lineBottom // line with title on bottom 20 | } 21 | 22 | public struct ChartCallout { 23 | private (set) var x: Int 24 | private (set) var kind: ChartCalloutKind 25 | private (set) var strokeColor: UIColor? 26 | private (set) var fillColor: UIColor? 27 | private (set) var lineWidth: CGFloat? 28 | private (set) var title: String? 29 | private (set) var titleColor: UIColor? 30 | 31 | public init(_ x: Int, kind: ChartCalloutKind = .circle, strokeColor: UIColor? = nil, fillColor: UIColor? = nil, lineWidth: CGFloat? = nil, title: String? = nil, titleColor: UIColor? = nil) { 32 | self.x = x 33 | self.kind = kind 34 | self.strokeColor = strokeColor 35 | self.fillColor = fillColor 36 | self.lineWidth = lineWidth 37 | self.title = title 38 | self.titleColor = titleColor 39 | } 40 | } 41 | 42 | open class ChartSeries { 43 | // MALL 44 | open var callouts: [ChartCallout] = [] 45 | open var lineWidth : CGFloat? 46 | 47 | /** 48 | The data used for the chart series. 49 | */ 50 | open var data: [(x: Double, y: Double)] 51 | 52 | /** 53 | When set to `false`, will hide the series line. Useful for drawing only the area with `area=true`. 54 | */ 55 | open var line: Bool = true 56 | 57 | /** 58 | Draws an area below the series line. 59 | */ 60 | open var area: Bool = false 61 | 62 | /** 63 | The series color. 64 | */ 65 | open var color: UIColor = ChartColors.blueColor() { 66 | didSet { 67 | colors = (above: color, below: color, 0) 68 | } 69 | } 70 | 71 | /** 72 | A tuple to specify the color above or below the zero 73 | */ 74 | open var colors: ( 75 | above: UIColor, 76 | below: UIColor, 77 | zeroLevel: Double 78 | ) = (above: ChartColors.blueColor(), below: ChartColors.redColor(), 0) 79 | 80 | public init(_ data: [Double]) { 81 | self.data = [] 82 | data.enumerated().forEach { (x, y) in 83 | let point: (x: Double, y: Double) = (x: Double(x), y: y) 84 | self.data.append(point) 85 | } 86 | } 87 | 88 | public init(data: [(x: Double, y: Double)]) { 89 | self.data = data 90 | } 91 | 92 | public init(data: [(x: Int, y: Double)]) { 93 | self.data = data.map { (Double($0.x), Double($0.y)) } 94 | } 95 | 96 | public init(data: [(x: Float, y: Float)]) { 97 | self.data = data.map { (Double($0.x), Double($0.y)) } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka-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 | 5.2.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Eureka : NSObject 3 | @end 4 | @implementation PodsDummy_Eureka 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double EurekaVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char EurekaVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka.modulemap: -------------------------------------------------------------------------------- 1 | framework module Eureka { 2 | umbrella header "Eureka-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/Eureka.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Eureka 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit" 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Eureka 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Eureka/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 | 4.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example-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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Eureka 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2019 XMARTLABS 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## SwiftChart 30 | 31 | The MIT License (MIT) 32 | 33 | Copyright (c) 2014 Giampaolo Bellavite 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | 53 | Generated by CocoaPods - https://cocoapods.org 54 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2019 XMARTLABS 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | Eureka 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | The MIT License (MIT) 49 | 50 | Copyright (c) 2014 Giampaolo Bellavite 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining a copy 53 | of this software and associated documentation files (the "Software"), to deal 54 | in the Software without restriction, including without limitation the rights 55 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 56 | copies of the Software, and to permit persons to whom the Software is 57 | furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all 60 | copies or substantial portions of the Software. 61 | 62 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 65 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 66 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 68 | SOFTWARE. 69 | 70 | License 71 | MIT 72 | Title 73 | SwiftChart 74 | Type 75 | PSGroupSpecifier 76 | 77 | 78 | FooterText 79 | Generated by CocoaPods - https://cocoapods.org 80 | Title 81 | 82 | Type 83 | PSGroupSpecifier 84 | 85 | 86 | StringsTable 87 | Acknowledgements 88 | Title 89 | Acknowledgements 90 | 91 | 92 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Eureka" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftChart" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Eureka/Eureka.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftChart/SwiftChart.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Eureka" -framework "Foundation" -framework "SwiftChart" -framework "UIKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Example { 2 | umbrella header "Pods-Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Eureka" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftChart" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Eureka/Eureka.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftChart/SwiftChart.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Eureka" -framework "Foundation" -framework "SwiftChart" -framework "UIKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/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.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart-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.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SwiftChart : NSObject 3 | @end 4 | @implementation PodsDummy_SwiftChart 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double SwiftChartVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char SwiftChartVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart.modulemap: -------------------------------------------------------------------------------- 1 | framework module SwiftChart { 2 | umbrella header "SwiftChart-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/SwiftChart/SwiftChart.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftChart 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftChart 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | By [Mark Alldritt](http://markalldritt.com). 2 | 3 | ## Introduction 4 | 5 | ViewRow is a [Eureka](https://github.com/xmartlabs/Eureka) row that allows you to display any UIView (or UIView subclass) within a Eureka row. Views can be created in code or loaded from nib files. ViewRow handles all interactions with Eureka allowing you to focus on developing your UIView subclass or Nib file. 6 | 7 | ![Demo](Screenshots/ViewRow.gif) 8 | 9 | ## ViewRow Usage 10 | 11 | ### Create view in code 12 | 13 | ```swift 14 | import Eureka 15 | import ViewRow 16 | 17 | class ViewController: FormViewController { 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | form 23 | +++ Section("ViewRow Demo") 24 | <<< ViewRow("view") { (row) in 25 | row.title = "My View Title" // optional 26 | } 27 | .cellSetup { (cell, row) in 28 | // Construct the view for the cell 29 | cell.view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 200)) 30 | cell.view?.backgroundColor = UIColor.orange 31 | } 32 | } 33 | } 34 | ``` 35 | 36 | ### Load view from a nib file 37 | 38 | ```swift 39 | import Eureka 40 | import ViewRow 41 | 42 | class ViewController: FormViewController { 43 | 44 | override func viewDidLoad() { 45 | super.viewDidLoad() 46 | 47 | form 48 | +++ Section("ViewRow Demo") 49 | <<< ViewRow("view") { (row) in 50 | row.title = "My View Title" // optional 51 | } 52 | .cellSetup { (cell, row) in 53 | // Construct the view 54 | let bundle = Bundle.main 55 | let nib = UINib(nibName: "MyView", bundle: bundle) 56 | 57 | cell.view = nib.instantiate(withOwner: self, options: nil)[0] as? MyView 58 | cell.view?.backgroundColor = cell.backgroundColor 59 | } 60 | } 61 | } 62 | ``` 63 | 64 | The ViewRow example application (used to generate the movie shown above) illustrates the various ways in which ViewRow can be used to host various types of UIView within a Eureka form. 65 | 66 | 67 | ## Requirements 68 | 69 | * iOS 10.0+ 70 | * Xcode 8.3+ 71 | * Eureka 3.0.* 72 | 73 | ## Getting involved 74 | 75 | * If you **want to contribute** please feel free to **submit pull requests**. 76 | * If you **have a feature request** please **open an issue**. 77 | * If you **found a bug** or **need help** please **check older issues, [FAQ](#faq) before submitting an issue.**. 78 | 79 | Before contribute check the [CONTRIBUTING](https://github.com/EurekaCommunity/ImageRow/blob/master/CONTRIBUTING.md) file for more info. 80 | 81 | If you use **ViewRow** in your app I would love to hear about it! Drop me a line at [alldritt@latenightsw.com](email:alldritt@latenightsw.com). 82 | 83 | 84 | ## Installation 85 | 86 | ### CocoaPods 87 | 88 | 1. Add `pod 'ViewRow'` to your Podfile 89 | 2. Quit any XCode instance containing a ViewRow project 90 | 3. Run `$ pod install` 91 | 4. Re-open XCode 92 | 5. For any source file that makes use of ViewRow, be sure to add: 93 | 94 | ... 95 | ```swift 96 | import Eureka 97 | import ViewRow 98 | ``` 99 | ... 100 | 101 | ### Swift Package Manager 102 | 103 | Add the following to your project's dependancies: 104 | 105 | ``` 106 | dependencies: [ .package(url: "https://github.com/EurekaCommunity/ViewRow.git", from: "0.9") ] 107 | ``` 108 | 109 | For any source file that makes use of ViewRow, be sure to add: 110 | 111 | ... 112 | ```swift 113 | import Eureka 114 | import ViewRow 115 | ``` 116 | ... 117 | 118 | ## ViewRow Customization 119 | 120 | The following properties control the placement of the title and view within the row: 121 | 122 | `viewRightMargin` 123 | `viewLeftMargin` 124 | `viewTopMargin` 125 | `viewBottomMargin` 126 | 127 | `titleLeftMargin` 128 | `titleRightMargin` 129 | `titleTopMargin` 130 | `titleBottomMargin` 131 | 132 | If the value of the row's `title` property is nil or blank, the title portion of the row is hidden. 133 | 134 | ## To-Dos 135 | 136 | Currently, ViewRow supports auto-layout within a view but does not allow auto-layout constraints to effect the height of the row. This is an improvement I would like to add in the future. 137 | 138 | 139 | ## Author 140 | 141 | - [Mark Alldritt](http://markalldritt.com) 142 | 143 | ## FAQ 144 | 145 | nothing yet 146 | 147 | ## See Also 148 | 149 | [Fluid Slider Demo](https://github.com/alldritt/EurekaFluidSlider) 150 | 151 | ## Other Rows 152 | 153 | See my other contributions to the Eureka Community: 154 | 155 | - [ColorPickerRow](https://github.com/EurekaCommunity/ColorPickerRow) 156 | -------------------------------------------------------------------------------- /Screenshots/ViewRow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EurekaCommunity/ViewRow/3428a3b825a5641ae7fb65f3f787aba2b1b4dab9/Screenshots/ViewRow.gif -------------------------------------------------------------------------------- /ViewRow.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'ViewRow' 3 | s.version = '0.8' 4 | s.license = 'MIT' 5 | s.summary = 'A UIView hosting row for use with the Eureka form library' 6 | s.homepage = 'https://github.com/EurekaCommunity/ViewRow' 7 | s.source = { :git => 'https://github.com/EurekaCommunity/ViewRow.git', :tag => s.version.to_s } 8 | s.ios.deployment_target = '9.3' 9 | s.ios.frameworks = 'UIKit' 10 | s.source_files = 'ViewRow/**/*.swift' 11 | s.requires_arc = true 12 | s.author = "Mark Alldritt" 13 | s.swift_version = '5.0' 14 | s.dependencies = { 15 | 'Eureka' => '>= 5.0.0' 16 | } 17 | end 18 | -------------------------------------------------------------------------------- /ViewRow/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ViewRow/ViewRow.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewRow.h 3 | // ViewRow 4 | // 5 | // Created by Cole Cunningham on 3/16/18. 6 | // Copyright © 2018 Late Night Software Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for ViewRow. 12 | FOUNDATION_EXPORT double ViewRowVersionNumber; 13 | 14 | //! Project version string for ViewRow. 15 | FOUNDATION_EXPORT const unsigned char ViewRowVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | --------------------------------------------------------------------------------