diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 4fb94ea7d..86289c172 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -74,7 +74,6 @@ 5108F6B72375E612001ABC45 /* CacheCleaner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5108F6B52375E612001ABC45 /* CacheCleaner.swift */; }; 5108F6D22375EED2001ABC45 /* TimelineCustomizerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5108F6D12375EED2001ABC45 /* TimelineCustomizerViewController.swift */; }; 5108F6D42375EEEF001ABC45 /* TimelinePreviewTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5108F6D32375EEEF001ABC45 /* TimelinePreviewTableViewController.swift */; }; - 5108F6D823763094001ABC45 /* TickMarkSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5108F6D723763094001ABC45 /* TickMarkSlider.swift */; }; 510C416124E5CDE3008226FD /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510C416024E5CDE3008226FD /* ShareViewController.swift */; }; 510C416424E5CDE3008226FD /* ShareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 510C416224E5CDE3008226FD /* ShareViewController.xib */; }; 510C416924E5CDE3008226FD /* NetNewsWire Share Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -1048,7 +1047,6 @@ 5108F6B52375E612001ABC45 /* CacheCleaner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheCleaner.swift; sourceTree = ""; }; 5108F6D12375EED2001ABC45 /* TimelineCustomizerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineCustomizerViewController.swift; sourceTree = ""; }; 5108F6D32375EEEF001ABC45 /* TimelinePreviewTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinePreviewTableViewController.swift; sourceTree = ""; }; - 5108F6D723763094001ABC45 /* TickMarkSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TickMarkSlider.swift; sourceTree = ""; }; 510C415C24E5CDE3008226FD /* NetNewsWire Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 510C416024E5CDE3008226FD /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; 510C416324E5CDE3008226FD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShareViewController.xib; sourceTree = ""; }; @@ -1865,7 +1863,6 @@ 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */, 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */, 512363372369155100951F16 /* RoundedProgressView.swift */, - 5108F6D723763094001ABC45 /* TickMarkSlider.swift */, C5A6ED6C23C9B0C800AB6BE2 /* UIActivityViewController-Extensions.swift */, 51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */, 51F85BF622749FA100C787DC /* UIFont-Extensions.swift */, @@ -3923,7 +3920,6 @@ 512D554423C804DE0023FFFA /* OpenInSafariActivity.swift in Sources */, 51C452762265091600C03939 /* TimelineViewController.swift in Sources */, 5195C1DC2720BD3000888867 /* FeedRowIdentifier.swift in Sources */, - 5108F6D823763094001ABC45 /* TickMarkSlider.swift in Sources */, 51C452882265093600C03939 /* AddFeedViewController.swift in Sources */, 51B5C8C023F3866C00032075 /* ExtensionFeedAddRequestFile.swift in Sources */, 51A169A0235E10D700EB091F /* FeedbinAccountViewController.swift in Sources */, diff --git a/iOS/UIKit Extensions/TickMarkSlider.swift b/UIKitExtras/Sources/UIKitExtras/TickMarkSlider.swift similarity index 85% rename from iOS/UIKit Extensions/TickMarkSlider.swift rename to UIKitExtras/Sources/UIKitExtras/TickMarkSlider.swift index 5a7aa73ba..24a7152b3 100644 --- a/iOS/UIKit Extensions/TickMarkSlider.swift +++ b/UIKitExtras/Sources/UIKitExtras/TickMarkSlider.swift @@ -8,13 +8,13 @@ import UIKit -class TickMarkSlider: UISlider { +public final class TickMarkSlider: UISlider { private var enableFeedback = false private let feedbackGenerator = UISelectionFeedbackGenerator() private var roundedValue: Float? - override var value: Float { + public override var value: Float { didSet { let testValue = value.rounded() if testValue != roundedValue && enableFeedback && value.truncatingRemainder(dividingBy: 1) == 0 { @@ -24,7 +24,7 @@ class TickMarkSlider: UISlider { } } - func addTickMarks() { + public func addTickMarks(color: UIColor) { enableFeedback = true @@ -36,7 +36,7 @@ class TickMarkSlider: UISlider { let tick = UIView() tick.translatesAutoresizingMaskIntoConstraints = false - tick.backgroundColor = AppAssets.tickMarkColor + tick.backgroundColor = backgroundColor insertSubview(tick, at: 0) tick.widthAnchor.constraint(equalToConstant: 3).isActive = true @@ -59,7 +59,6 @@ class TickMarkSlider: UISlider { } else { tick.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true } - } if let firstGapLayoutGuild = gapLayoutGuides.first { @@ -67,17 +66,15 @@ class TickMarkSlider: UISlider { gapLayoutGuides[i].widthAnchor.constraint(equalTo: firstGapLayoutGuild.widthAnchor).isActive = true } } - } - override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { + public override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { let result = super.continueTracking(touch, with: event) value = value.rounded() return result } - override func endTracking(_ touch: UITouch?, with event: UIEvent?) { + public override func endTracking(_ touch: UITouch?, with event: UIEvent?) { value = value.rounded() } - } diff --git a/iOS/Settings/TimelineCustomizerViewController.swift b/iOS/Settings/TimelineCustomizerViewController.swift index 6869be1aa..113959831 100644 --- a/iOS/Settings/TimelineCustomizerViewController.swift +++ b/iOS/Settings/TimelineCustomizerViewController.swift @@ -8,8 +8,9 @@ import UIKit import Images +import UIKitExtras -class TimelineCustomizerViewController: UIViewController { +final class TimelineCustomizerViewController: UIViewController { @IBOutlet weak var iconSizeSliderContainerView: UIView! @IBOutlet weak var iconSizeSlider: TickMarkSlider! @@ -29,11 +30,11 @@ class TimelineCustomizerViewController: UIViewController { iconSizeSliderContainerView.layer.cornerRadius = 10 iconSizeSlider.value = Float(AppDefaults.shared.timelineIconSize.rawValue) - iconSizeSlider.addTickMarks() + iconSizeSlider.addTickMarks(color: AppAssets.tickMarkColor) numberOfLinesSliderContainerView.layer.cornerRadius = 10 numberOfLinesSlider.value = Float(AppDefaults.shared.timelineNumberOfLines) - numberOfLinesSlider.addTickMarks() + numberOfLinesSlider.addTickMarks(color: AppAssets.tickMarkColor) } override func viewWillAppear(_ animated: Bool) { @@ -57,7 +58,6 @@ class TimelineCustomizerViewController: UIViewController { AppDefaults.shared.timelineNumberOfLines = Int(numberOfLinesSlider.value.rounded()) updatePreview() } - } // MARK: Private @@ -87,5 +87,4 @@ private extension TimelineCustomizerViewController { previewContainerView.layer.borderWidth = 0 } } - }