One of my pinhole cameras has a simple method of doing this: a Tessar.
I made a pinhole lens that fits one of the interchangeable shutters on my 250/7 Ideal plate camera; I can compose on the ground glass at f/4.5, then in fifteen seconds switch one shutter for the other and have an f/300 pinhole -- still mounted in a shutter, so I can easily use the cable release to operate it, or even (with fast film in bright light) use the timed shutter speeds down to 1 second. And yes, on the 78 year old shutters (actually, that's the newer of the two), the one second is accurate.
If I'm working at a different focal length than the 135 mm that my Tessar can handle, I can just remove the pinhole from the shutter and stop down to f/45, as a "viewing pinhole" -- the image will be very, very fuzzy, but bright enough to compose with under a dark cloth. Pop the hole back in when ready to expose.