//
// ContentView.swift
// SwiftUI_text
//
// Created by devdepot on 2021/04/27.
//
import SwiftUI
struct ContentView: View {
static let dateFormat: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "YYYY년 M월 d일"
// formatter.dateStyle = .full
return formatter
}()
var today = Date()
var trueOrfalse = false
var number = 123
var body: some View {
VStack{
Text("What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum")
.tracking(2) //글자 사이 간격(반드시 텍스트 바로 다음 적용)
.font(.system(size: 15))
.fontWeight(.medium)
.multilineTextAlignment(.center)
.lineLimit(nil)
.lineSpacing(10) //줄간격
.truncationMode(.head)
.shadow(color: .red, radius: 1.5, x: 4, y: 10)
.padding(.horizontal,20)
.background(Color.yellow)
.cornerRadius(20)
.background(Color.green)
.padding()
.background(Color.red)
Text("안녕하세요")
.background(Color.gray)
.foregroundColor(Color.white)
Text("오늘의 날짜 입니다 : \(today, formatter: ContentView.dateFormat)")
Text("참 혹은 거짓 : \(String(trueOrfalse))")
Text("숫자입니다 : \(number)")
}
}
}
//struct ContentView_Previews: PreviewProvider {
// static var previews: some View {
// ContentView()
// }
//}
(SwiftUI)05.텍스트 ,데이트 형식,형변환
2021. 4. 27. 13:55