Tutorial app with sea mammals

Summary: Tutorial app for iOS. It follows the same theme as its android counterpart.

Reviewed By: passy

Differential Revision: D15184515

fbshipit-source-id: bb473c0fa863bb325bb33f8e42c8d6b3d9c640ff
This commit is contained in:
Pritesh Nandgaonkar
2019-05-03 05:15:15 -07:00
committed by Facebook Github Bot
parent 57af6fa2bf
commit c55bebd1be
10 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
//
// 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(name: "Polar Bear", image: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Ursus_maritimus_4_1996-08-04.jpg/190px-Ursus_maritimus_4_1996-08-04.jpg")!),
MarineMammal(name: "Sea Otter", image: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Sea_otter_cropped.jpg/220px-Sea_otter_cropped.jpg")!),
MarineMammal(name: "West Indian Manatee", image: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/FL_fig04.jpg/230px-FL_fig04.jpg")!),
MarineMammal(name: "Bottlenose Dolphin", image: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Tursiops_truncatus_01.jpg/220px-Tursiops_truncatus_01.jpg")!),
]
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
}
}