Skip to content

Instantly share code, notes, and snippets.

let someNumber = 150
switch someNumber {
case 0...50:
print("Number is between 0 & 50")
case 51...100:
print("Number is between 51 & 100")
case 101...150:
print("Number is between 101 & 150")
default:
func parseJSON () {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error ) in
guard error == nil else {
print("returned error")
return
}
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
func parseJSON () {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
}
func parseJSON () {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error ) in
}
}
func parseJSON () {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error ) in
guard error == nil else {
print("returned error")
return
}
func parseJSON () {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error ) in
guard error == nil else {
print("returned error")
return
}
import UIKit
class ViewController: UIViewController {
var tableArray = [String] ()
...
if let array = json["companies"] as? [String] {
self.tableArray = array
}
print(self.tableArray)
func parseJSON() {
let url = URL(string: "https://api.myjson.com/bins/vi56v")
let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
guard error == nil else {
print("returning error")
return
}