Last active
October 17, 2018 01:10
-
-
Save peterkos/b59407a858d3aab5ecef9a6b9672b42f to your computer and use it in GitHub Desktop.
Code written on Week 1 of the iOS Development Workshop, Autumn 2018, w/ Dubstech
This file contains 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
// ----------------------------------------- | |
// Playground Code | |
// ----------------------------------------- | |
import UIKit | |
var str = "Hello, playground" | |
// sayHello() prints "hello, person!" | |
func sayHello() { | |
print("hello, person") | |
} | |
// print "Hello, Peter!" | |
func sayHello(name: String) { | |
print("Hello, \(name)") | |
} | |
sayHello(name: "Peter") | |
func sayHello2(toPerson name: String) { | |
print("Hello, \(name)") | |
} | |
sayHello2(toPerson: "Peter") | |
// - > | |
func sayHello(toPerson name: String) -> String { | |
return "Hello, \(name)" | |
} | |
sayHello(toPerson: "Peter") | |
class Animal { | |
var name: String | |
// Constructor | |
init() { | |
name = "" | |
} | |
} | |
var dog = Animal() | |
dog.name = "Lola 🐕" | |
// ----------------------------------------- | |
// iOS Project Code | |
// ----------------------------------------- | |
// ViewController.swift | |
import UIKit | |
// class ViewController extends UiViewController | |
class ViewController: UIViewController { | |
@IBAction func theButton(_ sender: UIButton) { | |
print("Hello") | |
if let val = sender.accessibilityLabel { | |
print(val) | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment