많은곳에서 사용되는 상황은 아니지만
특정한 상황에서 html텍스트를 표시해야될 경우가 있다
그래서 라이브러리로 만들었다.
깃허브 링크
SwiftUI로 만들었기 때문에 iOS13이상인 경우에만 사용이 가능하다
import SwiftUI
import RichText
struct RichText_Test: View {
@State private var html = ""
var body: some View {
ScrollView{
RichText(html: html)
.lineHeight(170)
.imageRadius(12)
.fontType(.system)
.colorScheme(.automatic)
.colorImportant(true)
.linkOpenType(.SFSafariView)
.linkColor(ColorSet(light: "#007AFF", dark: "#0A84FF"))
.placeholder {
Text("loading")
}
}
}
}
struct RichText_Test_Previews: PreviewProvider {
static var previews: some View {
RichText_Test()
}
}
RichText에서 html만 필수고
나머지는 옵션이다
필요하다면 값을 변경하거나, 삭제를 해도된다.