0

so I'm currently working on a programming project and I already designed a prototype in Figma. How should I go about importing the code design elements in the Xcode project. For example, I designed a Menu and the code for the Menu text at the top is:

// Menu


var view = UILabel()

view.frame = CGRect(x: 0, y: 0, width: 72, height: 28)

view.backgroundColor = .white


view.textColor = UIColor(red: 0.608, green: 0.318, blue: 0.878, alpha: 1)

view.font = UIFont(name: "Montserrat-ExtraBold", size: 24)

var paragraphStyle = NSMutableParagraphStyle()

paragraphStyle.lineHeightMultiple = 0.96


// Line height: 28 pt

// (identical to box height)


view.attributedText = NSMutableAttributedString(string: "Menu", attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])


var parent = self.view!

parent.addSubview(view)

view.translatesAutoresizingMaskIntoConstraints = false

Where should I paste this code in the Xcode project to get started. Thank you very much for your help! :)

Leopold
  • 11

0 Answers0