Skip to content

Instantly share code, notes, and snippets.

@kkebo
Last active October 12, 2022 16:45
Show Gist options
  • Save kkebo/72138961ac3bff48e042b80b6ca63478 to your computer and use it in GitHub Desktop.
Save kkebo/72138961ac3bff48e042b80b6ca63478 to your computer and use it in GitHub Desktop.
Xcode Previews 上でプレビューのプロセスがクラッシュするコード (実機だと問題なし) (macOS 12.3 & Xcode 13.3 や iPadOS 15.4 & Swift Playgrounds 4.0.2 で再現することを確認) (Swift 5.7 で修正)
import SwiftUI
// 再現する型: URL, URLError, UUID, Date, Measurement, Locale, some SwiftUI.View
// 再現しない型: String, [Int], [String: Int], some StringProtocol, DispatchQueue, Bundle, Data, DateFormatter, URLSession, JSONEncoder, NSNumber, CGFloat, Decimal, SwiftUI.Text
func foo() async -> URL {
.init(fileURLWithPath: "/")
}
struct ContentView: View {
var body: some View {
Button("Press Me") {
Task { _ = await foo() }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment