如果我有一个用SwiftUI制作的应用程序,它是否适用于iOS 13以下的iOS?

推荐答案

我刚刚在Xcode 11中判断了它,可以确认它不会向后兼容,从SwiftUI的View实现中可以看出:

/// A piece of user interface.
///
/// You create custom views by declaring types that conform to the `View`
/// protocol. Implement the required `body` property to provide the content
/// and behavior for your custom view.
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
public protocol View : _View {

    /// The type of view representing the body of this view.
    ///
    /// When you create a custom view, Swift infers this type from your
    /// implementation of the required `body` property.
    associatedtype Body : View

    /// Declares the content and behavior of this view.
    var body: Self.Body { get }
}

Swift相关问答推荐

如何取消正在视图修改器中运行的任务

Swift-Can无法在AudioKit中找出简单的麦克风效果-文件链

修改数组中每个类实例的属性

如何在SwiftUI 4+(iOS 16+)中使用新的NavigationStack进行导航

如何增加 NSStatusBar 图像大小?

关闭 SwiftUI TabView 中的子视图

如何为我的项目设置生命周期选项?

Swift计时器未触发

字符串和整数格式的for循环,帮忙!

如何制作一个在 SceneKit 中投射阴影的透明物体?

Pod lib lint 命令找不到 watchos 模拟器

如何在 SwiftUI 中通过按钮点击一次为一个更改设置动画?

判断 Swift 程序是否正在输出到终端

Xcode swift ui 错误KeyPathComparator仅在 macOS 12.0 或更高版本中可用

在 ViewController 的 UICollectionView 中拉取刷新

无法推断泛型参数的参数

快速覆盖属性

使用 phimagemanager 将图像保存到自定义相册?

Swift 2.0 中的 do { } catch 不处理从这里抛出的错误

Swift中方法的弃用和其他属性,如何?