Heat the oil in a heavy large frying pan over medium heat. Add the onions and saute until tender, about 8 minutes. Add the chard and saute until it wilts, about 2 minutes. Add the garlic and saute until fragrant, about 1 minute. Stir in the tomatoes with their juices, wine, and red pepper flakes. Bring to a simmer. Cover and simmer until the tomatoes begin to break down and the chard is very tender, stirring occasionally, about 5 minutes. Season the chard mixture, to taste, with salt and pepper.Meanwhile, bring a large pot of salted water to a boil. Add the spaghetti and cook until tender but still firm to the bite, stirring frequently, about 8 to 10 minutes. Drain the spaghetti. Add the spaghetti to the chard mixture and toss to combine.Transfer the pasta to serving bowls. Sprinkle the olives, cheese, and pine nuts and serve.