Monday Hero
v2-Web-Desktop-App
Search
K
Links

Texts

Monday Hero can automatically understand the texts, and convert design to Swift/Kotlin code.
Texts are automatically detected and their code is generated by Monday Hero. With texts, you can describe an interface element or provide messages. Texts display static text with no editing features.
Monday Hero names texts on the design as Labels. However, it's also possible to convert label into components like buttons or create Custom Labels to reuse elements on the page like HeaderLabel below:
Automatically detected labels(Text) and components

Automatically Detected Texts

In the image above, there is a Welcome to Travel App label. It's code is autogenerated like below.
iOS
Android

Label

Texts are called as Label in the Swift language. Let's see the generated code and its attributes.
//Signup Page, Welcome Label
import UIKit
class SignUpViewController: UIViewController {
// MARK: - Properties
@IBOutlet private weak var welcomeLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
setupLayout()
}
}
extension SignUpViewController {
private func setupViews() {
welcomeLabel.textColor = UIColor.black
welcomeLabel.numberOfLines = 0
welcomeLabel.font = UIFont.textStyle7
welcomeLabel.textAlignment = .center
welcomeLabel.text = NSLocalizedString("welcome.to.travel.app", comment: "")
}
private func setupLayout() {
//Constraints are defined in Storyboard file.
}
}

TextView

Texts are called as TextView in the Android Kotlin/Java XML. Let's see the already generated code and its attributes.
<!--activityExample.xml-->
<TextView
android:id="@+id/titleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_text"
style="@style/textStyle13"
android:textAlignment="center"
android:textColor="?attr/black"
android:layout_marginStart="39dp"
android:layout_marginEnd="39dp"
android:layout_marginBottom="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mondayHeroLogoImageView"
app:layout_constraintBottom_toTopOf="@+id/descriptionTextView"/>
<!--strings.xml-->
<string name="title_text">"SimpleText"</string>
<string name="description_text">"This is a textView example and textViews are better while it kept short and legible."</string>

Custom Texts

In order to reuse the same styled labels like header1, header2, create custom texts. Here is how to do it:
Create a reusable label
The code will be generated like below for custom texts:
HeaderLabel.swift - iOS
SignupPage.swift - iOS
Android
//HeaderLabel.swift
import UIKit
class HeaderLabel: UILabel {
// MARK: - Initializers
override init(frame: CGRect) {
super.init(frame: frame)
initialize()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initialize()
}
func initialize() {
applyDefaultStyle()
}
// MARK: - Styling
func applyDefaultStyle() {
self.textColor = UIColor.pebble
self.numberOfLines = 0
self.font = UIFont.textStyle18
self.textAlignment = .left
}
func set(text: String){
self.text = text
}
}
import UIKit
class SignupPage: UIViewController {
// MARK: - Properties
@IBOutlet private weak var welcomeLabel: HeaderLabel!
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
setupLayout()
}
}
extension SignupPage {
private func setupViews() {
welcomeLabel.set(text: NSLocalizedString("welcome.to.travel.app", comment: ""))
}
private func setupLayout() {
//Constraints are defined in Storyboard file.
}
}
Coming soon.
Last modified 2yr ago