Skip to content

Instantly share code, notes, and snippets.

View EricGustin's full-sized avatar
🌎
I wonder how long my GitHub status can be before it tells me that I can't type a

Eric Gustin EricGustin

🌎
I wonder how long my GitHub status can be before it tells me that I can't type a
View GitHub Profile
import UIKit
class ViewController: UIViewController {
var textField: UITextField?
override func viewDidLoad() {
super.viewDidLoad()
// Setup the textField
// Setup the textField delegate so that the keyboard will show once clicked
textField?.delegate = self
extension ViewController: UITextFieldDelegate {
// Called when the user clicks return
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
// Make keyboard disappear
textField.resignFirstResponder()
return true
}
}
import UIKit
class ViewController: UIViewController {
var textField: UITextField?
override func viewDidLoad() {
super.viewDidLoad()
// Setup the textField
func sceneDidEnterBackground(_ scene: UIScene) {
// Enter your code here to be executed when the app enters the background
print("App entered background")
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Enter your code here to be executed whenever the app comes into the foreground
print("App entered foreground")
}
import UIKit
class ViewController: UIViewController {
private var mainScrollView: UIScrollView!
private var profilePicturesScrollView: UIScrollView!
private var profilePicturesContainer: UIView!
private var profilePictures = [UIImageView]()
override func viewDidLoad() {
import UIKit
class ViewController: UIViewController {
var scrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
// Set the scrollView's frame to be the size of the screen
import UIKit
class ViewController: UIViewController {
var scrollView: UIScrollView!
var images = [UIImageView]()
override func viewDidLoad() {
super.viewDidLoad()
import UIKit
class ViewController: UIViewController {
private var label: UILabel = {
let label = UILabel(frame: CGRect(x: 0, y: UIScreen.main.bounds.height/2, width: UIScreen.main.bounds.width, height: 50))
label.textAlignment = .center
label.text = "No Storyboard!"
return label
}()