XCode: Quick open property list file e.g. info.plist as source code?
Asked Answered
N

3

29

In Xcode you can "quick open" files by selecting File/Open Quickly. When I enter the file name of a plist file, then this file is opened as "Property List". But often I want to open the file as "Source Code". How can I quick open property list files as source code?

Normalcy answered 3/3, 2016 at 10:4 Comment(1)
N
34

The fastest method to open property lists in Xcode as source code is the following:

  • Press ⌘+⇧+o to get the Quick Open Dialog
  • Enter name of property list file e.g. "info.plist" and press "Enter"
  • Open "Version Editor" -> Property List File is shown as source code Opening Version Editor
Normalcy answered 7/3, 2016 at 7:50 Comment(0)
P
25

Hmmm....I don't think you can, unless you set up the Open As > source code commands as a custom behavior with a key binding.

Apple is discouraging opening plists as raw XML. Their guidance on how to deal with .plists is here

I was able to accomplish most of what I needed with that, especially after discovering the trick for showing the actual names of the keys:

Important: The property list editor in Xcode displays human-readable strings (instead of the actual key name) for many keys by default. To display the actual key names as they appear in the Info.plist file, Control-click any of the keys in the editor window and enable the Show Raw Keys/Values item in the contextual menu.

If you still need to see the .plist source, though, there are two ways:

1) show the version editor. The source of the previous and current versions are shown side by side. where to select version editor (double arrow icon)

2) use the file browser... (there should be a way to automate this with Xcode behaviors)

  • Hold the Control key while selecting the file in the file browser.
  • Select 'Open As..'
  • Select 'Source Code'

Screen shot of menu selections

It's certainly not as fast as OpenQuickly, but it does work.

Provisional answered 3/3, 2016 at 22:2 Comment(1)
Many thanks for this detailed answer. Yea, it is possible via file browser, but especially for large projects it would be so great, if one could open info.plist files quickly.Normalcy
V
6

Xcode 12

Right-click Info.plist > Open As > Source Code

Vientiane answered 2/5, 2021 at 2:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.