Post

Replies

Boosts

Views

Activity

Reply to Having trouble using Darwin Notifications
Have you checked the doc of CFNotificationCenterGetDarwinNotifyCenter? Discussion ... As with distributed notifications, the main thread's run loop must be running in one of the common modes (usually kCFRunLoopDefaultMode) for Darwin-style notifications to be delivered. Please try adding CFRunLoopRun(); at the end of your code: int main(int argc, const char * argv[]) { // Add Observer CFNotificationCenterAddObserver( CFNotificationCenterGetDarwinNotifyCenter(), //center NULL, //observer myCallback, //callback CFSTR("sanity_check"), //event name NULL, //object CFNotificationSuspensionBehaviorDeliverImmediately ); // Post notification 1 CFNotificationCenterPostNotification( CFNotificationCenterGetDarwinNotifyCenter(), // center CFSTR("sanity_check"), // event name NULL, //object NULL, //userinfo dictionary true ); // Post notification 2 notify_post("sanity_check"); CFRunLoopRun(); //<- return 0; }
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’21
Reply to filter an object array based on another
It is not clear enough, but you can prepare some extension like this: extension Selected { func matches(_ option: Option) -> Bool { //↓Modify the following expression to fit for your purpose return optType == option.optType && optValue == option.optValue } } And then: Button("Options Not Selected") { let optionsNotSelected = options.filter { option in !selected.contains {$0.matches(option)} } print(optionsNotSelected) //Use `optionsNotSelected`... }
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to NavigationLink Issue on Device
An interesting behavior. When I tested your code on my iPhone 7 Plus (iOS 14.8.1), the links were not shown. Also tried embedding in VStack & HStack I usually use ZStack when I want some hidden NavigationLinks. NavigationView { ZStack { NavigationLink(destination: SettingsView(), tag: "Settings", selection: $selection) { EmptyView() } NavigationLink(destination: AppInfoView(), tag: "Info", selection: $selection) { EmptyView() } VStack{ GameUIView() HStack{ //... } } } } .navigationViewStyle(StackNavigationViewStyle()) //...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to How can i run App and Scene on ipad SwiftUI playground
In your code (when you show your code, please show all the code as text), Welcoming is an App, not a View. To use setLiveView, the target needs to be a View. And there's no support showing App or Scene as live in PlaygroundPage of the current (3.4.1) Swift Playgrounds. (Swift Playgrounds 4 is expected to come late this year.) You may need to create a view to use setLiveView. struct ContentView: View { var body: some View { TabView { Text("one") Text("tow") } } } PlaygroundPage.current.setLiveView(ContentView())
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to Agreements
It is not clear enough, but you may need to visit the Agreements, Tax, and Banking page of App Store Connect. (Not the Account page of the developer site, which was shown in some notifications in case of me.)
Topic: App & System Services SubTopic: StoreKit Tags:
Nov ’21
Reply to Axie Infinity
This is not a place to request an invitation code of some specific app. Contact to the author of the app.
Nov ’21
Reply to Center item in custom UICollectionView that scrolls both directions
In most of the APIs imported into Swift, bit position based flags such as UICollectionViewScrollPositionCenteredHorizontally is not Int. So, bitwise operator like | would not be applicable. UICollectionViewScrollPosition flags seems to be wrapped into a struct called UICollectionView.ScrollPosition which conforms to OptionSet protocol. When you use OptionSet constants, you need to write them in Set-like notations. Please try something like this:         theCollection.scrollToItem(at: thePath, at: [.centeredVertically,.centeredHorizontally] , animated: true)
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’21
Reply to Having trouble using Darwin Notifications
Have you checked the doc of CFNotificationCenterGetDarwinNotifyCenter? Discussion ... As with distributed notifications, the main thread's run loop must be running in one of the common modes (usually kCFRunLoopDefaultMode) for Darwin-style notifications to be delivered. Please try adding CFRunLoopRun(); at the end of your code: int main(int argc, const char * argv[]) { // Add Observer CFNotificationCenterAddObserver( CFNotificationCenterGetDarwinNotifyCenter(), //center NULL, //observer myCallback, //callback CFSTR("sanity_check"), //event name NULL, //object CFNotificationSuspensionBehaviorDeliverImmediately ); // Post notification 1 CFNotificationCenterPostNotification( CFNotificationCenterGetDarwinNotifyCenter(), // center CFSTR("sanity_check"), // event name NULL, //object NULL, //userinfo dictionary true ); // Post notification 2 notify_post("sanity_check"); CFRunLoopRun(); //<- return 0; }
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Combining More Than Four @Published Variables in Combine?
You can write it a little more compact: $variable0 .combineLatest($variable1, $variable2, $variable3) .combineLatest($variable4, $variable5) .sink { completion in } receiveValue: { (tuple, v4 ,v5) in let (v0, v1, v2, v3) = tuple }.store(in: &cancellables)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Current Links for OS Version DLs?
Searching with "apple old macos", I can find this article. How to get old versions of macOS (Part of Apple Support pages.) Better read the instructions in it carefully and follow the link in the part Use Safari to download macOS on your Mac
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to filter an object array based on another
Option and Selected are different types. How can you judge if an Option exist in the selected Array? Compare userCode? Compare optType? Compare optValue? Or some other way?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to filter an object array based on another
It is not clear enough, but you can prepare some extension like this: extension Selected { func matches(_ option: Option) -> Bool { //↓Modify the following expression to fit for your purpose return optType == option.optType && optValue == option.optValue } } And then: Button("Options Not Selected") { let optionsNotSelected = options.filter { option in !selected.contains {$0.matches(option)} } print(optionsNotSelected) //Use `optionsNotSelected`... }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Vision : VNDetectRectanglesRequest Error in iOS15
Can you show a complete code to reproduce the issue?
Topic: Machine Learning & AI SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Putting a UITextInput and UITextView in a Container or UITableView?
In UIKit, UITextInput is just a protocol and is not a UI component to put into some container. Are you confused with something else?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to NavigationLink Issue on Device
An interesting behavior. When I tested your code on my iPhone 7 Plus (iOS 14.8.1), the links were not shown. Also tried embedding in VStack & HStack I usually use ZStack when I want some hidden NavigationLinks. NavigationView { ZStack { NavigationLink(destination: SettingsView(), tag: "Settings", selection: $selection) { EmptyView() } NavigationLink(destination: AppInfoView(), tag: "Info", selection: $selection) { EmptyView() } VStack{ GameUIView() HStack{ //... } } } } .navigationViewStyle(StackNavigationViewStyle()) //...
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to How can i run App and Scene on ipad SwiftUI playground
In your code (when you show your code, please show all the code as text), Welcoming is an App, not a View. To use setLiveView, the target needs to be a View. And there's no support showing App or Scene as live in PlaygroundPage of the current (3.4.1) Swift Playgrounds. (Swift Playgrounds 4 is expected to come late this year.) You may need to create a view to use setLiveView. struct ContentView: View { var body: some View { TabView { Text("one") Text("tow") } } } PlaygroundPage.current.setLiveView(ContentView())
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to How to add a file in the the app’s main bundle ?
You just need to add a new SpriteKit Scene file in your project. (sks stands for SpriteKit Scene, I think.)
Replies
Boosts
Views
Activity
Nov ’21
Reply to Agreements
It is not clear enough, but you may need to visit the Agreements, Tax, and Banking page of App Store Connect. (Not the Account page of the developer site, which was shown in some notifications in case of me.)
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Axie Infinity
This is not a place to request an invitation code of some specific app. Contact to the author of the app.
Replies
Boosts
Views
Activity
Nov ’21
Reply to NSKeyedArchiver
Can you show the details of pruneTableP2? Especially its type?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Center item in custom UICollectionView that scrolls both directions
In most of the APIs imported into Swift, bit position based flags such as UICollectionViewScrollPositionCenteredHorizontally is not Int. So, bitwise operator like | would not be applicable. UICollectionViewScrollPosition flags seems to be wrapped into a struct called UICollectionView.ScrollPosition which conforms to OptionSet protocol. When you use OptionSet constants, you need to write them in Set-like notations. Please try something like this:         theCollection.scrollToItem(at: thePath, at: [.centeredVertically,.centeredHorizontally] , animated: true)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Beta test
You may need to contact to the author of the app.
Replies
Boosts
Views
Activity
Nov ’21