This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIView { | |
class func computeDampingRatio(tension: CGFloat, friction: CGFloat, mass: CGFloat) -> CGFloat { | |
friction / (2 * sqrt(mass * tension)) | |
} | |
class func animate( | |
withTension tension: CGFloat, | |
friction: CGFloat, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
id.txt example: | |
stringid1 | |
stringid2 | |
... | |
eng.txt example: | |
hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swiftlint:disable all | |
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen | |
{% if tables.count > 0 %} | |
{% set accessModifier %}{% if param.publicAccess %}public {% endif %}{% endset %} | |
import Foundation | |
// swiftlint:disable superfluous_disable_command | |
// swiftlint:disable file_length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Dictionary { | |
func cloneWith(_ dict: [Key: Value]) -> [Key: Value] { | |
var result = self | |
dict.forEach { key, value in result[key] = value } | |
return result | |
} | |
} | |
// usage | |
let dict: [Int: Any] = [1: "abc", 2: "cde"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DVTConsoleDebuggerInputTextColor</key> | |
<string>0.706581 0.741758 0.725335 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>SFMono-Bold - 13.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>0.706581 0.741758 0.725335 1</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Arithmeticable { | |
static func +(lhs: Self, rhs: Self) -> Self | |
static func -(lhs: Self, rhs: Self) -> Self | |
static func *(lhs: Self, rhs: Self) -> Self | |
static func /(lhs: Self, rhs: Self) -> Self | |
static func <(lhs: Self, rhs: Self) -> Bool | |
static func <=(lhs: Self, rhs: Self) -> Bool | |
static func >(lhs: Self, rhs: Self) -> Bool | |
static func >=(lhs: Self, rhs: Self) -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum OptionalError: Error { | |
case noValue | |
} | |
extension Optional { | |
// https://www.swiftbysundell.com/tips/unwrapping-an-optional-or-throwing-an-error/ | |
func orThrow(_ errorExpression: @autoclosure () -> Error = OptionalError.noValue) throws -> Wrapped { | |
guard let value = self else { throw errorExpression() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentViewController: UIViewController { | |
let button: UIButton() | |
... | |
func onTapButton() { | |
let popupVC = PopupViewController() | |
popupVC.onDoneBlock = { [weak self] in | |
self?.moveToNextView() | |
} | |
} | |