Post not yet marked as solved
Is it possible to deploy SwiftData to server? Or is it a good direction to consider improve SwiftData?
Post not yet marked as solved
Where to download the sample code for WWDC2023 Session 111215 Meet UIKit for spatial computing "Spatial UIKit"?
Post not yet marked as solved
// continuous version
let continuousClock = ContinuousClock()
let continuousElapsed = try await continuousClock.measure {
try await Task.sleep(until: .now + .seconds(5), clock: .continuous)
}
print(continuousElapsed)
// suspending version
let suspendingClock = SuspendingClock()
let suspendingElapsed = try await suspendingClock.measure {
try await Task.sleep(until: .now + .seconds(5), clock: .suspending)
}
print(suspendingElapsed)
result:
0.000126 seconds
5.324980708 seconds
Swift version: Apple Swift version 5.7 (swiftlang-5.7.0.113.202 clang-1400.0.16.2)
Post not yet marked as solved
.safeArea does not work with List [Important]
test with iOS 15 beta 4
struct ListTest : View {
var body: some View {
List {
ForEach((0..<50).reversed(), id: \.self) { index in
Text("\(index)")
.listRowBackground(Color.red)
}
}
.listStyle(.plain)
.safeAreaInset(edge: .bottom, alignment: .center) {
Bar()
}
.navigationBarTitleDisplayMode(.inline)
}
}
struct Bar : View {
var body: some View {
HStack {
Spacer()
VStack {
Text("Bar")
Text("Bar")
Text("Bar")
Text("Bar")
}
Spacer()
}
.background(.bar)
}
}
Post not yet marked as solved
It is ridiculous to use two different versions of Concurrency API for different platforms.
Xcode 13 beta 2 (13A5155e) uses two different versions of Concurrency for iOS and other platforms (e.g. macOS, watchOS, tvOS)!
//
// TestAsyncApp.swift
// Shared
//
//
import SwiftUI
@main
struct TestAsyncApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
@available(iOS 15.0, macOS 12.0, watchOS 8.0, tvOS 15.0, *)
func testAsync() {
#if os(macOS) || os(watchOS) || os(tvOS)
// will trigger error for iOS
Task {
}
Task.detach {
}
#elseif os(iOS)
// will trigger deprecated warning for macOS, watchOS and tvOS
async {
}
asyncDetached {
}
#endif
}
}
Post not yet marked as solved
What does it mean by "Automatic Inflection" and "Detail Scenes" in SwiftUI part of Platform state of the Union?
Post not yet marked as solved
Using Button in ToolbarItem is buggy. I use buttons in bottom toolbar.
It cannot show Text and Icon at the same time.
Developers cannot change the tintColor of these buttons separately.
struct ContentView: View {
var body: some View {
NavigationView {
Text("Hello, world!")
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
Button(action: {}) {
Label("Bookmark", systemImage: "bookmark")
}.accentColor(.green)
Spacer()
Button(action: {}) {
Label("Delete", systemImage: "trash")
}.accentColor(.red)
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
ToolbarItem in the bottomBar cannot show Text and Icon at the same time, and change the tintColor separately.
If I tried it to put a Text and Image into ZStack or HStack, and it will lose the default pointer hover effect in iPad, which is hard to adjust to emulate the default pointer hover effect.
Post not yet marked as solved
If you use `DoubleColumnNavigationViewStyle` with a `NavigationView`struct ContentView: View {
var body: some View {
// Navigation View
NavigationView {
// Master View
MasterView()
}.navigationViewStyle(DoubleColumnNavigationViewStyle())
}
}and in the `MasterView`, you use a NavigationLink in a list with GroupedListStyle`.the NavigationLink aims to push another View into the master column, using `isDetailLink(false)`struct MasterView : View {
var body: some View {
List {
NavigationLink(
destination: EmptyView()
) {
Text("show in master")
}.isDetailLink(false)
}
.listStyle(GroupedListStyle())
}
}Then you'll surprice yourself:1. in Mac Catalyst, if you click the cell "show in master",the `UINavigationController` will automatically push multiple times and go back to the `MasterVIew`.2. in iOS (iPhone and iPad), if you tap the cell "show in master", and then tap "back",the cell "show in master" will be disabled. No effect when you tap the cell again.
Post not yet marked as solved
Access iCloud Documents always shows Error in iOS 13 beta 2Error Domain=NSCocoaErrorDomain Code=512 "“***” couldn’t be copied to “Documents”." UserInfo={NSSourceFilePathErrorKey=/path/to/***, NSUserStringVariant=( Copy ), NSDestinationFilePath=/path/to/***, NSFilePath=/path/to/***, NSUnderlyingError=0x280717f90 {Error Domain=NSPOSIXErrorDomain Code=11 "Resource deadlock avoided"}}Error Domain=NSCocoaErrorDomain Code=256 "Could't open “***”。" UserInfo={NSURL=path/to/***, NSFilePath=/path/to/***, NSUnderlyingError=0x28379ec40 {Error Domain=NSPOSIXErrorDomain Code=11 "Resource deadlock avoided"}}iCloud Documents works fine in macOS, but not work in iOS devices. Shows the same error when acccessing ubiquity items in iCloud Doucments folder.