I am building a porch swing out of leftover lumber. It is intended to hang in a covered porchh. Some of the lumber is not pressure treated. Is that okay for outdoor under porch as long as I stain and seal with spar varnish
For lumber to rot you need (long term) moisture. So under your porch you normally don't even need to varnish it.
I would be more concerned about using PT wood that comes in contact with skin or even clothes. Pressure treated means pressure treated with chemicals. CCA or chromated copper arsenate has been replaced by copper-based pesticides, but chemical it still is.
If you don't need it for it's water/bug decay properties, don't use PT wood. Under your porch, you can use framing lumber.
I would go with untreated wood and then just apply a good quality wood stain, tinted to whatever shade you like. Hint: It is much easier to apply the stain on all sides and surfaces BEFORE building the deck!