一个 UIView,用于在你的界面中显示单个 SVG 图像。
创建 SVGUIView
let data = Bundle.main.url(forResource: "example", withExtension: "svg")!
let svgView = SVGUIView(contentsOf: data)!
view.addSubView(svgView)
添加 SVGUIView
作为依赖项
let package = Package(
// name, platforms, products, etc.
dependencies: [
// other dependencies
.package(url: "https://github.com/nnabeyang/SVGUIView", from: "0.19.1"),
],
targets: [
.executableTarget(name: "<executable-target-name>", dependencies: [
// other dependencies
.product(name: "SVGUIView", package: "SVGUIView"),
]),
// other targets
]
)
将以下内容添加到你的 Podfile
pod 'SVGUIView'
SVGUIView 根据 MIT 许可证发布,请参阅 LICENSE。