关于 SwiftUI State 的一些细节

在 SwiftUI 中,我们使用 @State 进行私有状态管理,并驱动 View 的显示,这是基础中的基础。比如,下面的 ContentView 将在点击加号按钮时将显示的数字 +1: Read more

How to display Vision bounding boxes

I’m using the Vision framework to run an object detection model on iOS but the predicted bounding boxes are not being drawn in the right place. Help! This is a very common problem and it happens because there are several different coordinate systems that you have to translate between. Read more

使用 Property Wrapper 为 Codable 解码设定默认值

本文介绍了一个使用 Swift Codable 解码时难以设置默认值问题,并利用 Property Wrapper 给出了一种相对优雅的解决方式,来在 key 不存在时或者解码失败时,为某个属性设置默认值。这为编解码系统提供了更好的稳定性和可扩展性。 Read more

State of the App: State Surfing

Note that the viewer is entirely generic. It accepts a String description for the action and a Data object holding the app’s state. Clicking a row sends the Data back to the app, which decodes it and resets its state to what it received. Read more

Swift and Visual Studio Code – owensd.io

We’ll be able to start building plug-ins as the product matures to enable all sorts of development, including Swift! Who’d expect Visual Studio to work with Swift? Source: Swift and Visual Studio Code – owensd.io