Posts

Post marked as solved
6 Replies
1.7k Views
I've looked for a while and maybe it's my search parameters but can't find doing this with Swift (5). An example I've looked at I need to translate somehow ... https://searchcode.com/file/101621017/OpenEmu/OEFileManager.mSo far I've only managed to copy a file,let from_cchar = from.path.cString(using: .utf8)! let to_cchar = to.path.cString(using: .utf8)! let flags: copyfile_flags_t = UInt32(bitPattern: COPYFILE_DATA) let success = copyfile(from_cchar, to_cchar, nil, flags)I need to implement COPY_QUIT but no idea how to reference the file copy ? (will be async)
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
1 Replies
625 Views
Is there a way to store resized images (thumbnails) in a catalog, or is it easier to just save them to a local folder ?
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
5 Replies
810 Views
Using an IBAction ...(_ sender: NSButton) getting the state to change a bool. However setting the state initially whilst populating a table gives oposite results ...@IBAction func addCheckValue(_ sender: NSButton) { let object_row = tableView.row(for: sender) lt state = sender.state func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { ... if let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "identCellAdd"), owner: nil) as? NSTableCellView { if let button = (cell.subviews[0] as? NSButton) { button.state = file.add ? NSControl.StateValue.on : NSControl.StateValue.off } return cellIf the state is on the action's state will be normal 1 on 0 off, but if it is off 1 becomes off and 0 on.
Posted
by Pendragon.
Last updated
.
Post marked as solved
9 Replies
732 Views
My brain is fried from heat, not even sure how to pose the question.I have a class that has a var let's say "var isRunning: Bool = false", within it's parent another class instance with the same var where I want it to be controlled from. If I link the two, initially it's reading the var but changing later has no affect.Sorry, I know this is probably a basic question.
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
6 Replies
591 Views
Using copyfile's flags, I have an example in what I assume is C but no idea what it translates to in Swift ... "flags: Int32 = COPY_ALL" but want to append "flags |= COPY_MOVE" ?
Posted
by Pendragon.
Last updated
.
Post marked as solved
1 Replies
1.5k Views
I'm still not sure when to use [weak self] within closures I do use trailing closures probably more often than I should. This question though, would I need to use it in the case of an Array Filter ?
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
7 Replies
1.5k Views
Is it possible to have an NSAlert show & wait for the result within a DispatchQueue.Global.Async ? Since it needs to be done on the main thread.
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
10 Replies
1.9k Views
I found I need to use Aspect Fit but can't find it anywhere in the IB. Supposedly should be under the Attributes Inspector "Mode" but this doesn't exist. I set the constraints to "Superview" which is a Box an had to set scaling to none otherwise it doesn't fill, programatrically at runtime the image will change and no constant size but doing this resizes the window's width to the new image width. The images are portrait and want to fit into landscape which is why I chose Aspect Fit no Fill.Has it been depricated or am I missing something ?
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
1 Replies
503 Views
Is there a Calendar View to use in a Storyboard or are they custom made ?
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
0 Replies
421 Views
Trying to add constraints to items within subviews, mainly left view. If I set the constraints 0,0,0,0 filling the view, the trailing space keeps messing up to the right view. Anyone had this problem and know how to fix it ?
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
1 Replies
1.1k Views
Is it possible to simulate the "beginSheetModal" (alert or opensavepanel behaviour) when presenting a view controller from a storyboard "storyboard.instantiateController" with "presentAsSheet" to have a completion closure ?
Posted
by Pendragon.
Last updated
.
Post marked as solved
9 Replies
1.1k Views
I have multiple times sorting an array so same code over and over, but I'm wanting to narrow it down to use only one function to sort the array.At the moment using ...if d { self.array.sort(by: { $0.url_path < $1.url_path }) } else { self.array.sort(by: { $0.url_path > $1.url_path }) }Trying something similar to ...func sortArray(d: Bool, arg1: ?, arg2: ?) { if d { self.array.sort(by: { arg1 < arg2 }) } else { self.array.sort(by: { arg1 > arg2 }) } } sortArray(true, ?, ?)
Posted
by Pendragon.
Last updated
.
Post not yet marked as solved
3 Replies
991 Views
Can't pass an "inout" parameter as [AnyOnject] ?I have a func that passes back an array but then set another array as the return, wondering if I can point to that array without the middle man. The type of the in array is determined within the function.
Posted
by Pendragon.
Last updated
.