Summary: Our very own SeaMammal plugin for iOS written in swift Reviewed By: passy Differential Revision: D15199381 fbshipit-source-id: 10b085c314328ff52ae3f5feef51f70d0ce12f1b
33 lines
886 B
Swift
33 lines
886 B
Swift
//
|
|
// ViewController.swift
|
|
// Tutorial
|
|
//
|
|
// Created by Pritesh Nandgaonkar on 5/2/19.
|
|
// Copyright © 2019 Facebook. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class ViewController: UIViewController, UITableViewDataSource {
|
|
let marineMammals: [MarineMammal] = MarineMammal.defaultList
|
|
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
}
|
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return marineMammals.count
|
|
}
|
|
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "MarineMammalCell", for: indexPath)
|
|
guard let mammalCell = cell as? MarineMammalCell else {
|
|
fatalError("Wrong cell identifier")
|
|
}
|
|
mammalCell.populate(marineMammal: marineMammals[indexPath.row])
|
|
return mammalCell
|
|
}
|
|
}
|
|
|