Skip to content
  • Home
  • Code
  • iOS & Swift
  • Combine
  • RxSwift
  • SwiftUI
  • Flutter & Dart
  • Tutorials
  • Art
  • Blog
Fx Studio
  • Home
  • Code
  • iOS & Swift
  • Combine
  • RxSwift
  • SwiftUI
  • Flutter & Dart
  • Tutorials
  • Art
  • Blog
Written by chuotfx on September 24, 2019

Bắt đầu iOS Project không sử dụng Storyboard với Xcode 11 và Swift 5.1

iOS & Swift

Contents

  • 1. Bắt đầu
  • 2. Thay đổi cấu hình của Application Scene Manifest
  • 3. Sử dụng cấu hình như Xcode 10 (trở về trước)
  • Tổng kết

Với Xcode 11 và Swift 5.1 được Apple phát hành 20/9/2019. Đã có một số thay đổi nhỏ trong setting của Project. Nhiều bạn muốn bắt đầu project bằng cách không sử dụng storyboard thì sẽ gặp một số khó khăn. Bài viết này sẽ hướng dẫn bạn cấu hình nhanh để có thể bắt đầu vọc Xcode 11.

1. Bắt đầu

Mở Xocde 11 > New Project > iOS > Single View App

  • User Interface
    • SwiftUI : project dùng SwiftUI
    • Storyboard : project dùng UIKit

Chúng ta thấy có một vài sự thay đổi nhỏ:

  • SceneDelegate.swift : đây là phần mới, do iOS phải tiến hoá để thích nghi nhiều hơn.

  • Info.plist có thêm cấu hình Application Scene Manifest, nó quy định cấu hình nào được load lúc bắt đầu chạy app.

Oke, bắt đầu với việc xoá các file storyboard.

2. Thay đổi cấu hình của Application Scene Manifest

  • Xoá file Main.storyboard
  • Xoá Main trong Main Interface
  • Xoá file ViewController.swift

 

  • Mở file Info.plist và xoá Storyboard Name trong Application Scene Manifest

 

  • Tạo mới 1 file ViewController

 

  • Mở file SceneDelegate.swift và tiến hành code
    • Tạo mới window
    • Thêm rootViewController
    • Xét visible
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = MyViewController()
        self.window = window
        window.makeKeyAndVisible()
        
    }
  • Run project

 

3. Sử dụng cấu hình như Xcode 10 (trở về trước)

  • Mở file Info.plist và xoá toàn bộ phần Application Scene Manifest
  • Xoá file SceneDelegate.swift
  • Mở file AppDelegate.swift và xoá các function của UISceneSession Lifecycle
  • Edit AppDelegate
    • Thêm biến window
    • Tạo window
    • Thêm rootViewController
    • Xét visible
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.backgroundColor = .white
        let vc = MyViewController()
        window?.rootViewController = vc
        window?.makeKeyAndVisible()
        
        return true
    }
}
  • Run project

 

Tổng kết

  • Tạo project không sử dụng storyboard
  • Có 2 cách cấu hình project
    • Dùng SceneDelegate
    • Không dùng SceneDelegate

Bạn có thể xem lại ở video sau:

Chúc bạn thành công!

FacebookTweetPinYummlyLinkedInPrintEmailShares19

Related Posts:

  • feature_bg_swift_04
    [Swift 6.2] Raw Identifiers - Đặt tên hàm có dấu…
  • POP
    Lập trình hướng giao thức (POP) với Swift
  • feature_bg_blog_035
    Non-Tech Builders 2026: Bùng Nổ Của Prototypes,…
  • Guided Generation
    Guided Generation - Khi Swift type trở thành hợp…
Tags: storyboard, xcode11
Written by chuotfx

Hãy ngồi xuống, uống miếng bánh và ăn miếng trà. Chúng ta cùng nhau đàm đạo về đời, về code nhóe!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Donate – Buy me a coffee!

Fan page

Fx Studio

Tags

Actor Advanced Swift Agentic Coding for iOS AI AntiGravity api Apple Intelligence basic ios tutorial blog ci/cd closure collectionview combine concurrency Context Engineering crashlytics dart dart basic dart tour Declarative delegate design pattern firebase flavor flutter GCD Google Stitch iOS MVVM optional Prompt engineering Prompt for Coding protocol Python rxswift Swift Swift 5.5 SwiftData SwiftUI SwiftUI Notes tableview testing TuiHocAI UI/UX unittest

Recent Posts

  • Tui Học AI – Bài 5 – “Tôi xài AI lẻ tẻ” → “Tôi đóng gói AI thành sản phẩm dùng chung”
  • Prompt Engineering đang được Context Engineering hấp thụ
  • Bắt đầu với Loop Engineering
  • Tui Học AI – Bài 4 – “Tôi dùng AI thủ công” → “Tôi xây hạ tầng để AI tự chạy”
  • Guided Generation – Khi Swift type trở thành hợp đồng với model
  • Foundation Models và “Hello World” trong 10 phút
  • Skill Boundary (P/L/R): dạy kỹ năng biết khi nào nên dừng
  • Context – Cung cấp ít hơn để đạt kết quả tốt hơn
  • Tui Học AI – Bài 3 – “Tôi hỏi AI” → “Tôi quản lý mọi thứ AI nhìn thấy”
  • Đừng xoá hàm này (phần 1)

You may also like:

  • Non-Tech Builders 2026: Bùng Nổ Của Prototypes,…
    feature_bg_blog_035
  • Swift Optional trong 10 phút
    feature_bg_swift_10
  • Clean Architecture trong iOS
    feature_bg_3
  • Regular Expression (Regex) trong Swift
    feature_bg_swiftui_4
  • Giải mã tool poisoning - Vì sao con AI coding tool…
    tool poisoning

Archives

  • July 2026 (4)
  • June 2026 (13)
  • May 2026 (2)
  • April 2026 (5)
  • March 2026 (5)
  • February 2026 (1)
  • January 2026 (10)
  • December 2025 (1)
  • October 2025 (1)
  • September 2025 (4)
  • August 2025 (5)
  • July 2025 (10)
  • June 2025 (1)
  • May 2025 (2)
  • April 2025 (1)
  • March 2025 (8)
  • January 2025 (7)
  • December 2024 (4)
  • September 2024 (1)
  • July 2024 (1)
  • June 2024 (1)
  • May 2024 (4)
  • April 2024 (2)
  • March 2024 (5)
  • January 2024 (4)
  • February 2023 (1)
  • January 2023 (2)
  • November 2022 (2)
  • October 2022 (1)
  • September 2022 (5)
  • August 2022 (6)
  • July 2022 (7)
  • June 2022 (8)
  • May 2022 (5)
  • April 2022 (1)
  • March 2022 (3)
  • February 2022 (5)
  • January 2022 (4)
  • December 2021 (6)
  • November 2021 (8)
  • October 2021 (8)
  • September 2021 (8)
  • August 2021 (8)
  • July 2021 (9)
  • June 2021 (8)
  • May 2021 (7)
  • April 2021 (11)
  • March 2021 (12)
  • February 2021 (3)
  • January 2021 (3)
  • December 2020 (3)
  • November 2020 (9)
  • October 2020 (7)
  • September 2020 (17)
  • August 2020 (1)
  • July 2020 (3)
  • June 2020 (1)
  • May 2020 (2)
  • April 2020 (3)
  • March 2020 (20)
  • February 2020 (5)
  • January 2020 (2)
  • December 2019 (12)
  • November 2019 (12)
  • October 2019 (19)
  • September 2019 (17)
  • August 2019 (10)

About me

Education, Mini Game, Digital Art & Life of coders
Contacts:
[email protected]

Fx Studio

  • Home
  • About me
  • Contact us
  • Mail
  • Privacy Policy
  • Donate
  • Sitemap

Categories

  • Art (1)
  • Blog (99)
  • Code (11)
  • Combine (22)
  • Flutter & Dart (24)
  • iOS & Swift (106)
  • RxSwift (37)
  • SwiftUI (80)
  • Tutorials (111)

Newsletter

Stay up to date with our latest news and posts.
Loading

    Copyright © 2026 Fx Studio - All rights reserved.