Post

Replies

Boosts

Views

Activity

Reply to Sorting a NSTableView in Swift
You want to implement ? optional func tableView(_ tableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor]) Could this help ? https://stackoverflow.com/questions/54595860/nstableview-better-solution-for-sorting-collection-with-nssortdescriptor
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to crash: failed to determine navigation direction for scroll
That is a problem of "conflict" between the 2 gestures. have a look here on solutions (in your case, not a TableView but CollectionView, but very similar): https://stackoverflow.com/questions/31977977/ios-uipageviewcontroller-failed-to-determine-navigation-direction Apple told me that the UIScrollViewin the UIPageViewController and the one in the UITableViewController were conflicting, causing this bug. All I did was put a UIPanGestureRecognizer on the whole view, and whenever the user scrolls up or down, the UIScrollView in the UIPageViewController is disabled, allowing the user to scroll through the UITableView without conflicts or crashing. When the user stop scrolling up or down, the UIScrollView of the UIPageViewController is re-enabled.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Why no need of parenthesis to access nested class?
You have defined Second inside One. So, when you call One.Second(), you just create an instance of Second ("prefixed" by One). You don't have to create an instance of One. You do the same when you call from a framework:           let vc = UIKit.UIViewController() which is equivalent to           let vc2 = UIViewController() One just tells that we look for Second() inside this class.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to change user input text to Int for computation
When you have a String, you convert to num with: let str = "12" let num = Int(str) ?? 0 or let numDouble = Double(str) ?? 0.0 So, in your case, you have to get the text of the label with myLabel.text and then convert. Important to note that Int() or Double() can fail: if you pass "Hello" instead of "12", this cannot be converted to Int (or Double). Hence you get a nil value. So, result of Int() is an optional. You could unwrap with let num = Int(str)! but that is very risky: app will crash if your text is not an Int. So you can use the ?? (nil coalescing operator): if result is nil, then you give the value after ?? otherwise you unwrap (safely) and get an Int or Double (and not an optional). Don't hesitate to ask if something is not clear. Otherwise, don't forget to close the thread by marking the correct answer.
Mar ’21
Reply to How to prevent Critical Alerts from cutting out a call
Critical alerts are just done for that: have precedence over everything else. So it is normal it interrupts Teams audio. But surprising that you are forced to relaunch Teams to get audio back. What your app's users could do is turn off critical alerts for your app during the time of a Teams meeting for instance. But if you got an entitlement for critical alert, there must be some serious reason (and thus risky to stop them). May read this: https ://www.howtogeek. com/412925/what-are-critical-alerts-on-iphone-and-ipad-and-how-do-i-enable-them/
Mar ’21
Reply to LaunchScreen Storyboard with NS Vue + xCode
Im wondering if it's impossible to make the launchscreen storyboard showing on several simulators and devices these days I don't understand the question. What do you want to do ? That's not clear. In Xcode: Launchscreen shows on any simulator you select in Xcode as the active Scheme. What is it you cannot do ? In VS, that's a question for VS.
Apr ’21