jessica mele jessica mele - 3 months ago 27
Swift Question

Can you add a custom button to the Utilities Panel in Xcode?

Just wondering if it's possible to add a custom button to the Utilities Panel in Xcode that you can drag it into a storyboard scene and have certain aspects already set, color, font/size, gradient etc.?


You are describing a custom xib file containing a view and its subviews. You then load the xib and stick the view in your interface in code, wherever and whenever you need it. Okay, you won't be able to see the effects of that within the storyboard, but it solves the problem extremely neatly.

Another possibility, if this is just about a button and nothing else, would be a UIButton subclass where the button configures itself to have the features you want.

But there is no way to drag-and-drop a custom button from the Object library into the design canvas. What's in the Object library is what's in the Object library and you can't change that.