Swift UI component - Stories instagram, slideshow, crypto wallet intro

Overview

SwiftUI and Combine - Stories intro multi-platform widget

Features

  • Long tap - pause stories showcase
  • Tap - next story
  • Leeway - pause before start stories
  • Customize component with you own stories and every story with it's own view
  • Customize time longevity for every story
  • iOS and macOS support
  • Customizable dark and light scheme support for every story
  • Control stories run as by external sources that are not inside StoriesWidget so via Gesture
  • Observing stories life circle for reacting on state change
  • Internal and custom external errors handling
  • Localization (En, Es) All errors and system messages are localized

1. Stories

Define enum with your stories conforming to IStory

    public enum Stories: IStory {
          
        case first
        case second
        case third

        @ViewBuilder
        public func builder(progress : Binding<CGFloat>) -> some View {
            switch(self) {
                case .first:  StoryTpl(self, .green,  "1", progress)
                case .second: StoryTpl(self, .brown,  "2", progress)
                case .third:  StoryTpl(self, .purple, "3", progress)
            }
        }
        
        public var duration: TimeInterval {
            switch self{
                case .first, .third : return 5
                default : return 3
            }
        }

        public var colorScheme: ColorScheme? {
            switch(self) {
                case .first: return .light
                default: return .dark
            }
        }

    }

2. Create stories widget

  • manager - package standard manager StoriesManager.self for managing stories life circle.
    Define your own manager conforming to IStoriesManager if you need some specific managing process
  • stories - stories conforming to IStory
    StoriesWidget(
        manager: StoriesManager.self,
        stories: Stories.allCases
    )

Optional

  • strategy - default strategy is circle
Strategy Description
circle Repeat stories
once Show just once
  • current - start story if not defined start with first

  • leeway - delay before start stories, default .seconds(0)

  • pause - shared var to control stories run by external sources that are not inside StoriesWidget, default .constant(false). For example if you launched modal view and need to pause running stories while modal view is existed you can do it via shared variable passing as a binding in StoriesWidget.

  • validator - Custom validator to check validity of stories data set before start

  • onStoriesStateChanged - Closure to react on stories state change

Stories life circle

You can observe events of the stories life circle and react on it's change. Pass closure to config of StoriesWidget.

  • onStoriesStateChanged(StoriesState) - Closure to react on stories state change
    StoriesWidget(
        manager: StoriesManager.self,
        stories: Stories.allCases                    
    ){ state in
        print("Do something on stories \(state) change")
    }
State Description
ready Waiting to start If there's leeway this is the state during this delay before the big start
start Big start
begin Begin of a story
end End of a story
suspend At the moment of pause and then is kept until is resumed. Informs that currently demonstration is paused
resume At the moment of resume and then is kept until the next pause or end of a story
finish Big finish. At the end of the strategy .once

Stories life circle

Stories error handling

There's internal check of stories data

  • There are no stories
  • Duration must be a positive number greater than zero

Custom stories error handling

if you need custom check for stories data, just implement validator conforming to IStoriesValidater and pass it as a parameter to StoriesWidget

    StoriesWidget(
        manager: StoriesManager.self,
        stories: Stories.allCases,
        validator: CustomStoriesValidater.self
    )

There's an example of custom validator. Take a look on CustomStoriesValidater implementation. Stories won't be started if there's an error then instead of stories there'll be the error view with description of errors.

Custom error handling for stories

Localization (En, Es)

All the internal errors and system messages that might occur are localized. Localization for stories is up to you as it's external source for the component.

Se localizan todos los errores internos y mensajes del sistema que puedan producirse. La localización de las historias depende de usted, ya que es la fuente externa del componente.

Custom stories error handling

SwiftUI example of using package

d3-stories-instagram-example

click to watch expected UI behavior for the example

click to watch expected UI behavior for the example

click to watch expected UI behavior for the example

Documentation(API)

  • You need to have Xcode 13 installed in order to have access to Documentation Compiler (DocC)
  • Go to Product > Build Documentation or ⌃⇧⌘ D
You might also like...
SwiftUI Prototyping Wallet App Interactive UI
SwiftUI Prototyping Wallet App Interactive UI

Wallet SwiftUI Prototyping Wallet App Interactive UI

Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains

Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains. Non-custodial storage, decentralized exchange, and extensive analytics for thousands of tokens and NFTs. Implemented on Swift.

Trust - Ethereum Wallet and Web3 DApp Browser for iOS
Trust - Ethereum Wallet and Web3 DApp Browser for iOS

Trust - Ethereum Wallet and Web3 DApp Browser for iOS Welcome to Trust's open source iOS app! Getting Started Download the Xcode 9 release. Clone this

Rainbow - 🌈the Ethereum wallet that lives in your pocket
Rainbow - 🌈the Ethereum wallet that lives in your pocket

🌈️ the Ethereum wallet that lives in your pocket! 📲️ Available on the iOS App Store. 🤖 Android Beta available on Google Play Store 🐦️ Foll

An open-source Ethereum wallet built with SwiftUI

lil wallet welcome to lil wallet. it's an open-source Ethereum wallet built with SwiftUI there are two main views - coins and objects. coins are your

AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS
AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

Smart Wallet - iOS application for managing money
Smart Wallet - iOS application for managing money

This is an iOS application for managing money written in Swift language. Different reports are presented in the application to help the user managing the money and keeping track of it easily.

Encryptr is a zero-knowledge, cloud-based e-wallet / password manager powered by Crypton

Encryptr is a zero-knowledge, cloud-based e-wallet / password manager powered by Crypton

A highly experimental, self-custody Lightning wallet built to work for iOS and macOS.

Surge Surge is a highly experimental, self-custody Lightning wallet built to work for iOS and macOS. Motivation Tools and infrastructure for running a

Releases(v.1.2.2)
  • v.1.2.2(Jul 6, 2022)

  • v.1.2.0(Jul 5, 2022)

  • v.1.1.0(Jul 3, 2022)

    • [x] Control stories run as by external sources that are not inside StoriesWidget so via Gesture
    • [x] Observing stories life circle for reacting on state change
    Source code(tar.gz)
    Source code(zip)
  • v.1.0.0(Jun 28, 2022)

    Features

    • [x] Long tap - pause stories showcase
    • [x] Tap - next story
    • [x] Leeway - pause before start stories
    • [x] Customize component with you own stories and every story with it's own view
    • [x] Customize time longevity for every story
    • [x] iOS and macOS support
    • [x] Customizable dark and light scheme support for every story
    Source code(tar.gz)
    Source code(zip)
Owner
Igor
Software engineer
Igor
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 136 Dec 25, 2022
Ethereum-wallet: 100% native ethereum wallet, created with iOS version of Geth client

Ethereum-wallet: 100% native ethereum wallet, created with iOS version of Geth client

DE MINING 4 Dec 11, 2022
Wei Wallet - Ethereum wallet app for iOS

Wei Wallet - Ethereum wallet app for iOS Getting Started Download the latest Xcode Clone this repository Install Carthage, Cocoapods Run make bootstra

Popshoot, Inc. 277 Nov 17, 2022
Fearless Wallet - a mobile wallet designed for the decentralized future on the Kusama and Polkadot networks

Fearless Wallet is a mobile wallet designed for the decentralized future on the Kusama and Polkadot network, with support on iOS and Android platforms. The best user experience, fast performance, and secure storage for your accounts. Development of Fearless Wallet is supported by Kusama Treasury grant.

ソラミツ 68 Dec 14, 2022
CryptoSwift - Crypto related functions and helpers for Swift implemented in Swift

CryptoSwift Crypto related functions and helpers for Swift implemented in Swift.

Kushal Shingote 2 Feb 6, 2022
Kukai Crypto Swift is a native Swift library for creating regular or HD wallets for the Tezos blockchain

Kukai Crypto Swift Kukai Crypto Swift is a native Swift library for creating regular and HD key pairs for the Tezos blockchain. Supporting both TZ1 (E

Kukai Wallet 2 Aug 18, 2022
CryptoTrackerMenuBar - A Realtime Crypto Tracker macOS Menu Bar App built with SwiftUI & WebSocket

Realtime Crypto Tracker macOS Menu Bar App - SwiftUI & WebSocket A Realtime Cryp

Alfian Losari 21 Dec 15, 2022
Full Bitcoin library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash and Dash blockchains.

BitcoinKit-iOS Bitcoin, BitcoinCash(ABC) and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restor

Horizontal Systems 231 Dec 2, 2022
IOTA wallet.rs Swift binding

IOTA wallet.rs Swift Binding Swift binding for the official wallet.rs Rust library for IOTA Ledger. The Swift binding links and communicates with the

Pasquale Ambrosini 5 Jun 13, 2022
BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift.

BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restore, synchronization with network, send/receive transactions, and more.

Horizontal Systems 4 Nov 23, 2022