Using Terminal:
> cd project_root
virtualenv env
source env/bin/activate
| var keyboardHeight : CGFloat = 0 | |
| func textFieldDidBeginEditing(_ textField: UITextField) { | |
| let y = textField.frame.origin.y | |
| let h = self.scrollView.frame.size.height | |
| let margin = h - (keyboardHeight + textField.frame.size.height) | |
| self.scrollView.setContentOffset(CGPoint(x: 0, y: y >= margin ? y - margin : 0), animated: true) | |
| } |
| // Do this next part in the background | |
| DispatchQueue.global(qos: .userInitiated).async { | |
| // Do your time-costly work here | |
| // Return to the main thread to update the UI | |
| DispatchQueue.main.async { | |
| // Perform UI updates here | |
| } |
| let clipboard = UIPasteboard.general | |
| clipboard.string = <#T##string#> |
| extension String: LocalizedError { | |
| public var errorDescription: String? { return self } | |
| } |
| let shortest_date = "M.d.yy" // 1.15.17 | |
| let short_date = "M.d.yyyy" // 1.15.2017 | |
| let full_date = "MMMM d, yyyy" // January 15, 2017 |
| import FacebookCore |
| func tableView(_ tableView: UITableView, willDisplayHeaderView view:UIView, forSection: Int) { | |
| if let headerView = view as? UITableViewHeaderFooterView { | |
| headerView.textLabel?.textColor = .white | |
| } | |
| } |
| extension Dictionary where Key: ExpressibleByStringLiteral, Value:Any { | |
| } |