What file is the best definition for String and Color?

Asked 2 years ago, Updated 2 years ago, 72 views

I have implemented it on Android, but this time I am creating an app on Swift3.

This is a basic question, but which file is the correct definition for common use in apps?Is it common?
For example, Color, String, Array...

On Android, we create and define color.xml, config.xml, string.xml, but
How should I define it in swift?

I would also like to know the file name and directory configuration...

Thank you for your cooperation!!

ios swift3

2022-09-29 22:28

1 Answers

Isn't it common to create a new Swift file and summarize the constants in Structures as follows?

Definition Example

//Constant.swift
US>struct stringConstant {
    static let hogeString="hoge"
}

US>structure colorConstant {
    staticlet fugaColor=UIColor.red
}

Use Cases

let label=UIlabel()
label.text=stringConstant.hogeString
label.textColor=colorConstant.fugaColor


2022-09-29 22:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.