NVActivityIndicatorView README

The project's README from github.com/ninjaprox/NVActivityIndicatorView. As one markdown file: README.md.

NVActivityIndicatorView

Build Status Cocoapods Compatible Carthage Compatible

⚠️ Check out LoaderUI (ready to use with Swift Package Mananger supported) for SwiftUI implementation of this. 🎉

Introduction

NVActivityIndicatorView is a collection of awesome loading animations.

Demo

Animation types

Type Type Type Type
1. ballPulse 2. ballGridPulse 3. ballClipRotate 4. squareSpin
5. ballClipRotatePulse 6. ballClipRotateMultiple 7. ballPulseRise 8. ballRotate
9. cubeTransition 10. ballZigZag 11. ballZigZagDeflect 12. ballTrianglePath
13. ballScale 14. lineScale 15. lineScaleParty 16. ballScaleMultiple
17. ballPulseSync 18. ballBeat 19. lineScalePulseOut 20. lineScalePulseOutRapid
21. ballScaleRipple 22. ballScaleRippleMultiple 23. ballSpinFadeLoader 24. lineSpinFadeLoader
25. triangleSkewSpin 26. pacman 27. ballGridBeat 28. semiCircleSpin
29. ballRotateChase 30. orbit 31. audioEqualizer 32. circleStrokeSpin

Installation

Cocoapods

Cocoapods is a dependency manager for Swift and Objective-C Cocoa projects. To use NVActivityIndicatorView with CocoaPods, add it in your Podfile.

pod 'NVActivityIndicatorView'

Carthage

Carthage is intended to be the simplest way to add frameworks to your Cocoa application. To use NVActivityIndicatorView with Carthage, add it in your Cartfile.

github "ninjaprox/NVActivityIndicatorView"

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. To use NVActivityIndicatorView with Swift Package Manger, add it to dependencies in your Package.swift

dependencies: [
    .package(url: "https://github.com/ninjaprox/NVActivityIndicatorView.git")
]

Migration

Version 5.0.0 comes with breaking changes. Please refer to the release note for details.

Usage

Firstly, import NVActivityIndicatorView.

import NVActivityIndicatorView

Initialization

Then, there are two ways you can create NVActivityIndicatorView:

Note: Set Module to NVActivityIndicatorView.

NVActivityIndicatorView(frame: frame, type: type, color: color, padding: padding)

Control

Start animating.

activityIndicatorView.startAnimating()

Stop animating.

activityIndicatorView.stopAnimating()

Determine if it is animating.

animating = activityIndicatorView.isAnimating

Change properties

In storyboard, you can change all properties in Attributes inspector tab of Utilities panel.

Note: Use one of values (case-insensitive) in Animation types for Type Name.

All properties are public so you can change them after initializing.

Note: All changes must be made before calling startAnimating().

Documentation

https://nvactivityindicatorview.vinhis.me/

Acknowledgment

Thanks Connor Atherton for inspired Loaders.css and Danil Gontovnik for DGActivityIndicatorView.

License

The MIT License (MIT)

Copyright (c) 2016 Vinh Nguyen @ninjaprox

NVActivityIndicatorView (ninjaprox/NVActivityIndicatorView)

Searching Database…

这是什么?NVActivityIndicatorView 是一套为 iOS 应用准备的 30 多种现成加载动画,以即插即用的 UIView 子类形式实现。
它是 UIKit 视图还是 SwiftUI 组件?它是基于 UIKit 的组件:一个自定义的 UIView 子类,可以拖进故事板使用,也可以在代码中创建。如果需要 SwiftUI 版本,作者推荐另一个名为 LoaderUI 的项目。
我该如何把它添加到项目中?通过 CocoaPods、Carthage 或 Swift Package Manager 安装,分别在 Podfile、Cartfile 或 Package.swift 依赖中添加它,然后在代码中导入 NVActivityIndicatorView。
使用前还需要先安装其他工具或库吗?除了你选择的包管理器(CocoaPods、Carthage 或 SPM)用来拉取 Swift 框架之外,不需要其他外部运行时依赖。
升级版本或在 Interface Builder 中使用时有什么需要注意的坑吗?5.0.0 版本引入了不兼容的改动,升级前请先查看发布说明。通过故事板使用时,必须把视图的 Module 设置为 NVActivityIndicatorView,否则无法正常渲染。
设置好之后,我该如何启动和停止动画?调用 startAnimating() 开始动画,调用 stopAnimating() 结束动画,还可以通过 isAnimating 查询其状态;任何属性更改都必须在调用 startAnimating() 之前完成。
包含多少种动画样式?共 32 种不同的类型,例如 ballPulse、squareSpin、pacman、orbit 和 circleStrokeSpin,均可通过名称选择。
我能否在 Interface Builder 中自定义动画的外观?可以,所有属性(颜色、类型名称、线宽等)都可以在 Attributes 检查器中设置,其中 Type Name 需与预定义的动画类型值之一相匹配(不区分大小写)。
为什么不自己写一个加载动画,而要用它?它内置了几十种精心制作的现成加载动画(灵感来自 Loaders.css 和 DGActivityIndicatorView),你无需从零设计和制作自己的加载指示器。
Creator
ninjaprox
Size
6.2 MB
Stars
10.7K
Age
11y
Commits · 90 Days