WildCat's Blog

钝鸟先飞,大器晚成

Tech & Design enthusiast, helping to create a better world for everyone. Working, collaborating and innovating. Views are my own.


Use SwiftUI in Share Extension

SwiftUI is an effective tool to build user interfaces. Despite its constraints mentioned in my next article, SwiftUI is capable of simple use cases, such as UI in Share Extension.

Interestingly, Apple does not allow to preview SwiftUI in the target Share Extension, showing

UnsupportedProductTypeError: Previews not supported for FooShareExtension

Previews can only be used for files in applications, frameworks, or Swift packages.

productType = com.apple.product-type.app-extension
buildable = FooShareExtension.appex

We can workaround this limitation by creating a new target then add SwiftUI files into this new target. In this new target (framework), we can use live preview for SwiftUI.

最近的文章

Rethinking SwiftUI

SwiftUI has been generally available for almost one year since last summer. After some exploration, I would like to write some thoughts about SwiftUI.Is SwiftUI production ready?Unfortunately, my answer of this question should be “yes and no”, jus...…

继续阅读
更早的文章

Build Rails images efficiently with Docker and GitLab CI: Complete Tutorial in 2019 (Part 1)

BackgroundDocker is an amazing tool for DevOps. It can save considerable amount of time even for a personal project. However, it is not very easy to adapt Docker for a Rails project effectively. Usually we have several problems while dockerizing a...…

继续阅读