- Notifications
You must be signed in to change notification settings - Fork103
SVG parser and renderer written in SwiftUI
License
exyte/SVGView
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The goal of this project is to bring the full power of SVG to Apple platforms. Our framework can parse SVG files and represent their content in SwiftUI. It provides you with the ability to not only render SVG files, but also add interactivity to them, handle user input and use SwiftUI to put your art into motion.
Get started withSVGView in a few lines of code:
structContentView:View{varbody:someView{SVGView(contentsOf:Bundle.main.url(forResource:"example", withExtension:"svg")!)}}
You can change various parameters for the nodes like this:
letcircle=SVGCircle(cx:30, cy:30, r:30)circle.fill=SVGColor.blackcircle.stroke=SVGStroke(fill:SVGColor(hex:"ABCDEF"), width:2)circle.onTapGesture{print("tap")}
You may locate the desired part of your SVG file using standard identifiers to add gestures and change its properties in runtime:
structContentView:View{varbody:someView{letview=SVGView(contentsOf:Bundle.main.url(forResource:"example", withExtension:"svg")!)iflet part= view.getNode(byId:"part"){ part.onTapGesture{ part.opacity=0.2}}return view}}
You can use standard SwiftUI tools to animate your image:
iflet part= view.getNode(byId:"part"){ part.onTapGesture{withAnimation{ part.opacity=0.2}}}
SVGView makes it easy to add custom effects to your app. For example, make thispikachu track finger movement:
varbody:someView{letview=SVGView(contentsOf:Bundle.main.url(forResource:"pikachu", withExtension:"svg")!)letdelta=CGAffineTransform(translationX:getEyeX(), y:0) view.getNode(byId:"eye1")?.transform= delta view.getNode(byId:"eye2")?.transform= deltareturn view.gesture(DragGesture().onChanged{ ginself.x= g.location.x})}
Our mission is to provide 100% support of all SVG standards: 1.1 (Second Edition), Tiny 1.2 and 2.0. However, this project is at its very beginning, so you can follow our progress onthis page. You can also check outSVGViewTests project to see how well this framework handles every single SVG test case.
dependencies:[.package(url:"https://github.com/exyte/SVGView.git")]
pod'SVGView'
github "Exyte/SVGView"- iOS 14+ / watchOS 7+ / macOS 11+
- Xcode 12+
PopupView - Toasts and popups library
AnchoredPopup - Anchored Popup grows "out" of a trigger view (similar to Hero animation)
Grid - The most powerful Grid container
ScalingHeaderScrollView - A scroll view with a sticky header which shrinks as you scroll
AnimatedTabBar - A tabbar with a number of preset animations
MediaPicker - Customizable media picker
Chat - Chat UI framework with fully customizable message cells, input view, and a built-in media picker
OpenAI Wrapper lib forOpenAI REST API
AnimatedGradient - Animated linear gradient
ConcentricOnboarding - Animated onboarding flow
FloatingButton - Floating button menu
ActivityIndicatorView - A number of animated loading indicators
ProgressIndicatorView - A number of animated progress indicators
FlagAndCountryCode - Phone codes and flags for every country
LiquidSwipe - Liquid navigation animation
About
SVG parser and renderer written in SwiftUI
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.




