updated comments for the AppleGuidlinesTouchable
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
affdf8176f
commit
6ec498a8d7
@ -25,7 +25,7 @@
|
||||
EA0D1C452A6AD73000E5C127 /* RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0D1C442A6AD73000E5C127 /* RawRepresentable.swift */; };
|
||||
EA0FC2C62914222900DF80B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */; };
|
||||
EA297A5529FB07760031ED56 /* TooltipLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA297A5429FB07760031ED56 /* TooltipLabelAttribute.swift */; };
|
||||
EA297A5729FB0A360031ED56 /* AppleGuidlinesTouchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA297A5629FB0A360031ED56 /* AppleGuidlinesTouchable.swift */; };
|
||||
EA297A5729FB0A360031ED56 /* AppleGuidelinesTouchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA297A5629FB0A360031ED56 /* AppleGuidelinesTouchable.swift */; };
|
||||
EA336171288B19200071C351 /* VDS.docc in Sources */ = {isa = PBXBuildFile; fileRef = EA336170288B19200071C351 /* VDS.docc */; };
|
||||
EA336177288B19210071C351 /* VDS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA33616C288B19200071C351 /* VDS.framework */; };
|
||||
EA33617C288B19210071C351 /* VDSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33617B288B19210071C351 /* VDSTests.swift */; };
|
||||
@ -170,7 +170,7 @@
|
||||
EA0D1C442A6AD73000E5C127 /* RawRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawRepresentable.swift; sourceTree = "<group>"; };
|
||||
EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; };
|
||||
EA297A5429FB07760031ED56 /* TooltipLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TooltipLabelAttribute.swift; sourceTree = "<group>"; };
|
||||
EA297A5629FB0A360031ED56 /* AppleGuidlinesTouchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidlinesTouchable.swift; sourceTree = "<group>"; };
|
||||
EA297A5629FB0A360031ED56 /* AppleGuidelinesTouchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesTouchable.swift; sourceTree = "<group>"; };
|
||||
EA33616C288B19200071C351 /* VDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VDS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA33616F288B19200071C351 /* VDS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VDS.h; sourceTree = "<group>"; };
|
||||
EA336170288B19200071C351 /* VDS.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = VDS.docc; sourceTree = "<group>"; };
|
||||
@ -493,7 +493,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */,
|
||||
EA297A5629FB0A360031ED56 /* AppleGuidlinesTouchable.swift */,
|
||||
EA297A5629FB0A360031ED56 /* AppleGuidelinesTouchable.swift */,
|
||||
EAF1FE9A29DB1A6000101452 /* Changeable.swift */,
|
||||
EAF1FE9829D4850E00101452 /* Clickable.swift */,
|
||||
EAA5EEDF28F49DB3003B3210 /* Colorable.swift */,
|
||||
@ -908,7 +908,7 @@
|
||||
EA0D1C3F2A6AD5E200E5C127 /* Typography+ContentSizeCategory.swift in Sources */,
|
||||
EA5F86C82A1BD99100BC83E4 /* TabModel.swift in Sources */,
|
||||
EA0D1C432A6AD70900E5C127 /* VDSTypography.swift in Sources */,
|
||||
EA297A5729FB0A360031ED56 /* AppleGuidlinesTouchable.swift in Sources */,
|
||||
EA297A5729FB0A360031ED56 /* AppleGuidelinesTouchable.swift in Sources */,
|
||||
EA3361C328902D960071C351 /* Toggle.swift in Sources */,
|
||||
EAF7F0A0289AB7EC00B287F5 /* View.swift in Sources */,
|
||||
EA89201328B568D8006B9984 /* RadioBoxItem.swift in Sources */,
|
||||
|
||||
@ -75,10 +75,12 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
|
||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||
open var shouldUpdateView: Bool = true
|
||||
|
||||
/// The ButtonSize available to this type of Buttonable.
|
||||
open var availableSizes: [ButtonSize] { [] }
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||
|
||||
/// Text that will be used in the titleLabel.
|
||||
open var text: String? { didSet { setNeedsUpdate() } }
|
||||
|
||||
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||
@ -99,6 +101,7 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
|
||||
|
||||
internal var isHighlightAnimating = false
|
||||
|
||||
/// Whether the Control is highlighted or not.
|
||||
open override var isHighlighted: Bool {
|
||||
didSet {
|
||||
if isHighlightAnimating == false && touchUpInsideCount > 0 {
|
||||
@ -225,9 +228,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
|
||||
|
||||
}
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension ButtonBase: AppleGuidlinesTouchable {
|
||||
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension ButtonBase: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -14,8 +14,8 @@ extension ButtonGroup {
|
||||
|
||||
}
|
||||
|
||||
extension ButtonGroup.ButtonGroupCollectionViewCell: AppleGuidlinesTouchable {
|
||||
|
||||
extension ButtonGroup.ButtonGroupCollectionViewCell: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -150,9 +150,9 @@ open class Checkbox: SelectorBase {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension Checkbox: AppleGuidlinesTouchable {
|
||||
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension Checkbox: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ open class ButtonIcon: Control {
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
/// Icon object used to render out the Icon for this ButtonIcon.
|
||||
open var icon = Icon()
|
||||
open var icon = Icon().with { $0.isUserInteractionEnabled = false }
|
||||
|
||||
/// Determines the type of button based on the contrast.
|
||||
open var kind: Kind = .ghost { didSet { setNeedsUpdate() } }
|
||||
@ -351,23 +351,12 @@ open class ButtonIcon: Control {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension ButtonIcon: AppleGuidlinesTouchable {
|
||||
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension ButtonIcon: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
let view = super.hitTest(point, with: event)
|
||||
|
||||
if view == icon {
|
||||
return self
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension UIView {
|
||||
|
||||
@ -109,9 +109,9 @@ open class RadioButton: SelectorBase {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension RadioButton: AppleGuidlinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of 45 x 45.
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension RadioButton: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -248,9 +248,9 @@ open class ToggleView: Control, Changeable {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension ToggleView: AppleGuidlinesTouchable {
|
||||
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension ToggleView: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -190,9 +190,9 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
}
|
||||
|
||||
|
||||
// MARK: AppleGuidlinesTouchable
|
||||
extension Tooltip: AppleGuidlinesTouchable {
|
||||
|
||||
// MARK: AppleGuidelinesTouchable
|
||||
extension Tooltip: AppleGuidelinesTouchable {
|
||||
/// Overrides to ensure that the touch point meets a minimum of the minimumTappableArea.
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ extension UIView {
|
||||
layer.addSublayer(borderLayer)
|
||||
|
||||
//add touchborder if applicable
|
||||
if type(of: self) is AppleGuidlinesTouchable.Type {
|
||||
if type(of: self) is AppleGuidelinesTouchable.Type {
|
||||
let faultToleranceX: CGFloat = max((45 - bounds.size.width) / 2.0, 0)
|
||||
let faultToleranceY: CGFloat = max((45 - bounds.size.height) / 2.0, 0)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// AppleGuidlinesTouchable.swift
|
||||
// AppleGuidelinesTouchable.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 4/27/23.
|
||||
@ -7,12 +7,12 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol AppleGuidlinesTouchable {
|
||||
public protocol AppleGuidelinesTouchable {
|
||||
static var minimumTappableArea: CGFloat { get }
|
||||
static func acceptablyOutsideBounds(point: CGPoint, bounds: CGRect) -> Bool
|
||||
}
|
||||
|
||||
extension AppleGuidlinesTouchable {
|
||||
extension AppleGuidelinesTouchable {
|
||||
|
||||
static public var minimumTappableArea: CGFloat {
|
||||
return 45.0
|
||||
Loading…
Reference in New Issue
Block a user