Skip to content

Latest commit

 

History

History
69 lines (56 loc) · 2.99 KB

README.md

File metadata and controls

69 lines (56 loc) · 2.99 KB

LinkPreview(SwiftUI)

version Swift: 5.1+ iOS: 14.0+ license

Preview with Link's meta information.

IMG_0458 example
Image Gif

Get Started

import SwiftUI
import LinkPreview

struct LinkPreview_Test: View {
    @State private var size: CGFloat = 350
    
    var body: some View {
        ZStack(alignment: .bottom){
            ScrollView{
                VStack{
                    LinkPreview(url: URL(string: "https://github.com/NuPlay/RichText"))
                        .backgroundColor(.blue)
                        .primaryFontColor(.white)
                        .secondaryFontColor(.white.opacity(0.6))
                        .titleLineLimit(3)
                        .frame(width: size, alignment: .center)
                    
                    LinkPreview(url: URL(string: "https://github.com/NuPlay/ExpandableText"))
                        .titleLineLimit(20)
                        .frame(width: size, alignment: .center)
                        .type(.small)
                    
                    LinkPreview(url: URL(string: "https://github.com/NuPlay/SwiftUI-SlideText"))
                }
                .padding(.horizontal, 24)
            }
            
            Slider(value: $size , in: 100...400, step: 1)
                .padding(.horizontal, 24)
        }
    }
}

Modifier(optional)

Modifier Default
.backgroundColor(_ backgroundColor: Color) Color(.systemGray5)
.primaryFontColor(_ primaryFontColor: Color) .primary
.secondaryFontColor(_ secondaryFontColor: Color) .gray
.titleLineLimit(_ titleLineLimit: Int) 3
.type(_ type: LinkPreviewType(customType[.large, .small, .auto])) .auto