UML class diagrams
AppCode lets you generate UML diagrams for Objective-C and Swift. The diagrams help you analyze the structure of your application by showing types, their connections, methods, and fields.
View class diagram
In the Project tool window, right-click a file for which you want to create a diagram and select ⌃ ⌥ ⇧ U or (⌃ ⌥ U).
In the editor, place the caret at the symbol that you want to show on a diagram and from the context menu, select
.
View local changes as a diagram
You can use the UML Class diagram to evaluate how your local code changes affect the application.
From the context menu of the code editor, the Project tool window, or the Local Changes view, select , or press ⌃ ⌥ ⇧ D.
The diagram opens in a popup. You can double-click a node to view changes in a Differences viewer.
To view changes in revisions as a UML Class diagram, in the History tab of the Version Control tool window, select the desired revision and select Show Diff as UML from the context menu or press ⌃ ⇧ D.
Navigation in UML diagrams
Find a diagram element
In the diagram editor, press ⌃ F12.
In the list that opens, select an element you want to navigate to:
Show implementations
Select a type on the diagram.
Press ⌃ ⌥ B or select Show Implementations from the context menu:
Jump to source code
Select a diagram element that you want to open in the code editor.
Press F4 or select
from the context menu:
Analyze class diagram
To see the list of methods, fields, and other code elements, select the appropriate icon on the diagram toolbar located on top of the diagram editor.
The lists are displayed based on the selected visibility level, which you can change.
To save the diagram as a file, right-click the diagram editor and from the context menu, select
and then the file extension in which you want to save the diagram.Manage class diagram
When working with diagrams, use the context menu in the diagram editor to perform different tasks. You can view members of a type, delete types, see implementations, check parent types, and so on.
Select elements in a diagram
To select an element, click it in diagram.
To select multiple adjacent elements, keep Shift pressed and click the desired elements, or just drag a lasso around the elements to be selected.
To select multiple non-adjacent elements, keep Ctrl+Shift pressed and click the desired elements.
To select a class member, double-click the class element, and then use the arrow keys, or the mouse pointer.
Delete a node element from the diagram
In the diagram editor, select a node element you want to delete.
Right-click the element and from the context menu, select Delete ⌦.
Configure diagram settings
You can configure the diagram settings so that you have certain options available by default when you create a diagram.
Click on the toolbar.
In the right-hand pane, select the options that you want to see by default and click OK to apply your changes.
Analyze graph
The Analyze Graph action group lets you analyze the graph in various ways such as perform auto clusterization, measure the node centrality, search cycles, filter path between two nodes, and so on.
Filter paths between two nodes
Most of the time, generated diagrams are big and complicated. Typically, you want to concentrate only on the specific part of the diagram. AppCode lets you filter paths between two diagram elements.
In the diagram editor, select two nodes on which you want to focus and right-click one of them to open the context menu.
From the context menu, select Analyze Graph | Focus on Paths between Two Nodes.
In the dialog that opens, select additional options if needed and click Find.
AppCode displays connections associated only with the selected nodes.
Measure diagram centrality
You can use this action to identify the important nodes in the graph.
In the diagram editor, right-click anywhere in the editor to open the context menu.
From the context menu, select Analyze Graph | Measure Centrality.
In the dialog that opens, select additional options if needed and click Measure.
The node "importance" is expressed via fractional value from 0.0 to 1.0 measurement and the brightest node selection should be explored first.
Productivity tips
- Enable the diagram preview
Open the Structure tool window ⌥ 7 and drag the shadow area to obtain the desired view. Select one or more nodes in the diagram to highlight the corresponding nodes in the preview area.
- Manage diagram layout
Right-click the diagram background, and choose
from the context menu. Then select the desired layout from the submenu. To apply the selected layout, click on the diagram toolbar.Alternatively, drag entities in the diagram manually to achieve the desired layout.
- Zoom in and out
Use any of the following techniques:
Click and on the diagram editor toolbar.
Keeping Ctrl pressed, rotate your mouse wheel.
Press NumPad+ or NumPad-.
- Use the magnifier tool
Keeping Alt pressed, hover your mouse pointer over diagram areas.