SwiftUI-实现TableView的功能(1)

本文介绍了如何使用SwiftUI的List来实现TableView功能,从SceneDelegate开始,详细展示了数据源的创建、自定义Cell以及通过NavigationLink实现页面跳转的过程,提供了完成目标的Demo链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

相信聪明的小伙伴已经开始对SwiftUI下手了吧。我这个后知后觉的现在才开始摸索,记录一下自己学习的过程。有方向才能发力。

先来学习一下最最最最常用的TableView吧。

首先SwiftUI的入口从AppDelegate更换到了SceneDelegate,其实也很简单

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
        // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
        // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

        // Create the SwiftUI view that provides the window contents.
        let contentView = ContentView()

        // Use a UIHostingController as window root view controller.
        if let windowScene = scene as? UIWindowScene {
            let window = UIWindow(windowScene: windowS
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值