| import XCTest | |
| // Credits: https://github.com/pointfreeco/swift-composable-architecture | |
| //swiftlint:disable empty_string force_cast force_unwrapping unused_closure_parameter function_body_length | |
| class MyCustomTestCase: XCTestCase { | |
| func assertEqual<T: Equatable>( | |
| expected: T, | |
| actual: T | |
| ) { |
Enlaces para la Bonilista sobre el Dark Mode y sus supuestos efectos en la accesibilidad, la fatiga visual y el consumo de baterias.
| import Foundation | |
| import RealmSwift | |
| import Realm | |
| //Forked from: https://gist.github.com/krodak/b47ea81b3ae25ca2f10c27476bed450c | |
| internal protocol CascadingDeletable: RealmSwift.Object { | |
| static var propertiesToCascadeDelete: [String] { get } | |
| } |
I find the scale of UIPinchGestureRecognizer is confusing, so I did two experiments below, two ways to do the same thing.
gestureRecognizer.scale start with 1.0 at the beginning of pinch (gestureRecognizer.state == .began), and gestureRecognizer.scale in later state (.changed or .end) is always based on that, for example, if the view size is view_size at the beginning of pinch (might not be the same with the original size orig_view_size), gestureRecognizer.scale always starts with 1.0, and if it becomes 2.0 later, it's size will be 2 * view_size, so the scale always based on that when the pinch starts. And we can get the scale at the beginning of pinch (gestureRecognizer.state == .began) lastScale = self.imageView.frame.width/self.imageView.bounds.size.width, so the scale of the original image now should be lastScale * gestureRecognizer.scale
lastScale: The scale of last round of Pinch, a round of Pinch is from state.start to state.end, and the scale is based on the o
| import UIKit | |
| extension UIGestureRecognizer { | |
| @discardableResult convenience init(addToView targetView: UIView, | |
| closure: @escaping () -> Void) { | |
| self.init() | |
| GestureTarget.add(gesture: self, | |
| closure: closure, | |
| toView: targetView) |
| !/bin/sh | |
| SAVEIFS=$IFS | |
| IFS=$(echo -en "\n\b") | |
| FILES=($(git ls-files -m | grep ".*\.swift$" | grep -v ".*R.generated.swift$")) | |
| if [[ ${FILES[@]} ]]; then | |
| export "SCRIPT_INPUT_FILE_COUNT"="${#FILES[@]}" | |
| for i in "${!FILES[@]}"; do | |
| export "SCRIPT_INPUT_FILE_$i"="${FILES[$i]}" | |
| done |
| import UIKit | |
| class TextEditing: UIViewController { | |
| @IBOutlet weak var textView: UITextView? | |
| func updateText(with newString: String?) { | |
| guard let textView = textView, newString = newString, (diffRange, changedText) = diff(textView.text, newString) else { return } | |
| guard let selectedRange = textView.selectedTextRange else { textView.text = newString; return } | |
| textView.text = newString |
| # The trick is to link the DeviceSupport folder from the beta to the stable version. | |
| # sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| # Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| # Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
| # (A similar approach works for older versions too, just change the version number after DeviceSupport) |
| localeIdentifier | Description | |
|---|---|---|
| eu | Basque | |
| hr_BA | Croatian (Bosnia & Herzegovina) | |
| en_CM | English (Cameroon) | |
| rw_RW | Kinyarwanda (Rwanda) | |
| en_SZ | English (Swaziland) | |
| tk_Latn | Turkmen (Latin) | |
| he_IL | Hebrew (Israel) | |
| ar | Arabic | |
| uz_Arab | Uzbek (Arabic) |