To run the example project, clone the repo, and run pod install
from the Example directory first.
MZStoryPreviewer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MZStoryPreviewer'
In your storyboard file give your UIView class MZStoryPreviewer and make it inherite from MZStoryPreviewer
Then drag outlet of your view and import MZStoryPreviewer
After that conform your ViewController to MZStoryPreviewerDataSource
and MZStoryPreviewerDelegate
extension ViewController: MZStoryPreviewerDataSource, MZStoryPreviewerDelegate {
func mzStoryPreviewer(_ previewer: MZStoryPreviewer, didSelectItemAt: Int) {
}
func mzStoryPreviewer(storyUsersFor previewer: MZStoryPreviewer) -> [MZStoryUser] {
return users
}
}
By assuming that each user have an array of stories and each story has a type , you have two Protocols create your custom models for
User and Story DataModel and conform to MZStoryUser
for user and MZStoryItem
for the story
public protocol MZStoryUser{
var userName : String{get}
var userImageURLPath : String?{get}
var userStoryItems : [MZStoryItem]{get}
}
//-----------------------------------
public protocol MZStoryItem {
var type: MZStoryItemType { get set }
var image: UIImage? { get }
var url: URL? { get }
var duration : TimeInterval {get set}
}
mozead1996, [email protected]
MZStoryPreviewer is available under the MIT license. See the LICENSE file for more info.