-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoursesTableViewController.swift
More file actions
81 lines (50 loc) · 1.94 KB
/
CoursesTableViewController.swift
File metadata and controls
81 lines (50 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// CoursesTableViewController.swift
// Developers Academy
//
// Created by Duc Tran on 11/27/15.
// Copyright © 2015 Developers Academy. All rights reserved.
//
import UIKit
import SafariServices
import LocalAuthentication
class CoursesTableViewController: UITableViewController
{
var programs: [NewsFee] = [NewsFee.TotalIOSBlueprint()]
// MARK: - View Controller Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
// Make the row height dynamic
tableView.estimatedRowHeight = tableView.rowHeight
tableView.rowHeight = UITableViewAutomaticDimension
// the first screen of the app
// if walkthroughs haven't been shown, let's show the walkthroughs
}
// MARK: - UITableViewDataSource
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return programs.count
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return programs[section].courses.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier("Course Cell", forIndexPath: indexPath) as! CourseTableViewCell
let program = programs[indexPath.section]
let courses = program.courses
cell.course = courses[indexPath.row]
return cell
}
// MARK: - UITableViewDelegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
}
// MARK: - Show Webpage with SFSafariViewController
}
extension CoursesTableViewController : SFSafariViewControllerDelegate
{
func safariViewControllerDidFinish(controller: SFSafariViewController)
{
controller.dismissViewControllerAnimated(true, completion: nil)
}
}