I am a huge fan of spinach after Popeye! It packs a flavorful punch as a side dish and a main course dish. But somehow whenever I try to make a halva out of spinach I fail badly. Either spinach loses its punch or else it gets all bitter. How do we make spinach taste sweet but at the same time not lose all of its flavors? Also I intend to lose the astringent-y after taste that spinach has.
So, there's maybe a few things I found to reduce the astringency or bitterness of spinach. If you can reduce the bitterness to a flavor you like first, rather then relying on the sugar to mask or balance astringency (which it doesn't hide so much) - you can probably end up with a better dessert.
One thought is that blanching the spinach will help counter bitterness. briefly boil your washed spinach, and discard the water. If you're intending to further cook the spinach afterwards (as in making a fruit-based halwa), cold shocking it might not be needed - It's possible that discarding the water will be enough, though of course you can try with and without the cold shock to see what works for you.
Another thing is astringency can be countered or hidden by soaking in different substances - Adding a bit of milk or fats to your final recipe (as in some of the fattier nut-style halwas) should help balance a little bitterness, Pre-soaking the spinach in milk and discarding might work to draw out some of the astringency. Soaking in food grade lime or absorbic acid like lemon juice or vitamin C, might also work.
Another option is to consider the source of your spinach - fresh baby spinach (for example) will likely not have as much of the bitterness in it to begin with, compared to a cooked full grown spinach. Baby spinach is mild enough to be eaten straight in a salad, mild enough that it might even be candied, like rose petals, for a garnish after your dish is complete.
You might also consider whether the spinach will work better as a flavoring agent or as a bulk agent in your halwa - many fruit based halwas (which seems the easiest method) simply stew the fruit with sugar for a long cooking period, so you need to make sure the spinach as a whole is not going to turn bitter or change while cooking. Other types of halwa may use different ingredients, for different effects - a jelly based or nut-based halwa might easily be flavored with spinach juice... juice which can be extracted at any point along the process, from raw to well-boiled. Leaving the solids behind may help reduce unwanted flavors - or just make the juice more controllable (that is, extract the juice when it is a flavor you like, and the lack of the rest of the plant might keep it form changing overmuch).
You might even consider pairing your spinach with another fruit or vegetable, something complementary or neutral for the bulk removed if you go the juice route - something mild and vegetal might mellow the spinach taste without overriding it (especially if you watch the proportions and use more spinach flavor, less other flavors). Maybe watercress, or celery, asparagus, or bellpepper, something like that that tastes green, or tastes good with spinach. Or you could find a flavor that goes well with the spinach - citrus, or apple, or berries - the kind of flavors that show up on sweet dressings for fresh spinach salads.