Swift version: 5.1
Interface Builder is the standard tool for making iOS interfaces using drag and drop, but it does make it remarkably easy to make a mistake – moving a view by accident, adjusting a property with a typo, or perhaps embedding one view inside another by dragging.
Fortunately, there’s a quick and easy fix: you can select any control then lock it so that no more changes can happen. To try it out, select something (e.g. a button), then go to the Class inspector and look for the Lock property. It’s set to “Inherited – (Nothing)” by default, but you can change it to “All Properties” to ensure that it can’t be moved or have any of its settings adjusted.
LEARN SWIFTUI FOR FREE I have a massive, free SwiftUI video collection on YouTube teaching you how to build complete apps with SwiftUI – check it out!
Available from iOS
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.