UWSim can now be used as a library that can be linked to other projects. Doing it is quite straightforward using ROS, since you just have to include the dependency to UWSim into your manifest.xml. The most external API layer is basically composed of two classes: SceneBuilder and ViewBuilder. The former builds a scene graph, taking as input an XML file describing the scene. The latter creates a Viewer or a View. Use the Viewer for the default UWSim viewer, and the View if you want to integrate the UWSim rendering panel into another application (e.g. using Qt, wxWidgets, etc.). Both SceneBuilder and ViewBuilder store public attributes that point towards the deepness of UWSim, e.g. the robots and objects in the scene, the ocean properties, etc.
For instance, the following snapshot shows a grasp planning package that computes a suitable grasp on a point cloud, and uses UWSim as a library for visualization: