Monday Hero
Website
V2
V2
  • Overview
  • Workflow Basics
  • Getting Started
    • Installing the Desktop App
    • Log In & Create a Project
    • Prepare Design to Get the Best Code Results
    • Import Design Files into Monday Hero
      • Import Figma Design Files into Monday Hero
        • Import Your Figma Text Style and Color Library
      • Import Adobe XD Design Files into Monday Hero
      • Import Sketch Design Files Into Monday Hero
    • Share Your Project & Manage Roles
  • DESIGN TO FLUTTER
    • Convert Design to Flutter
    • Create Flutter Components
      • System Components
        • Material & Cupertino Components
        • Flutter Supported Components
      • Custom Components
    • Create Responsive Code
    • Colors
    • Text Styles
    • Assets
    • Sync Code
    • Flutter Project Base
      • Fast Start with Monday Hero Starter Project
      • Integrate Monday Hero to your Existing Project
    • Shadows, Gradients, and Other Design Elements
    • Troubleshooting Guide
      • Checklist for Design Element Review and Code Generation
      • Github Monday Hero Starter Project Troubleshooting
  • DESIGN TO SWIFT
    • Convert Design to Swift
    • Create Swift Components
      • System Components
        • Views
        • Texts
        • Images
        • Button
        • TextField/EditText
        • Text Area
        • Status Bar
        • Search Bar
        • List
        • Grid
        • Swift Supported Components
      • Custom Components
      • Video Player Code Component
    • Colors
    • Text Styles
    • Assets
    • Shadows, Gradients, and Other Design Elements
    • Firebase
      • How to get Video URL from Firebase
    • Export Code
      • Integrating Exported Files into an Existing Xcode Project
  • Hero AI Assistant
    • Hero AI Assistant
  • Design to React
    • Convert Design to React
  • Step-By-Step Tutorials
    • 🏖️Travel App
  • Support
    • Roadmap
    • Suggest a New Feature
    • Report a Bug
    • Product Announcements
    • Mail to Support
    • Frequently Asked Questions
  • Join & Follow Us
    • YouTube
    • Discord Community
    • GitHub
    • Twitter
    • LinkedIn
    • Blog
    • Instagram
    • Facebook
Powered by GitBook
On this page

Was this helpful?

  1. DESIGN TO SWIFT
  2. Create Swift Components
  3. System Components

Images

Monday Hero can automatically understand the images, and convert design to Swift/Kotlin code.

PreviousTextsNextButton

Last updated 3 years ago

Was this helpful?

Images can be used to improve the UX, capture users' attention, or differentiate the product. ImageViews are non-interactive by default. Images in the designs are automatically detected after exporting. They are saved as assets, and their code is generated by Monday Hero. Icons and logos are also classified as images. Let's have an example and understand it clearly. A simple image, an icon, a logo, and their generated codes can be seen below.

All images, logos, and icons should be marked exportable before exporting the design to Monday Hero with plugins. Otherwise, the code and assets are not generated for them.

Generated iOS/Android Code of Images

Images are called and defined in ImageView to display image resources in both Swift/XML/Kotlin language. Let's see the generated code and its attributes.

In iOS, Images are connected to the builder and there is no additional code below since the constraints are already defined in the storyboard file automatically.

//ListPageViewController.swift 
import UIKit

class ListPageViewController: UIViewController {
	
	// MARK: - Properties
  //Connection from an Interface Builder to a UI component
	@IBOutlet private weak var photoImageView: UIImageView!
	@IBOutlet private weak var iconImageView: UIImageView!
	@IBOutlet private weak var logoImageView: UIImageView!


	override func viewDidLoad() {
		super.viewDidLoad()
		setupViews()
		setupLayout()
	}
}

extension ListPageViewController {
	private func setupViews() {

	}

	private func setupLayout() { 
		//Constraints are defined in Storyboard file.
	}
}

In Android, the source, layout, constraints, etc. all generated automatically as can be seen below.

<!--activityExample.xml-->
<androidx.constraintlayout.widget.ConstraintLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	tools:context=".ListPageActivity"
	android:background="?attr/daisy">
	
	<ImageView
	android:id="@+id/photoImageView"
	android:layout_width="0dp"
	android:layout_height="wrap_content"
	android:src="@drawable/photo2"
	android:scaleType="centerCrop"
	android:layout_marginStart="20dp"
	android:layout_marginEnd="20dp"
	android:layout_marginBottom="13dp"
	app:layout_constraintStart_toStartOf="parent"
	app:layout_constraintEnd_toEndOf="parent"
	app:layout_constraintTop_toBottomOf="@+id/popularTextView"
	app:layout_constraintBottom_toTopOf="@+id/rosieDelTextView"/>
	
	<ImageView
	android:id="@+id/iconImageView"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:src="@drawable/icon"
	android:layout_marginEnd="19dp"
	android:layout_marginTop="14dp"
	android:layout_marginBottom="20dp"
	app:layout_constraintStart_toEndOf="@+id/likesTextView"
	app:layout_constraintEnd_toEndOf="parent"
	app:layout_constraintTop_toBottomOf="@+id/photoImageView2"
	app:layout_constraintBottom_toTopOf="@+id/photoImageView"/>
	
	<ImageView
	android:id="@+id/logoImageView"
	android:layout_width="0dp"
	android:layout_height="wrap_content"
	android:src="@drawable/logo"
	android:layout_marginTop="267dp"
	android:layout_marginBottom="211dp"
	app:layout_constraintStart_toStartOf="parent"
	app:layout_constraintEnd_toEndOf="parent"
	app:layout_constraintTop_toTopOf="parent"
	app:layout_constraintBottom_toTopOf="@+id/copyrightTextView"/>
	
</androidx.constraintlayout.widget.ConstraintLayout>
Click and read here to learn more and see examples.
Images, icon, and logo example.