Quando o nginx estiver com erro de permissão para acessar localhost, rode este comando:
/usr/sbin/setsebool httpd_can_network_connect true
| import Foundation | |
| import UIKit | |
| extension UIView { | |
| func bindToKeyboard() { | |
| NotificationCenter.default.addObserver(self, selector: #selector(UIView.keyboardWillChange(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) | |
| } | |
| @objc func keyboardWillChange(_ notification: NSNotification) { | |
| let duration = notification.userInfo![UIKeyboardAnimationDurationUserInfoKey] as! Double |
| class EventEmitter | |
| /// Shared Instance. | |
| public static var sharedInstance = EventEmitter() | |
| // ReactNativeEventEmitter is instantiated by React Native with the bridge. | |
| private static var eventEmitter: ReactNativeEventEmitter! | |
| private init() {} |
Quando o nginx estiver com erro de permissão para acessar localhost, rode este comando:
/usr/sbin/setsebool httpd_can_network_connect true
| { | |
| "workbench.colorTheme": "Hop Light", | |
| "workbench.iconTheme": "material-icon-theme", | |
| "workbench.fontAliasing": "antialiased", | |
| "window.zoomLevel": 1.2, | |
| // Pre VS Code 1.15 | |
| "emmet.syntaxProfiles": { | |
| "javascript": "jsx" | |
| }, |
| // add this code before all: | |
| process.on('uncaughtException', function(err) { | |
| console.error(err.stack); | |
| console.log('UNCAUGHT_EXCEPTION: ' + err); | |
| }); |
| func getAppVersion() -> String? { | |
| if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { | |
| return version | |
| } | |
| return nil | |
| } |
| private func createTempFile(_ file: Data) throws -> URL { | |
| let dir = NSTemporaryDirectory() | |
| let fileName = NSUUID().uuidString | |
| let url = NSURL.fileURL(withPathComponents: [dir, fileName])! | |
| try file.write(to: url) | |
| return url | |
| } |
| extension MyViewController: UITextFieldDelegate { | |
| func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
| guard let text = textField.text else { return true } | |
| let newLength = text.characters.count + string.characters.count - range.length | |
| return newLength <= 30 // replace 30 for your max length value | |
| } | |
| } |