Переход из приложения на сайт

swift4
ios

#1

У меня есть в приложении меню, там пару кнопок, дак вот, как сделать так чтобы по нажатию, открывался сайт?
Я сильно новичок в разработке)))


#2

Для этого используйте WebKit. Смотрите здесь


#3

я их прописал вот так:
import UIKit

class MenuViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var menuTableView: UITableView!

let Mytitle = ["     Обновить", "     Проверить соединение", "     О программе", "     Поддержка", "     Выйти из учетной записи"]


override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    menuTableView.delegate = self
    menuTableView.dataSource = self
}

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

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = menuTableView.dequeueReusableCell(withIdentifier: "MenuCell") as! MenuTableViewCell
    cell.labelText.text = Mytitle[indexPath.row]
    return cell
}

}
как мне их по отдельности вынуть и присвоить им действие?


#4

Вам нужно делать переход на WebView из menuTableView?


#5
let MyTitle: Dictionary<String, String> = ["Title1": "Url1", "Title2": "Url2", ...]

func tableview(didselectitem) {
     let dict = MyTitle[indexPath.row]
     let urlString = dict.value
}

#6

func tableview(didselectitem) {
тут ошибку показвает
1)Unnamed parameters must be written with the empty name ‘_’
2)Use of undeclared type ‘didselectitem’


#7

Это был лишь пример, полный метод содержит больше параметров.