Post

Replies

Boosts

Views

Activity

Xcode 13 beta 2 (13A5155e) uses two different versions of Concurrency for iOS and other platforms (e.g. macOS, watchOS, tvOS)
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     } }
2
0
1.5k
Jun ’21
.safeArea does not work with List [Important]
.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)     } }
0
0
1.1k
Jul ’21
ContinuousClock not working for sleeping
// 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)
1
0
1.1k
Jun ’22
How to write predicate to express not-in for compound index?
For example: SELECT * FROM accounts WHERE (platform, innerID) NOT IN ( ('platform_value1', 'innerID_value1'), ('platform_value2', 'innerID_value2'), ... ); this is hard to use Swift Predicate: func _fetchAccountNotIn(_ scope: [Account]) throws -> [Account] { let scope = scope.map{ ($0.platform, $0.innerID) } return try fetch(.init(predicate: #Predicate<Account> { !scope.contains(($0.platform, $0.innerID)) })) } shows compiler error: Cannot convert value of type '(String, String)' to expected argument type '((String, String)) throws -> Bool' Account definition: @Model public final class Account { #Unique<Account>([\.platform, \.innerID]) #Index<Account>([\.platform, \.innerID]) @Attribute(.preserveValueOnDeletion) public private(set) var platform : String @Attribute(.preserveValueOnDeletion) public private(set) var innerID : String }
1
0
528
Aug ’24
What does it mean by "Automatic Inflection" and "Detail Scenes" in SwiftUI part of Platform state of the Union?
What does it mean by "Automatic Inflection" and "Detail Scenes" in SwiftUI part of Platform state of the Union?
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’21
Xcode 13 beta 2 (13A5155e) uses two different versions of Concurrency for iOS and other platforms (e.g. macOS, watchOS, tvOS)
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     } }
Replies
2
Boosts
0
Views
1.5k
Activity
Jun ’21
.safeArea does not work with List [Important]
.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)     } }
Replies
0
Boosts
0
Views
1.1k
Activity
Jul ’21
ContinuousClock not working for sleeping
// 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)
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’22
Where to download the sample code for WWDC2023 Session 111215 Meet UIKit for spatial computing?
Where to download the sample code for WWDC2023 Session 111215 Meet UIKit for spatial computing "Spatial UIKit"?
Replies
0
Boosts
2
Views
822
Activity
Jun ’23
Consider landing SwiftData to Server?
Is it possible to deploy SwiftData to server? Or is it a good direction to consider improve SwiftData?
Replies
0
Boosts
0
Views
461
Activity
Apr ’24
How to write predicate to express not-in for compound index?
For example: SELECT * FROM accounts WHERE (platform, innerID) NOT IN ( ('platform_value1', 'innerID_value1'), ('platform_value2', 'innerID_value2'), ... ); this is hard to use Swift Predicate: func _fetchAccountNotIn(_ scope: [Account]) throws -> [Account] { let scope = scope.map{ ($0.platform, $0.innerID) } return try fetch(.init(predicate: #Predicate<Account> { !scope.contains(($0.platform, $0.innerID)) })) } shows compiler error: Cannot convert value of type '(String, String)' to expected argument type '((String, String)) throws -> Bool' Account definition: @Model public final class Account { #Unique<Account>([\.platform, \.innerID]) #Index<Account>([\.platform, \.innerID]) @Attribute(.preserveValueOnDeletion) public private(set) var platform : String @Attribute(.preserveValueOnDeletion) public private(set) var innerID : String }
Replies
1
Boosts
0
Views
528
Activity
Aug ’24