Post

Replies

Boosts

Views

Activity

Comment on Usable screen space in a Mac
this line      usableHeight = NSMenu.menuBarVisible() ? totalHeight - 23 : totalHeight      uses ternary operator ; is a condensed form of it then else.  It is equivalent to:     if NSMenu.menuBarVisible() { usableHeight = totalHeight - 23 } else { usableHeight = totalHeight }. Swift programming language explains « The ternary conditional operator is a special operator with three parts, which takes the form question ? answer1 : answer2. It is a shortcut for evaluating one of two expressions based on whether question is true or false. If question is true, it evaluates answer1 and returns its value; otherwise, it evaluates answer2 and returns its value. ». It is very convenient when you have to set a value depending on condition. For instance let color = (score < 10) ? UIColor.red : UIColor.green
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Comment on Fetch Core Data Issue
Please tell exactly where you stand now: are the favorites saved corectly ? What are all print output you get when you restart the app ? ANd provide more precise output with          print("There are favourites", prefArr.count)
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21