How to persist layout of commit/diff window in Xcode 12.4 - xcode

In the diff window of Xcode (Source Control -> Commit..., Cmd-Opt-C) is it possible to persist the size of the left navigation section? I like to resize the navigator bar to be able to see the filenames a bit better, but it gets reset at every invocation.

Related

Drag and Drop( ctrl+drag) Problems in Xcode

There are two places within Xcode (version 13.3) where I can't drag and drop anymore.
Trying to move a file to a Group. I have tried just clicking and dragging, control-click, option-click, command-click, none work. Instead of dragging the file, the cursor just moves without the selected/highlighted file and highlights whatever file or group it is hovering over.
Trying to drag a button to a View Controller to make a connection. Instead, a popup window appears with three rows, each with corresponding icon, two lines each (title and object type): View Controller, View, Button. (I can't figure out how to capture that screen since I am already holding the control key and mouse button (track pad) but here is a photo.
Update:. All works fine when using a mouse but these two problems always exist when using the trackpad. I did discover that by pressing the Escape key, I can perform the control-drag (but not move files). I have played with the trackpad settings but have not yet been able to figure out how to get rid of that window that appears.
This popup appears whether I am holding the control, option, or command key.
What xcode version are you using, just tried
#1 is working as expected on my xcode13.0
#2 seems to be working for me too..

Removing/hiding the toolbar tracking separator

I'm working on adding support in my app for full-height sidebars, as introduced in macOS 11.
The trick is, when the window tab bar is visible, I want to turn the full-height sidebar off. The two don't mix well when the sidebar content is different in each window, as it is in my app. See Xcode for an example of what I want to do (View > Show Window Tab Bar). See Preview for an example of what I want to avoid (open two multi-page PDFs and put them in a single tabbed window).
What's working:
I observe the window's tabbedWindows property, and toggle the fullSizeContentView flag in its styleMask accordingly. Thus the window's style updates as needed when I hide and show the tab bar.
What's not working: I need to have a sidebarTrackingSeparator item in my toolbar in order to have some items above the sidebar. But when fullSizeContentView is off, that item appears as a plain separator. I don't want it to be visible at all in that state.
There isn't a straightforward way to hide a toolbar item, especially if it doesn't have a view, which it turns out this one doesn't.
I tried removing the separator item and re-adding it when the window state toggles, but that leads to Cocoa throwing exceptions, complaining that only one tracking item can be registered at a time. This would seem to be a bug, but Xcode manages it somehow.
So how can I properly toggle my window and toolbar state without having that visible separator?
It looks like I've solved the problem by saving the separator item when I see it in toolbarWillAddItem, and then returning it from toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:) to avoid having a new instance created. That way, removing and re-adding the item works without having exceptions thrown.
The last little snag was to not remove and re-add the separator blindly. The window state may have been preserved across app launches, so I needed to not make assumptions about how the window would initially appear.

How to "Update Frame" in Xcode 8

I have updated to Xcode 8.1. Usually when I've miss-edited a Frame that has Auto Constraints, I've pressed on "Update Frame" to revoke my changes. But this option seemed to be gone since the new Update.
How do I update the Frame back to the Auto Constraints value now? Or is the "Update Frame" Option somewhere else now? Help is very appreciated.
In Xcode 8, storyboards have been greatly improved to make what you see on the screen exactly the same as what you would see on the device when you run your app. And even though frames might update as you move things, there's a new handy standalone button to the leftmost side of the button you have selected in your question (it looks like a refresh button).
Theres's a few more options as well:
You can use the keyboard shortcut: Cmd + Opt + =
You can also look for "Update Frames", by going to the toolbar and selecting Editor -> Resolve Auto Layout Issues -> Update Frames.
There is a new Update Frames button at the bottom of the canvas. Click the button to update the frames of the selected objects and their children on the Interface Builder canvas.
Source - https://developerinsider.co/whats-new-in-xcode-8/
Near the Stack button, there is a new "Update frame" button, its just left to the stack button (you can see it in your screenshot)

Xcode menu item Editor / Add Model Version... missing

Every once in a while I try to add a new data model version, and the menu item is missing. It seems the Editor menu is supposed to change depending on the file selected, and this sometimes doesn't happen. It the past I've randomly clicked, cleaned, built, etc. and eventually it showed up again with me not knowing what happened. Today it seems restarting Xcode fixed it, but I don't know if that will always work. Below are two screen shots, the first showing the wrong menu, and the second showing the correct menu. My data model is selected in both cases. Has anyone else seen this? Is it a bug, or is there some setting or selection I'm missing?
From the color of that file navigator bar I can see that you did not select the datamodel file. You probably were in "Assistant Editor"-Mode and had a .h or .m file on the right side. The active cursor was in the right file too.
The selected file shows a darker shade of gray:
The not selected file uses a lighter shade of gray:
It's important to know that the file selection highlight in the left side bar does not change when you select a different file without using the side bar. Don't trust the sidebar when you are editing files.
Click into the data model file first and your menu will be like you expect it.
Unless your are selecting the menu super fast after selecting the file (possibly not giving Xcode time to swap it out) then I say file a bug report http://bugreporter.apple.com
You should give Xcode a few moments to swap the menu out though to determine what kind of bug it is, if it doesn't swap out after 60 seconds or so then it likely isn't just a performance issue). Make sure to include a system profile as I just checked on my and every time I switched to a data model it changed the menu accordingly.
Does the same thing ever happen with xib files? Any other file types you use that sometimes have different menus?

Lion Full Screen menu bar doesn't slide down

I've got a small window that has no borders, titlebar, buttons, etc. I want to support full -screen mode (the new Lion kind) and I basically have all that working -- I can switch into and out of fullscreen mode and the window resizes itself, etc, no problems.
However, when I move the mouse to the top of the screen, the Menu bar with the icon to close the full screen mode does not slide down.
How do I get that working? Is it keyed off a style mask? Something else?
A-ha, the key is in what you return for
- (NSApplicationPresentationOptions)window: (NSWindow *)window willUseFullScreenPresentationOptions: (NSApplicationPresentationOptions)proposedOptions
You need to add NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationHideDock to the returned values in addition to NSApplicationPresentationFullScreen.
The only thing you need to do to make full screen mode work in Lion is to call ‑setCollectionBehavior: on your window and pass in NSWindowCollectionBehaviorFullScreenPrimary.
You don't need to do anything else. All the kiosk-mode stuff is not necessary unless you are targeting 10.6 or earlier.

Resources