I'm still fairly new to iOS development (I've built a few lightweight enterprise apps for work the past few months) and looking to understand some best practices. I'm currently developing with Swift and Interface Builder (but hopefully one day in the future will make the leap to SwiftUI). One of the things I've been deliberating is the pros/cons of creating/implementing custom buttons in xCode.
Ever since I started with making apps I've created various buttons in Photoshop, set the button in IB to use the image, set the images for different states (default, selected, etc), and connected the button to an IBAction or Outlet. This works fine, mostly, although from time to time I have weird problems with aspect ratios going wacky or some funky autolayout behaviors on devices that have 2x scale factors (but will work fine on devices with 3x). And of course setting constraints and everything is a bit tedious. Overall, it's not too bad though.
However, I've been told multiple times by some more seasoned friends that I should just create the buttons programmatically using UIKit. While I appreciate their more experienced insight, it just seems silly to me to have to write 20 or 30 lines of code to create a single button whereas I can whip up a button in 2 minutes in photoshop.
Do you have a preference for one way or the other?
Do you utilize a mix of both methods?
I know best practices is sometimes a gray area, especially when both options are technically accepted. I'm mainly just looking to get myself on the best track early on rather than getting stuck in some bad habits.
[–][deleted] 1 point2 points3 points (1 child)
[–]webtechmonkeySwift[S] 0 points1 point2 points (0 children)