mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add show hide password button and delete unused SwiftUI extensions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// AddFeedbinAccountViewController.swift
|
||||
// FeedbinAccountViewController.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 5/19/19.
|
||||
@@ -16,6 +16,7 @@ class FeedbinAccountViewController: UIViewController {
|
||||
@IBOutlet weak var cancelBarButtonItem: UIBarButtonItem!
|
||||
@IBOutlet weak var emailTextField: UITextField!
|
||||
@IBOutlet weak var passwordTextField: UITextField!
|
||||
@IBOutlet weak var showHideButton: UIButton!
|
||||
@IBOutlet weak var actionButton: UIButton!
|
||||
|
||||
@IBOutlet weak var errorMessageLabel: UILabel!
|
||||
@@ -44,10 +45,20 @@ class FeedbinAccountViewController: UIViewController {
|
||||
delegate?.dismiss()
|
||||
}
|
||||
|
||||
@IBAction func showHidePassword(_ sender: Any) {
|
||||
if passwordTextField.isSecureTextEntry {
|
||||
passwordTextField.isSecureTextEntry = false
|
||||
showHideButton.setTitle("Hide", for: .normal)
|
||||
} else {
|
||||
passwordTextField.isSecureTextEntry = true
|
||||
showHideButton.setTitle("Show", for: .normal)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func action(_ sender: Any) {
|
||||
self.errorMessageLabel.text = nil
|
||||
|
||||
guard emailTextField.text != nil && passwordTextField.text != nil else {
|
||||
guard let email = emailTextField.text, let password = passwordTextField.text else {
|
||||
self.errorMessageLabel.text = NSLocalizedString("Username & password required.", comment: "Credentials Error")
|
||||
return
|
||||
}
|
||||
@@ -56,8 +67,8 @@ class FeedbinAccountViewController: UIViewController {
|
||||
disableNavigation()
|
||||
|
||||
// When you fill in the email address via auto-complete it adds extra whitespace
|
||||
let emailAddress = emailTextField.text?.trimmingCharacters(in: .whitespaces)
|
||||
let credentials = Credentials(type: .basic, username: emailAddress ?? "", secret: passwordTextField.text ?? "")
|
||||
let trimmedEmail = email.trimmingCharacters(in: .whitespaces)
|
||||
let credentials = Credentials(type: .basic, username: trimmedEmail, secret: password)
|
||||
Account.validateCredentials(type: .feedbin, credentials: credentials) { result in
|
||||
|
||||
self.stopAnimtatingActivityIndicator()
|
||||
|
||||
@@ -437,7 +437,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="iTt-HT-Ane">
|
||||
<rect key="frame" x="98.5" y="11.5" width="217" height="32"/>
|
||||
<rect key="frame" x="20" y="11.5" width="217" height="32"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="accountLocal" translatesAutoresizingMaskIntoConstraints="NO" id="tb2-dO-AhR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="32" height="32"/>
|
||||
@@ -457,11 +457,10 @@
|
||||
</stackView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="iTt-HT-Ane" firstAttribute="leading" secondItem="99i-Ge-guB" secondAttribute="leading" constant="20" symbolic="YES" id="SQw-L4-v2z"/>
|
||||
<constraint firstItem="iTt-HT-Ane" firstAttribute="centerY" secondItem="99i-Ge-guB" secondAttribute="centerY" id="UaS-Yf-Q1x"/>
|
||||
<constraint firstItem="iTt-HT-Ane" firstAttribute="centerX" secondItem="99i-Ge-guB" secondAttribute="centerX" id="hDQ-wH-Myx"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="50" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="56" id="te1-L9-osf" customClass="NNWTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="73" width="414" height="56"/>
|
||||
@@ -471,7 +470,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="7dy-NH-2zV">
|
||||
<rect key="frame" x="134.5" y="12" width="145" height="32"/>
|
||||
<rect key="frame" x="20" y="12" width="145" height="32"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="accountFeedbin" translatesAutoresizingMaskIntoConstraints="NO" id="wyu-mZ-3zz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="32" height="32"/>
|
||||
@@ -492,10 +491,9 @@
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="7dy-NH-2zV" firstAttribute="centerY" secondItem="DgY-u7-DRO" secondAttribute="centerY" id="Flf-2s-zWu"/>
|
||||
<constraint firstItem="7dy-NH-2zV" firstAttribute="centerX" secondItem="DgY-u7-DRO" secondAttribute="centerX" id="OBr-8l-3dF"/>
|
||||
<constraint firstItem="7dy-NH-2zV" firstAttribute="leading" secondItem="DgY-u7-DRO" secondAttribute="leading" constant="20" symbolic="YES" id="H71-Jv-7uw"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="50" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
@@ -660,14 +658,12 @@
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<textInputTraits key="textInputTraits" keyboardType="emailAddress" textContentType="username"/>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" adjustsFontForContentSizeCategory="YES" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="lDh-Kk-Kem">
|
||||
<rect key="frame" x="0.0" y="245" width="414" height="48"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="48" id="pKQ-Mm-Oc8"/>
|
||||
</constraints>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9QD-Wz-fqW">
|
||||
<rect key="frame" x="207" y="381" width="0.0" height="0.0"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/>
|
||||
</textField>
|
||||
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pv5-O6-P6Z">
|
||||
<rect key="frame" x="0.0" y="313" width="414" height="48"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -680,30 +676,41 @@
|
||||
<action selector="action:" destination="byh-sg-6p5" eventType="touchUpInside" id="ZQy-9g-TeU"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9QD-Wz-fqW">
|
||||
<rect key="frame" x="207" y="381" width="0.0" height="0.0"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" adjustsFontForContentSizeCategory="YES" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="2CB-cQ-4G2">
|
||||
<rect key="frame" x="0.0" y="245" width="414" height="48"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="48" id="zSB-P4-U6w"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8D1-Lz-Wsj">
|
||||
<rect key="frame" x="363" y="252.5" width="43" height="33"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<state key="normal" title="Show"/>
|
||||
<connections>
|
||||
<action selector="showHidePassword:" destination="byh-sg-6p5" eventType="touchUpInside" id="INE-vg-mxP"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.93735349178314209" green="0.93682962656021118" blue="0.95681577920913696" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<constraints>
|
||||
<constraint firstItem="2CB-cQ-4G2" firstAttribute="top" secondItem="UiV-th-dQb" secondAttribute="bottom" constant="8" id="0hZ-Nw-bIs"/>
|
||||
<constraint firstItem="UiV-th-dQb" firstAttribute="leading" secondItem="4Rm-PZ-VHc" secondAttribute="leading" id="1ok-W1-dkI"/>
|
||||
<constraint firstItem="2CB-cQ-4G2" firstAttribute="leading" secondItem="4Rm-PZ-VHc" secondAttribute="leading" id="3yY-IH-A6W"/>
|
||||
<constraint firstItem="UiV-th-dQb" firstAttribute="top" secondItem="vFL-2i-eRz" secondAttribute="bottom" constant="20" id="BUG-5p-BDh"/>
|
||||
<constraint firstItem="9QD-Wz-fqW" firstAttribute="top" secondItem="pv5-O6-P6Z" secondAttribute="bottom" constant="20" id="BxD-TQ-zRm"/>
|
||||
<constraint firstItem="4Rm-PZ-VHc" firstAttribute="trailing" secondItem="lDh-Kk-Kem" secondAttribute="trailing" id="CUI-hN-BsR"/>
|
||||
<constraint firstItem="pv5-O6-P6Z" firstAttribute="trailing" secondItem="4Rm-PZ-VHc" secondAttribute="trailing" id="DkX-t4-GH3"/>
|
||||
<constraint firstItem="pv5-O6-P6Z" firstAttribute="leading" secondItem="4Rm-PZ-VHc" secondAttribute="leading" id="Jhs-JE-qWd"/>
|
||||
<constraint firstItem="lDh-Kk-Kem" firstAttribute="top" secondItem="UiV-th-dQb" secondAttribute="bottom" constant="8" id="N81-px-3YV"/>
|
||||
<constraint firstItem="9QD-Wz-fqW" firstAttribute="centerX" secondItem="E6e-jd-9b6" secondAttribute="centerX" id="Sgr-tG-nT2"/>
|
||||
<constraint firstItem="pv5-O6-P6Z" firstAttribute="top" secondItem="lDh-Kk-Kem" secondAttribute="bottom" constant="20" id="UUS-1q-Fn4"/>
|
||||
<constraint firstItem="pv5-O6-P6Z" firstAttribute="top" secondItem="2CB-cQ-4G2" secondAttribute="bottom" constant="20" id="eRp-Xa-TiJ"/>
|
||||
<constraint firstItem="4Rm-PZ-VHc" firstAttribute="trailing" secondItem="UiV-th-dQb" secondAttribute="trailing" id="hfB-Ql-twm"/>
|
||||
<constraint firstItem="vFL-2i-eRz" firstAttribute="top" secondItem="4Rm-PZ-VHc" secondAttribute="top" constant="40" id="khS-vK-fL0"/>
|
||||
<constraint firstItem="lDh-Kk-Kem" firstAttribute="leading" secondItem="4Rm-PZ-VHc" secondAttribute="leading" id="nHZ-XJ-CXN"/>
|
||||
<constraint firstItem="8D1-Lz-Wsj" firstAttribute="centerY" secondItem="2CB-cQ-4G2" secondAttribute="centerY" id="n8e-vR-WRB"/>
|
||||
<constraint firstItem="vFL-2i-eRz" firstAttribute="centerX" secondItem="E6e-jd-9b6" secondAttribute="centerX" id="qew-4G-xhG"/>
|
||||
<constraint firstItem="UiV-th-dQb" firstAttribute="centerX" secondItem="E6e-jd-9b6" secondAttribute="centerX" id="vLa-hN-GpR"/>
|
||||
<constraint firstItem="lDh-Kk-Kem" firstAttribute="centerX" secondItem="E6e-jd-9b6" secondAttribute="centerX" id="zjW-9v-aqJ"/>
|
||||
<constraint firstItem="4Rm-PZ-VHc" firstAttribute="trailing" secondItem="2CB-cQ-4G2" secondAttribute="trailing" id="x8Z-aP-Acy"/>
|
||||
<constraint firstItem="8D1-Lz-Wsj" firstAttribute="trailing" secondItem="2CB-cQ-4G2" secondAttribute="trailing" constant="-8" id="ys5-Ec-EHy"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="4Rm-PZ-VHc"/>
|
||||
</view>
|
||||
@@ -733,12 +740,13 @@
|
||||
<outlet property="cancelBarButtonItem" destination="xVt-VC-XFV" id="yBm-px-sgt"/>
|
||||
<outlet property="emailTextField" destination="UiV-th-dQb" id="fCb-hg-AXa"/>
|
||||
<outlet property="errorMessageLabel" destination="9QD-Wz-fqW" id="Kjo-73-Pgh"/>
|
||||
<outlet property="passwordTextField" destination="lDh-Kk-Kem" id="ew7-Ej-UpK"/>
|
||||
<outlet property="passwordTextField" destination="2CB-cQ-4G2" id="7LV-jP-KMw"/>
|
||||
<outlet property="showHideButton" destination="8D1-Lz-Wsj" id="Uc5-xE-usi"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="l5n-Op-NE2" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="3178" y="139"/>
|
||||
<point key="canvasLocation" x="3176.811594202899" y="138.61607142857142"/>
|
||||
</scene>
|
||||
<!--Timeline Text-->
|
||||
<scene sceneID="07z-Vb-4Fm">
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// AttributedStringView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AttributedStringView: UIViewRepresentable {
|
||||
|
||||
let string: NSAttributedString
|
||||
let preferredMaxLayoutWidth: CGFloat
|
||||
|
||||
func makeUIView(context: Context) -> HackedTextView {
|
||||
return HackedTextView()
|
||||
}
|
||||
|
||||
func updateUIView(_ view: HackedTextView, context: Context) {
|
||||
view.attributedText = string
|
||||
|
||||
view.preferredMaxLayoutWidth = preferredMaxLayoutWidth
|
||||
view.isScrollEnabled = false
|
||||
view.textContainer.lineBreakMode = .byWordWrapping
|
||||
|
||||
view.isUserInteractionEnabled = true
|
||||
view.adjustsFontForContentSizeCategory = true
|
||||
view.font = .preferredFont(forTextStyle: .body)
|
||||
view.textColor = UIColor.label
|
||||
view.tintColor = AppAssets.secondaryAccentColor
|
||||
view.backgroundColor = UIColor.secondarySystemGroupedBackground
|
||||
|
||||
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
view.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class HackedTextView: UITextView {
|
||||
var preferredMaxLayoutWidth = CGFloat.zero
|
||||
override var intrinsicContentSize: CGSize {
|
||||
return sizeThatFits(CGSize(width: preferredMaxLayoutWidth, height: .infinity))
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// PasswordField.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 10/8/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PasswordField: UIViewRepresentable {
|
||||
|
||||
let password: Binding<String>
|
||||
|
||||
func makeUIView(context: Context) -> ShowHidePasswordView {
|
||||
let showHideView = Bundle.main.loadNibNamed("ShowHidePasswordView", owner: Self.self, options: nil)?[0] as! ShowHidePasswordView
|
||||
showHideView.passwordTextField.bindingString = password
|
||||
return showHideView
|
||||
}
|
||||
|
||||
func updateUIView(_ showHideView: ShowHidePasswordView, context: Context) {
|
||||
showHideView.passwordTextField.bindingString = password
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
//
|
||||
// SafariView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 16/6/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import SafariServices
|
||||
|
||||
struct SafariView : UIViewControllerRepresentable {
|
||||
|
||||
let url: URL
|
||||
|
||||
func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
|
||||
let safari = SFSafariViewController(url: url)
|
||||
safari.delegate = context.coordinator
|
||||
return safari
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SafariView>) {
|
||||
//
|
||||
}
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
return Coordinator(self)
|
||||
}
|
||||
|
||||
class Coordinator : NSObject, SFSafariViewControllerDelegate {
|
||||
var parent: SafariView
|
||||
|
||||
init(_ safariView: SafariView) {
|
||||
self.parent = safariView
|
||||
}
|
||||
|
||||
// MARK: SFSafariViewControllerDelegate
|
||||
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
|
||||
|
||||
}
|
||||
|
||||
func safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL) {
|
||||
|
||||
}
|
||||
|
||||
func safariViewController(_ controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// ShowHidePasswordView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 10/8/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
class ShowHidePasswordView: UIView {
|
||||
|
||||
@IBOutlet weak var passwordTextField: BindingTextField!
|
||||
@IBOutlet weak var showHideButton: UIButton!
|
||||
|
||||
@IBAction func toggleShowHideButton(_ sender: Any) {
|
||||
if passwordTextField.isSecureTextEntry {
|
||||
passwordTextField.isSecureTextEntry = false
|
||||
showHideButton.setTitle(NSLocalizedString("Hide", comment: "Hide"), for: .normal)
|
||||
} else {
|
||||
passwordTextField.isSecureTextEntry = true
|
||||
showHideButton.setTitle(NSLocalizedString("Show", comment: "Show"), for: .normal)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class BindingTextField: UITextField, UITextFieldDelegate {
|
||||
|
||||
var bindingString: Binding<String>? = nil
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
delegate = self
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
delegate = self
|
||||
}
|
||||
|
||||
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
if let currentValue = textField.text as NSString? {
|
||||
let proposedValue = currentValue.replacingCharacters(in: range, with: string)
|
||||
bindingString?.wrappedValue = proposedValue
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15508"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ShowHidePasswordView" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="284" height="54"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TT2-5T-DdA">
|
||||
<rect key="frame" x="246" y="12" width="38" height="30"/>
|
||||
<state key="normal" title="Show"/>
|
||||
<connections>
|
||||
<action selector="toggleShowHideButton:" destination="iN0-l3-epB" eventType="touchUpInside" id="DTB-2f-JoB"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Password" textAlignment="natural" adjustsFontForContentSizeCategory="YES" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Iwe-LN-7ZI" customClass="BindingTextField" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="16.5" width="238" height="21"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<textInputTraits key="textInputTraits" secureTextEntry="YES"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="TT2-5T-DdA" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="Buq-YS-fG8"/>
|
||||
<constraint firstItem="TT2-5T-DdA" firstAttribute="leading" secondItem="Iwe-LN-7ZI" secondAttribute="trailing" constant="8" symbolic="YES" id="FIM-1x-LoT"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="TT2-5T-DdA" secondAttribute="trailing" id="b4w-k0-zUR"/>
|
||||
<constraint firstItem="Iwe-LN-7ZI" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="eGg-IF-dp6"/>
|
||||
<constraint firstItem="Iwe-LN-7ZI" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="mUI-zV-GHb"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
||||
<connections>
|
||||
<outlet property="passwordTextField" destination="Iwe-LN-7ZI" id="Tvk-Q4-kHr"/>
|
||||
<outlet property="showHideButton" destination="TT2-5T-DdA" id="1GH-1O-ma0"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="43.478260869565219" y="-127.23214285714285"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// VibrantButtonStyle.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct VibrantButtonStyle: ButtonStyle {
|
||||
|
||||
let alignment: Alignment
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
GeometryReader { geometry in
|
||||
configuration.label
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: self.alignment)
|
||||
}
|
||||
.foregroundColor(configuration.isPressed ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
|
||||
.listRowBackground(configuration.isPressed ? Color(AppAssets.primaryAccentColor) : Color(.secondarySystemGroupedBackground))
|
||||
.background(configuration.isPressed ? Color(AppAssets.primaryAccentColor) : Color(.secondarySystemGroupedBackground))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// VibrantSelectAction.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/15/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct VibrantSelectAction: ViewModifier {
|
||||
|
||||
let action: () -> Void
|
||||
@State var isTapped = false
|
||||
@GestureState var isLongPressed = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
GeometryReader { geometry in
|
||||
content
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .leading)
|
||||
.background(self.isLongPressed || self.isTapped ? Color(AppAssets.primaryAccentColor) : Color(.secondarySystemGroupedBackground))
|
||||
}
|
||||
.foregroundColor(isLongPressed || isTapped ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
|
||||
.listRowBackground(isLongPressed || isTapped ? Color(AppAssets.primaryAccentColor) : nil)
|
||||
.gesture(
|
||||
LongPressGesture().onEnded( { _ in self.action() })
|
||||
.updating($isLongPressed) { value, state, transcation in state = value }
|
||||
.simultaneously(with:
|
||||
TapGesture().onEnded( {
|
||||
self.isTapped = true
|
||||
self.action()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
||||
self.isTapped = false
|
||||
}
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user