I am new to Swift. I created a second swift file call DeviceInfo.swift and add a UIViewcontroller in Main.storyboard.
I also add a UITableView in UIViewcontroller(DeviceInfo).
But the error Use of undeclared type 'UITableView' show after I connect the UITableView to DeviceInfo.swift via command + left. The error show like the following.

Question
1. Why the Use of undeclared type 'UITableView' happened ? How to solve it ?
2. Show I connect the dataSource and delegate to UIViewcontroller(DeviceInfo)?
Thanks in advance.
1.import UIKit
2.To connect delegate and dataSource,
click the point and drag to your tableView.

You need to add import UIKit at the top of your file, in the area where you've already got import Foundation. Without UIKit imported, your object doesn't know what a UITableView is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With