5 add sharing file

Original link:current page


Now I need to share the log file with other applications.
Good Lesson from youtube: https://www.youtube.com/watch?v=do1EF3CoO8M

Base on the last wiki 4_add_another_table_view, what you need is just to change the function tableView(tableView, didSelectRowAt indexPath)

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if tableView == self.baseTableView {
            blePeripheral = peripherals[indexPath.row]
            connectToDevice()
        }
 
        if tableView == self.fileTableView {
            print ("click file:\(indexPath.row)")
            let activityVC = UIActivityViewController(activityItems: [fileList[indexPath.row]], applicationActivities: nil)
            activityVC.popoverPresentationController?.sourceView = self.view
 
            self.present(activityVC, animated: true, completion: nil)
        }
    }

  • Last modified: 2019/08/23 12:18