If you are a proud owner of a Synology NAS you should think about an efficient and convenient backup strategy. The built-in module „Hyper Backup“ is a good starting point. You can setup up one or several backup sets for your valuable data and can rely on repetitive backups. But where to store the backups? The easiest way is to connect an external hard disk on one of the USB ports to store the backups there. But in case of a big disaster (e.g. a fire or a burglary) your backup may be lost as well. So, it’s a good idea to use two (or more) backup drives and cycle them on a regular basis. The unused drive(s) may be stored on a safe place (e.g. in a different building). Weiterlesen
Restore Window Size on MacCatalyst Apps
Sometimes its easier to just enable MacCatalyst on an iOS app to bring it to the Mac than to fiddle around with a dedicated Mac target or using the Mac version of SwiftUI. The drawback is that you don’t have access to AppKit but have to stick with UIKit / SwiftUI. So some quite useful features of AppKit are not available in MacCatalyst.
E.g. there is this nice AppKit construct to save and restore the window size and position between app launches:
1 |
controller.windowFrameAutosaveName = NSWindow.FrameAutosaveName("MyWindow") |
But there is no equivalent in MacCatalyst since iOS apps don’t mess around with windows. In this post I’ll show how to achieve a similar behaviour in MacCatalyst.
Weiterlesen
An improved version of OutlinePicker
I’ve promised to present an improved version of the OutlinePicker
shown in this post and here it is. What did I do?
- The parameter list changed a little bit. Now there’s a special title for „No Selection“ and we do not need the
isExpanded
parameter anymore since we want to expand the nodes automatically according to the selection. - I’ve introduced the new array
nodesToExpand
. I’ll come back to that a little bit later. - Instead of a sheet the selection view is presented as a popover (
WithPopover
from this post). Using that we do not need a close button anymore. - The NodeOutlineGroup from this post is used to accept the array of expanded nodes.
- Instead of a
Form
I use aList
here with a plainlistStyle
. That looks better in the popover view. - The „No Selection“ section is now separated from the list in a similar manner as a
Divider
would do it in aPicker
view.
An improved version of NodeOutlineGroup
This is the second post of my little series about a fine-tuned version of my OutlinePicker
. Today, I’d like to propose an improved version of the already presented NodeOutlineGroup
. As stated here the NodeOutlineGroup
gives you control whether the disclosure group should be collapsed or expanded on show up of the outline group. I want to use that for my hierarchical picker. But on start of my picker the pre-selected node might be deep in the tree instead of being one of the root nodes.
So, if I set up the picker with all nodes collapsed the pre-selected node would not be visible immediately and the user might search for it for quite a long time. On the other hand, if I expand all nodes it might be quite a big tree to display on startup. The ideal solution would be that all nodes are collapsed except to those ones which have the selected node as a child or grand child.
WithPopover
In this last post I‘ve proposed an OutlinePicker
for SwiftUI. But, to be honest, I am not quite satisfied with this solution. The selection view appears as a sheet in contrast to the standard picker and its layout deserves some more fine tuning.
The problem with the standard popover modifier in SwiftUI is that it’s mutated to a sheet presentation on iPhones. I know, there is this new modifier presentationCompactAdaptation(horizontal:vertical:)
but that’s only available since iOS16.4. In addition, I want to use a List
in the popover and that’s collapsed to a tiny square if you do not specify a frame size. To make a long explanation short: I prefer to use the nice utility view „WithPopover
“ for the presentation of my picker selection.