Merge branch 'develop' into feature/swiftified_textField

# Conflicts:
#	MVMCoreUI.xcodeproj/project.pbxproj
This commit is contained in:
Kevin G Christiano 2020-01-07 16:14:42 -05:00
commit 916f63240b
3 changed files with 50 additions and 10 deletions

View File

@ -43,6 +43,7 @@
0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; };
0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; };
0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; };
0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; };
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */; };
0ABD136B237B193A0081388D /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD136A237B193A0081388D /* EntryFieldContainer.swift */; };
@ -241,6 +242,7 @@
0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CATransaction+Extension.swift"; sourceTree = "<group>"; };
0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = "<group>"; };
0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = "<group>"; };
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.swift; sourceTree = "<group>"; };
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButton.swift; sourceTree = "<group>"; };
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; };
0A7BAFA2232BE63400FB8E22 /* CheckboxWithLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxWithLabelView.swift; sourceTree = "<group>"; };
@ -466,6 +468,14 @@
path = views;
sourceTree = "<group>";
};
0A5D59C323AD488600EFD9E9 /* Protocols */ = {
isa = PBXGroup;
children = (
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */,
);
path = Protocols;
sourceTree = "<group>";
};
D213347423842FE3008E41B3 /* Controllers */ = {
isa = PBXGroup;
children = (
@ -948,6 +958,7 @@
D2B18B7E2360913400A9AEDC /* Control.swift */,
D2B18B802360945C00A9AEDC /* View.swift */,
0AE14F63238315D2005417F8 /* TextField.swift */,
0A5D59C323AD488600EFD9E9 /* Protocols */,
);
path = BaseClasses;
sourceTree = "<group>";
@ -1110,6 +1121,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */,
943784F5236B77BB006A1E82 /* GraphView.swift in Sources */,
D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */,
DBC4391822442197001AB423 /* CaretView.swift in Sources */,

View File

@ -47,18 +47,14 @@ import UIKit
setupView()
}
}
//--------------------------------------------------
// MARK: - UITouch
//--------------------------------------------------
}
// MARK: - AppleGuidelinesProtocol
extension Control: AppleGuidelinesProtocol {
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
// If the control is smaller than 44pt by width or height, this will compensate.
let faultToleranceX: CGFloat = max((MinimumTappableArea - bounds.size.width) / 2.0, 0)
let faultToleranceY: CGFloat = max((MinimumTappableArea - bounds.size.height) / 2.0, 0)
let area = bounds.insetBy(dx: -faultToleranceX, dy: -faultToleranceY)
return area.contains(point)
return Self.acceptablyOutsideBounds(point: point, bounds: bounds)
}
}

View File

@ -0,0 +1,32 @@
//
// AppleGuidelinesProtocol.swift
// MVMCoreUI
//
// Created by Kevin Christiano on 12/20/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public protocol AppleGuidelinesProtocol {
static var minimumTappableArea: CGFloat { get }
static func acceptablyOutsideBounds(point: CGPoint, bounds: CGRect) -> Bool
}
extension AppleGuidelinesProtocol {
static public var minimumTappableArea: CGFloat {
return 44.0
}
// If the control is smaller than 44pt by width or height, this will compensate.
static public func acceptablyOutsideBounds(point: CGPoint, bounds: CGRect) -> Bool {
let faultToleranceX: CGFloat = max((minimumTappableArea - bounds.size.width) / 2.0, 0)
let faultToleranceY: CGFloat = max((minimumTappableArea - bounds.size.height) / 2.0, 0)
let area = bounds.insetBy(dx: -faultToleranceX, dy: -faultToleranceY)
return area.contains(point)
}
}