Heat the oil in a large skillet. Add the onions. Cook over medium-high heat for 5 minutes. Do not stir. Lower the heat and cook for 20 minutes longer, only stirring to prevent scorching. The onions should be browned and reduced in volume. Add 1/2 cup water and continue cooking for 10 minutes longer. Add the vinegar and sugar. Bring the mixture to a boil and let cook for 15 minutes, stirring often. The onions will achieve a jamlike consistency. Cool to room temperature before serving. Season with salt and pepper to taste.
Preheat the broiler.
Brush the swordfish with oil. Broil for 8 to 12 minutes, or until cooked through. Serve flanked with the onion jam.