-
Install Homebrew The Missing Package Manager for macOS (or Linux) — Homebrew
-
Download Miniforge3
-
Install Miniforge3 and restart your terminal as soon as the installation finishes:
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 | |
/// A UILabel subclass that detects and attempts to fix intrinsicContentSize bugs in UILabel | |
class iOS11CompatibleLabel: UILabel { | |
override var intrinsicContentSize: CGSize { | |
// First attempt at a fix... | |
// All UILabels that misbehave have numberOfLines==0 and preferredMaxLayoutWidth=0 | |
// but all UILabels that have these two properties as 0 do not necessarily misbehave |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil) | |
} | |
@objc func keyboardNotification(notification: NSNotification) { | |
if let userInfo = notification.userInfo { | |
let endFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue | |
let endFrameY = endFrame?.origin.y ?? 0 |
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
// | |
// name the xib file as: "ViewExtendingNibLoadingView.xib" | |
// | |
// let newView = ViewExtendingNibLoadingView() | |
// | |
import UIKit | |
@IBDesignable | |
class NibLoadingView: UIView { |
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
//Simple Type - Person | |
struct Person: Codable { | |
let name: String | |
let age: Int | |
func getString() -> String { | |
return "Name: \(name), Age: \(age)" | |
} | |
} |