https://github.com/frog-frog/storyview
https://github.com/frog-frog/storyview
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/frog-frog/storyview
- Owner: Frog-Frog
- License: mit
- Created: 2018-04-22T08:00:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-28T07:34:36.000Z (almost 8 years ago)
- Last Synced: 2025-07-05T08:41:06.506Z (12 months ago)
- Language: Swift
- Size: 51.8 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StoryView
## Description
StoryView is a UIView library that can make carousel like Instagram's story.
This library use easily like UITableView.
## Features
・Change border color
・Change border width
・Crop an image into a circle
## Demo
## Usage
### Make property.
```swift
import StoryView
class ViewController: UIViewController {
@IBOutlet weak var storyView: StoryView! {
willSet {
newValue.delegate = self
newValue.dataSource = self
}
}
override func viewDidLoad() {
super.viewDidLoad()
// If you do not use IBOutlet, create a StoryView with code.
//self.storyView = StoryView()
}
}
```
### Implement StoryViewDataSource.
You must implement these methods.
```swift
extension ViewController: StoryViewDataSource {
func numberOfItems(in storyView: StoryView) -> Int {
return yourStories
}
func storyView(_ storyView: StoryView, storyForItem item: Int) -> Story {
let story = Story(image: yourImage, title: yourTitle)
return story
}
}
```
### Implementt StoryViewDelegate
You must implement these methods.
```swift
extension ViewController: StoryViewDataSource {
func storyView(_ storyView: StoryView, tappedCellAt item: Int) {
// This process is executed when Story is tapped.
}
func storyView(_ storyView: StoryView, longPressedCellAt item: Int) {
// This process is executed when Story is long pressed.
}
}
```
## Install
### CocoaPods
Add this to your Podfile.
```PodFile
pod 'StoryView'
```
### Carthage
Add this to your Cartfile.
```Cartfile
github "PKPK-Carnage/StoryView"
```
## Help
If you want to support this framework, you can do these things.
* Please let us know if you have any requests for me.
I will do my best to live up to your expectations.
* You can make contribute code, issues and pull requests.
I promise to confirm them.
## Licence
[MIT](https://github.com/PKPK-Carnage/StoryView/blob/master/LICENSE)
## Author
[PKPK-Carnage🦎](https://github.com/PKPK-Carnage)