|
|
|
|
|
| default color | ColorType.black | ColorType.default | ColorType.clear | ColorType.clear | ColorType.clear |
## Customize Color and Image
You can customize which color is set to circle ring, status view in the lower right named in `statusView` after that and which image is set to status as follows. If you configure display and color type of IGStoryButton, you first import `IGStoryButtonKit` and set value to the property named `condition` derived from `IGStoryButton.TypeCondition` consisted of `IGStoryButton.DisplayType`, `IGStoryButton.ColorType`.
Please refer to these codes, comments and implementation of sample app named in `ExampleApp`.
```swift
// import this module
import IGStoryButtonKit
// storyButton: instance after initialization via code or interface builder
// set displayType as .seen, and default color is set to color of circle ring because colorType is not set specifically
storyButton.condition = .init(display: .seen)
// same thing with above
storyButton.condition = IGStoryButton.TypeCondition(display: .seen)
// if you set color to statusView, you set StatusView.DisplayType.color(of:) as type and specific color as UIColor in the argument of StatusView.DisplayType.color
storyButton.condition = .init(display: .status(type: .color(of: UIColor.green)))
// if you set image to statusView, you set StatusView.DisplayType.image(of:) as TypeCondition.DisplayType and specific image as UIImage in the argument of StatusView.DisplayType.image
storyButton.condition = .init(display: .status(type: .image(of: UIImage(named: "ramen"))))
// if you customize color of circle ring, you set ColorType.custom(colors:) in the argument as TypeCondition.ColorType and set the specific array consisted of UIColor to the argument of ColorType.custom
storyButton.condition = .init(display: .status(type: .color(of: UIColor.green)), color: .custom(colors: [UIColor.cyan, UIColor.yellow, UIColor.gray]))
```
## Indicator Manipulation
You can manipulate whether circle ring performs like activity indicator or not. If you want to start loading, execute `startAnimating(speed:, alpha:)`. Besides, if you want to stop loading, execute `stopAnimating`.
```swift
// storyButton: instance after initialization via code or interface builder
// if you want to set rotation speed and alpha of button, set these in argument of startAnimating(speed:, alpha):
storyButton.startAnimating() // speed: 0.2, alpha: 0.7
storyButton.stopAnimating()
```
## Important Notification
IGStoryButton is initialized by code or interface builder, but the size of width and height is `required to be equal`. If the size of width is different from one of width, `fatalError("The size of width and height are required to be equal")` is expected to be occurred.
# Requirements
Swift 5.3+