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
| loginUserNameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | |
| loginUserPasswordTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | |
| @objc func textFieldDidChange(_ textField: UITextField) { | |
| loginButton.enabled = loginUserNameTextField.text.length && loginUserPasswordTextField.text.length | |
| } |
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
| let labelHeight = self.addressLabel.intrinsicContentSize().height | |
| self.mapView.padding = UIEdgeInsets(top: self.topLayoutGuide.length, left: 0, | |
| bottom: labelHeight, right: 0) | |
| UIView.animateWithDuration(0.25) { | |
| //2 | |
| self.pinImageVerticalConstraint.constant = ((labelHeight - self.topLayoutGuide.length) * 0.5) | |
| self.view.layoutIfNeeded() | |
| } |
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
| extension UIColor { | |
| convenience init(rgb: UInt) { | |
| self.init( | |
| red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, | |
| green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, | |
| blue: CGFloat(rgb & 0x0000FF) / 255.0, | |
| alpha: CGFloat(1.0) | |
| ) | |
| } | |
| } |
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
| class var userDateFormatter : NSDateFormatter { | |
| struct Static { | |
| static let instance: NSDateFormatter = { | |
| let dateFormatter = NSDateFormatter() | |
| dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" | |
| return dateFormatter | |
| }() | |
| } | |
| return Static.instance | |
| } |
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 | |
| extension UISearchBar { | |
| var textField: UITextField? { | |
| return self.value(forKey: "_searchField") as? UITextField | |
| } | |
| } |
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 | |
| public extension UIView { | |
| @available(iOS 10.0, *) | |
| public func renderToImage(afterScreenUpdates: Bool = false) -> UIImage { | |
| let rendererFormat = UIGraphicsImageRendererFormat.default() | |
| rendererFormat.opaque = isOpaque | |
| let renderer = UIGraphicsImageRenderer(size: bounds.size, format: rendererFormat) | |
| let snapshotImage = renderer.image { _ in |
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 'package:flutter/material.dart'; | |
| void main() => runApp(App()); | |
| class App extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'My Flutter App', | |
| home: Home(), |
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 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MaterialApp( | |
| title: 'Navigation Basics', | |
| home: FirstRoute(), | |
| )); | |
| } | |
| class FirstRoute extends StatelessWidget { |
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 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', | |
| debugShowCheckedModeBanner: 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 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(new MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { |
OlderNewer