I am currently using Xcode 14.2 (14C18), but it has some glitches (which I don't want to enumerate here).
I now want to revert back to an earlier older version. Any suggestions?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I cannot find any docs on this image name but I can select it from the dropdown list in IB. What is the mim macOS version for this name?
I target my project to macOS version 10.10. Now I have an NSStackView in IB and I can set its distribution property in the inspector pane. But there is a yellow warning saying that the distribution property is available only on 10.11+.
My question is - will my app crash if it runs on macOS 10.10?
I submitted a test package and got the following email:
ITMS-90345: Metadata/Info.plist Mismatch - The value for bundle_identifier in the metadata.xml file does not match the value for CFBundleIdentifier in test [net.neolib.test.pkg/Payload/test.app].
I really don't have any idea what's wrong. It's a simple (almost blank) app with nearly no modification (except linked with a dylib).
What is the metadata.xml? I cannot find it in my test project.
I once posted a question in the forums, but it seems I cannot find the thread now (maybe the thread was before the new forums was born).
I don't know why I am so confused about this directive (or whatever):
It looks like a compiler directive because it has a specific syntax.
But it also looks like it's a runtime check because it is used in if statement (not in #if).
So my question is:
Given the following code:
if (@available(macOS 13.0, *) {
NSLog("Running on macOS Ventura or later")
} else {
NSLog("Running on older version before Ventura")
}
Does this directive check real macOS version during runtime?
I am testing with FSEventStreamCreate which returns an FSEventStreamRef, but I cannot find an equivalent toll-free class in Cocoa.
In order to free-up resources used by this Ref, I need to do following:
FSEventStreamStop(stream);
FSEventStreamInvalidate(stream);
FSEventStreamRelease(stream);
That is quite error-prone and tedious. So I want to write a wrapper class, but don't have any idea on when or where to release the Ref. Is it correct to do 'free' in dealloc?
Not sure if it's specific to me only. I tried to build a framework project using Xcode 14.3.1 RC but got a strange error:
File not found: /Users/USERNAME/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a
The project was created several years ago and was upgraded all the way to Xcode 14.2.
I remember last time I posted a question about getting an empty xcarchive when doing archive build. The remedy is quite simple - setting SKIP_INSTALL to no.
I wonder if this problem also has a simple remedy.
I have to admit that this is strange for me. Though I have been using playgrounds for years, but I only write small pieces of code to test simple ideas, and I never used another source file.
Today I want to add a new struct in Sources folder. To my surprise, I am not able to reference the struct in the main playground file.
Sources/testlets.swift:
struct Dummy {
var name: String
}
MyPlayground:
var box = Dummy(name: "abc")
// error: /.../MyPlayground.playground:22:11 Cannot find 'Dummy' in scope
I am trying to encode/decode JSON data, and I have the following code:
struct SomeOrdinaryClass: Decodable {
// ...
}
struct SomeBox<T>: Decodable {
var data: T?
}
But Xcode gives me the following error:
myfile.swift:16:8 Type 'SomeBox' does not conform to protocol 'Decodable'
Is there anyway to overcome this?
I have a need to wrap several kinds of objects into a dictionary say [String: Any?], but how do I tell that the Any? object is all Encodable?
let params: [String: Any?] = ["num": 123, "text": "abc", "obj": encodableobject]
JSONEncoder().encode(params) // compiler error because Any? is not Encodable
In other languages, I usually have a StringBuilder class that provides the functionality to concatenate strings in an efficient way.
// pseudo code
let sb = StringBuilder()
sb.append("text")
sb.appendFormat("name=%@", name)
I am aware of @resultBuilder, but does Swift provide a builtin construct?
This makes my head dizzy! Help me out of this peril.
How to avoid this with my own class objects?
let obj: LanguageItem? = LanguageItem(language: "en")
print("object: \(obj)")
struct LanguageItem: Codable
{
var language: String
var name: String?
}
extension LanguageItem: CustomStringConvertible {
var description: String {
"Lang:\(language) name:\(name ?? "(none)")"
}
}
The print statement still prints "Optional(Lang:en name:(none))". How to get rid the Optional prefix?
I could not find any standard error classes/enums in docs. For example, I have the following error situations:
Invalid null parameter
Parameter value out of range
Property value (of T!) not set
I have the following code:
func numberOfRows(in tableView: NSTableView) -> Int {
switch tableView {
case self.stringsTable:
return self.stringsList?.count ?? 0
case self.localeTable:
return self.localeMap.count
default:
print("numberOfRows not handled for \(tableView)")
return 0
}
}
I wonder if there is any (performance) difference between case and ==== operator like below:
func numberOfRows(in tableView: NSTableView) -> Int {
if tableView === self.stringsTable {
}
// ...
}
I have a checkbox button in a table column (of course in a NSTableCellView).
@IBAction func check_click(_ sender: Any) {
// How do I know in which row this event occurred?
// Once I get the row index I get the associated data item so that I can update the checked state.
}