This file contains hidden or 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
// Because Label's size don't match, transition looks weird. | |
import SwiftUI | |
struct FloatingLabelTextField: View { | |
@Namespace private var namespace | |
let placeholder: String | |
@Binding var text: String | |
@State private var isTextFieldFirstResponder: Bool = false |
This file contains hidden or 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 | |
class InputToolbar: UIView { | |
private let separator = UIView() | |
private let button = UIButton(type: .system) | |
private let textField = UITextField() | |
private let sendButton = UIButton(type: .system) | |
func initialize() { | |
backgroundColor = .systemGreen |
This file contains hidden or 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 | |
protocol ScrollingContent: Comparable {} | |
protocol ScrollingContentProvider { | |
associatedtype Content: ScrollingContent | |
func previous(of content: Content) -> Content | |
func next(of content: Content) -> Content | |
} |
This file contains hidden or 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 | |
class ViewController: UIViewController { | |
var yearView: UIView? | |
var currentYear: Int = 2020 { | |
didSet { | |
createYearView() | |
} | |
} |
This file contains hidden or 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 Foundation | |
enum JSON { | |
case null | |
case bool(Bool) | |
case int64(Int64) | |
case double(Double) | |
case string(String) | |
indirect case array([JSON]) | |
indirect case dictionary([String: JSON]) |
This file contains hidden or 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 | |
class ViewController: UIViewController { | |
private var customInput = false | |
private let textInput = UITextField() | |
private var leadingBarButtonGroups: [UIBarButtonItemGroup] = [] | |
private var trailingBarButtonGroups: [UIBarButtonItemGroup] = [] | |
override func viewDidLoad() { | |
super.viewDidLoad() |
This file contains hidden or 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 Foundation | |
class SessionDelegate: NSObject, URLSessionDelegate { | |
func urlSession( | |
_ session: URLSession, | |
didReceive challenge: URLAuthenticationChallenge, | |
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void | |
) { | |
guard challenge.protectionSpace.host != URL.sns.host else { | |
completionHandler(.performDefaultHandling, nil) |
This file contains hidden or 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 Foundation | |
enum TypeKey: CodingKey { | |
case type | |
} | |
protocol TypeFamily: Decodable { | |
associatedtype Member: Decodable | |
var type: Member.Type { get } | |
} |
This file contains hidden or 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 Foundation | |
protocol Zeroes { | |
static var zero: Self { get } | |
} | |
extension Int: Zeroes {} | |
extension Int8: Zeroes {} | |
extension Int16: Zeroes {} | |
extension Int32: Zeroes {} |