Procházet zdrojové kódy

Update: IOS 14 support

Jon Fawcett před 5 roky
rodič
revize
ba34fbf33a

+ 1 - 1
Podfile

@@ -2,7 +2,7 @@ target 'LoopFollow' do
   use_frameworks!
 
   pod 'Charts'
-  pod 'Eureka'
+  pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git', :branch => 'xcode12'
   pod 'ShareClient', :git => 'https://github.com/josep1972/dexcom-share-client-swift.git', :branch => 'dev' 
   
 end

+ 8 - 3
Podfile.lock

@@ -7,20 +7,25 @@ PODS:
 
 DEPENDENCIES:
   - Charts
-  - Eureka
+  - Eureka (from `https://github.com/xmartlabs/Eureka.git`, branch `xcode12`)
   - ShareClient (from `https://github.com/josep1972/dexcom-share-client-swift.git`, branch `dev`)
 
 SPEC REPOS:
   trunk:
     - Charts
-    - Eureka
 
 EXTERNAL SOURCES:
+  Eureka:
+    :branch: xcode12
+    :git: https://github.com/xmartlabs/Eureka.git
   ShareClient:
     :branch: dev
     :git: https://github.com/josep1972/dexcom-share-client-swift.git
 
 CHECKOUT OPTIONS:
+  Eureka:
+    :commit: f5651e328e099393e51b63f1abe78153cbacf90f
+    :git: https://github.com/xmartlabs/Eureka.git
   ShareClient:
     :commit: 815a1dbddd970a563e3b7fd22d88b23c164b026e
     :git: https://github.com/josep1972/dexcom-share-client-swift.git
@@ -30,6 +35,6 @@ SPEC CHECKSUMS:
   Eureka: c883105488e05bc65539f583246ecf9657cabbfe
   ShareClient: 5937ff69b57c85c2004c915812f73cf7ae86549e
 
-PODFILE CHECKSUM: b5ee540f0ef2120e92d3b71909453c335d659552
+PODFILE CHECKSUM: 532f55936f29112bc61a5bc37e8b82ab44663a0d
 
 COCOAPODS: 1.9.3

+ 6 - 8
Pods/Eureka/Source/Core/BaseRow.swift

@@ -74,10 +74,15 @@ open class BaseRow: BaseRowType {
         get { return nil }
     }
 
-    public func validate(quietly: Bool = false) -> [ValidationError] {
+    open func validate(quietly: Bool = false) -> [ValidationError] {
         return []
     }
 
+    // Reset validation
+    open func cleanValidationErrors() {
+        validationErrors = []
+    }
+
     public static var estimatedRowHeight: CGFloat = 44.0
 
     /// Condition that determines if the row should be disabled or not.
@@ -152,13 +157,6 @@ open class BaseRow: BaseRowType {
 }
 
 extension BaseRow {
-    // Reset validation
-    public func cleanValidationErrors(){
-        validationErrors = []
-    }
-}
-
-extension BaseRow {
 
     /**
      Evaluates if the row should be hidden or not and updates the form accordingly

+ 8 - 2
Pods/Eureka/Source/Core/Core.swift

@@ -475,8 +475,14 @@ open class FormViewController: UIViewController, FormViewControllerProtocol, For
         super.viewWillAppear(animated)
         animateTableView = true
         let selectedIndexPaths = tableView.indexPathsForSelectedRows ?? []
-        if !selectedIndexPaths.isEmpty, tableView.window != nil {
-            tableView.reloadRows(at: selectedIndexPaths, with: .none)
+        if !selectedIndexPaths.isEmpty {
+            if #available(iOS 13.0, *) {
+                if tableView.window != nil {
+                    tableView.reloadRows(at: selectedIndexPaths, with: .none)
+                }
+            } else {
+                tableView.reloadRows(at: selectedIndexPaths, with: .none)
+            }
         }
         selectedIndexPaths.forEach {
             tableView.selectRow(at: $0, animated: false, scrollPosition: .none)

+ 1 - 1
Pods/Eureka/Source/Core/Row.swift

@@ -85,7 +85,7 @@ open class RowOf<T>: BaseRow where T: Equatable {
     public internal(set) var rules: [ValidationRuleHelper<T>] = []
 
     @discardableResult
-    public override func validate(quietly: Bool = false) -> [ValidationError] {
+    open override func validate(quietly: Bool = false) -> [ValidationError] {
         var vErrors = [ValidationError]()
         #if swift(>=4.1)
         vErrors = rules.compactMap { $0.validateFn(value) }

+ 1 - 1
Pods/Eureka/Source/Core/SelectableSection.swift

@@ -62,7 +62,7 @@ public protocol SelectableSectionType: Collection {
     func selectedRows() -> [SelectableRow]
 }
 
-extension SelectableSectionType where Self: Section {
+extension SelectableSectionType where Element == BaseRow, Self: AnyObject {
     /**
      Returns the selected row of this section. Should be used if selectionType is SingleSelection
      */

+ 7 - 2
Pods/Eureka/Source/Rows/Common/FieldRow.swift

@@ -206,6 +206,11 @@ open class _FieldCell<T> : Cell<T>, UITextFieldDelegate, TextFieldCell where T:
         }
         textField.addTarget(self, action: #selector(_FieldCell.textFieldDidChange(_:)), for: .editingChanged)
 
+        if let titleLabel = titleLabel {
+            // Make sure the title takes over most of the empty space so that the text field starts editing at the back.
+            let priority = UILayoutPriority(rawValue: titleLabel.contentHuggingPriority(for: .horizontal).rawValue + 1)
+            textField.setContentHuggingPriority(priority, for: .horizontal)
+        }
     }
 
     open override func update() {
@@ -261,11 +266,11 @@ open class _FieldCell<T> : Cell<T>, UITextFieldDelegate, TextFieldCell where T:
     }
 
     open override func cellBecomeFirstResponder(withDirection: Direction) -> Bool {
-        return textField?.becomeFirstResponder() ?? false
+        return textField.becomeFirstResponder()
     }
 
     open override func cellResignFirstResponder() -> Bool {
-        return textField?.resignFirstResponder() ?? true
+        return textField.resignFirstResponder()
     }
 
     open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {

+ 8 - 3
Pods/Manifest.lock

@@ -7,20 +7,25 @@ PODS:
 
 DEPENDENCIES:
   - Charts
-  - Eureka
+  - Eureka (from `https://github.com/xmartlabs/Eureka.git`, branch `xcode12`)
   - ShareClient (from `https://github.com/josep1972/dexcom-share-client-swift.git`, branch `dev`)
 
 SPEC REPOS:
   trunk:
     - Charts
-    - Eureka
 
 EXTERNAL SOURCES:
+  Eureka:
+    :branch: xcode12
+    :git: https://github.com/xmartlabs/Eureka.git
   ShareClient:
     :branch: dev
     :git: https://github.com/josep1972/dexcom-share-client-swift.git
 
 CHECKOUT OPTIONS:
+  Eureka:
+    :commit: f5651e328e099393e51b63f1abe78153cbacf90f
+    :git: https://github.com/xmartlabs/Eureka.git
   ShareClient:
     :commit: 815a1dbddd970a563e3b7fd22d88b23c164b026e
     :git: https://github.com/josep1972/dexcom-share-client-swift.git
@@ -30,6 +35,6 @@ SPEC CHECKSUMS:
   Eureka: c883105488e05bc65539f583246ecf9657cabbfe
   ShareClient: 5937ff69b57c85c2004c915812f73cf7ae86549e
 
-PODFILE CHECKSUM: b5ee540f0ef2120e92d3b71909453c335d659552
+PODFILE CHECKSUM: 532f55936f29112bc61a5bc37e8b82ab44663a0d
 
 COCOAPODS: 1.9.3