Git Product home page Git Product logo

storyui's Introduction

StoryUI

Create stories with just single-line code

build status

Installation

Use Swift Package Manager

dependencies: [
    .package(url: "https://github.com/tiskender2/StoryUI.git", exact: "1.5.3")
]

Example

example

Usage

import SwiftUI
import StoryUI

struct ContentView: View {
    @State var isPresented: Bool = false
     @State var stories = [
        StoryUIModel(user: StoryUIUser(name: "Tolga ฤฐskender", image: "https://image.tmdb.org/t/p/original/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg"), stories: [
            
             Story(mediaURL: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4",
                  date: "30 min ago",
                  config: StoryConfiguration(storyType: .message(config: StoryInteractionConfig(showLikeButton: true),
                                                                 emojis: [["๐Ÿ˜‚","๐Ÿ˜ฎ","๐Ÿ˜"],
                                                                          ["๐Ÿ˜ข","๐Ÿ‘","๐Ÿ”ฅ"]],
                                                                 placeholder: "Send Message"),
                                             mediaType: .video)),
            
            Story(mediaURL: "https://image.tmdb.org/t/p/original//pThyQovXQrw2m0s9x82twj48Jq4.jpg", date: "1 hour ago", config: StoryConfiguration(mediaType: .image)),
            Story(mediaURL: "https://image.tmdb.org/t/p/original/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg", date: "12 hours ago", config: StoryConfiguration(mediaType: .image))
        ]),
        StoryUIModel(user: StoryUIUser(name: "Jhon Doe", image: "https://image.tmdb.org/t/p/original//pThyQovXQrw2m0s9x82twj48Jq4.jpg"), stories: [
            Story(mediaURL: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4", date: "30 min ago", config: StoryConfiguration(mediaType: .video)),
            Story(mediaURL: "https://picsum.photos/id/237/200/300", date: "12 hours ago", config: StoryConfiguration(mediaType: .image)),
            
        ]),
    ]
var body: some View {
        NavigationView {
            Button {
                isPresented = true
            } label: {
                Text("Show")
            }
            .fullScreenCover(isPresented: $isPresented) {
                StoryView(stories: stories,
                          isPresented: $isPresented)
            }
        }

    }

Requirements

  • iOS 14+
  • Swift 5.6+

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

StoryUI is available under the MIT license. See the LICENSE file for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.