Home IOS Development ios – Methods to push one other web page on Xcode programmatically?

ios – Methods to push one other web page on Xcode programmatically?

ios – Methods to push one other web page on Xcode programmatically?


I’m working with one challenge on Xcode with SnapKit and with out storyboard.
I did not contact AppDelegate
I’ve this code on SceneDelegate

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, choices connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(windowScene: windowScene)
        window?.rootViewController = TabBarController()

Venture’s hierarchy like that:

  1. TabBarController
  2. ViewController
  3. HomeCollectionViewCell
  • ShopPage(Group)

  • MessagePage(Group)

  • ProfilePage(Group)

  1. ProfileViewController
  2. SettingsViewController

I need to open SettingsViewController when settingsButton(on ProfileViewController) tupped

That is my code within the TabBarController:

import UIKit

class TabBarController: UITabBarController {

    override func viewDidLoad() {
        selectedIndex = 3
        tabBar.backgroundColor = .systemBackground
        tabBar.tintColor = UIColor(purple: 0, inexperienced: 155/255, blue: 247/255, alpha: 1)
    //MARK: - Tab Setup
    non-public func setupTabs(){
        let residence = self.createNav(title: "Dwelling", picture: UIImage(systemName: "home"), vc: ViewController())
        let store = self.createNav(title: "Store", picture: UIImage(systemName: "bag"), vc: ShopViewController())
        let message = self.createNav(title: "Message", picture: UIImage(systemName: "ellipsis.message"), vc: MessageViewController())
        let profile = self.createNav(title: "Profile", picture: UIImage(systemName: "individual"), vc: ProfileViewController())
        self.setViewControllers([home, shop, message, profile], animated: true)
    non-public func createNav(title: String, picture: UIImage?, vc: UIViewController) -> UINavigationController{
        let nav = UINavigationController(rootViewController: vc)
        nav.tabBarItem.title = title
        nav.tabBarItem.picture = picture
        return nav

That is my code within the ProfileViewController:

class ProfileViewController: UIViewController {
    non-public lazy var settingButton: UIButton = {
        let button = UIButton()
        button.setImage(UIImage(systemName: "gearshape"), for: .regular)
        button.addTarget(self, motion: #selector(openSettings), for: .touchUpInside)
        return button

    override func viewDidLoad() {
        view.backgroundColor = UIColor(purple: 250/255, inexperienced: 250/255, blue: 250/255, alpha: 1)
    @objc non-public func openSettings() {
        let settingsViewController = SettingsViewController()
        navigationController?.pushViewController(settingsViewController, animated: true)

non-public extension ProfileViewController {
    func setupUI() {
    func setupViews() {
    func setupConstraints() {
        settingButton.snp.makeConstraints { make in

However after I tupped settingButton nothing taking place

I attempted to set rootViewController like that on Scene Delegate:
window?.rootViewController = UINavigationController(rootViewController: TabBarController())

Additionally I attempted right here set ProfileViewController as a rootViewController

Additionally I attempted with current methodology:

@objc non-public func openSettings() {
    let settingsViewController = SettingsViewController()
    current(settingsViewController, animated: true)

did’t helped(



Please enter your comment!
Please enter your name here