This is what I refer to as the "Martha Stewart Fence". I built it 20-odd years ago between the house and the garage.
That square tubing gate has been a pain in my ass for years. As the seasons change, the gate and the latch move in relation to each other and I'm constantly messing with the latch pin so the gate will latch.
The last attempt was a moveable pin captured behind a plate with a slot in it. I could tighten up the plate to adjust the friction and the pin would stay in the set position fairly well and that worked for a couple of years. Then wood aged and screws loosened and I was right back in the same predicament.
This solution will still need seasonal adjustment, but it's done with a screwdriver so it's easy and accurate (as opposed to tapping the pin up and down in the slot with a hammer...) and the pin will STAY wherever I set it.
Basically a captive nut in a piece of square tubing with a slot for the pin and the nut/pin runs up and down on a piece of all-thread. Plus the assembly is welded so it won't vibrate apart and it's screwed to the treated 4x4 that's under the cedar trim with four 4" Power Pro construction screws.
Other than slathering it with grease occasionally, this should be the last time I need to mess with it. But then, I've thought that before...