Skip to content

BFMarks/Recovery

Repository files navigation

alt text


This is Physical Therapy App I built at a hackathon. Basic tutorial included but happy to add more if there are enough requested!

Live DEMO

alt text

These are the SDK's in the project.

Donate Donations will be put back in tutorials (but please don't feel like it's necessary).

Installation

Install the SDK's by opening terminal to root directory of your project.

pod install

Open the Xcode Workspace (not the project)

Recovery.xcworkspace

alt text

Swift

   func tableView(_ tableView:UITableView, numberOfRowsInSection section:Int) -> Int
    {
        
        return self.contentArray.count
    }

This function sets the number of cells in the Table View. It is typically set to the .count of the number of items in the array that holds the data for each cell.

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    { return cell
    }
    

This function displays the data in each cell. You must have a separate class to contain the cell data, which in this project is TableViewCell.swift.

Lastly, we have the function that plays the video:

 private  func playVideo(video: String) {
        guard let path = Bundle.main.path(forResource: video, ofType:"m4v") else {
            debugPrint("video.m4v not found")
            return
        }
        let player = AVPlayer(url: URL(fileURLWithPath: path))
        let playerController = AVPlayerViewController()
        playerController.player = player
        present(playerController, animated: true) {
            player.play()
        }
    }

The videos in the array are then called with this function: playVideo(video: movArray[indexPath.row]), where movArray is the array holding all of the videos. Typically, you would get all of the video data from the server but this is simply an example app.

This is has been a brief tutorial on how to setup a table View in iOS Swift. Please feel free to ask questions on how the app is build and I will add tutorial points later if needed.