Skip to content

Instantly share code, notes, and snippets.

View jazzedge's full-sized avatar

Rocco Labellarte jazzedge

View GitHub Profile
See:https://stackoverflow.com/questions/26791477/xcode-device-locked-when-iphone-is-unlocked
As is mentioned in several answers, the device is locked message is actually referring to the device not trusting the MacBook. In my case, I think my phone defaulted to not trusting my computer after updating to iOS 10. Here are the steps that worked for me to reset the settings (this is the same process that is mentioned in the Apple support page in tehprofessors' answer):
Disconnect your device from your MacBook
On your device go to Settings > General > Reset, then tap Reset Location & Privacy
Plug your device back into your computer, and on the device you will be prompted to trust the computer. Tap trust.
Rebuild in XCode and the device locked error should disappear.
See: https://marcosantadev.com/calayer-auto-layout-swift/
Works when you change orientation
import UIKit
class WelcomeViewController: UIViewController {
var gradientLayer: CAGradientLayer!
See: http://iosrevisited.blogspot.co.uk/2017/10/firebase-cloud-firestore-example-project-swift.html
01. Set up Firebase Cloud Firestore To iOS Project :
pod 'Firebase/Core'
pod 'Firebase/Firestore'
02. Add google plist to project
03. Initialize Firebase in AppDelegate.
import Firebase
import UIKit
extension UIColor {
static func rgbColor(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat = 1.0) -> UIColor {
return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a)
}
}
We couldn’t find that file to show.
Note: I'm not sure this works.
I've found that besides setting device to iPhone X there is one more remedy: turning source control off in Preferences > Source Control > "Enable Source Control".
It looks like if it is not iPhone X, the Interface Builder updates a lot of stuff in file system and all those uneeded changes are also handled by source control managing something.
displayAlertWithTitle(title: "Detected", message: "Edge swipe was detected")
/* Just a little method to help us display alert dialogs to the user */
func displayAlertWithTitle(title: String, message: String){
let controller = UIAlertController(title: title,
message: message,
preferredStyle: .alert)
controller.addAction(UIAlertAction(title: "OK",
See:https://www.hackingwithswift.com/example-code/uikit/how-to-detect-edge-swipes
override func viewDidLoad() {
super.viewDidLoad()
let edgePan = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(screenEdgeSwiped))
edgePan.edges = .left
view.addGestureRecognizer(edgePan)
}
01. Write your UIViewController class like this:
import UIKit
class UserProfileViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.hideKeyboardWhenTappedAround()
addKeyboardObservers()
See: https://stackoverflow.com/questions/31774006/how-to-get-height-of-keyboard-swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var textFieldBottomConstraint: NSLayoutConstraint!
override func viewDidLoad() {