GithubHelp home page GithubHelp logo

calendarweek's Introduction

CalendarWeek

All the calendar flow implemented for you.

💉 Inject your views and customize everything.

💡 Use your own model (simply conforming to CalendarModel)

Actions

  • To change days
    • Tap on the desired day.
    • Swipe its day content.
  • To change weeks
    • Swipe the week.

Usage

Create a model that conform to CalendarModel, and have a property let day: Day

class Card: Identifiable, CalendarModel {
    let text: String
    let day: Day // CalendarModel conformance

    init(text: String, day: Day) {
        self.text = text
        self.day = day
    }
}

Create an array of this model

@State var cards = [
    Card(
        text: "Card 1",
        day: Day(from: .now)
    ),
    Card(
        text: "Card 2",
        day: Day(
            from: Calendar.current.date(
                byAdding: .day,
                value: 1,
                to: .now
            )!
        )
    ),
    Card(
        text: "Card 3",
        day: Day(
            from: Calendar.current.date(
                byAdding: .day,
                value: 2,
                to: .now
            )!
        )
    )
]

Create the CalendarView

CalendarView(
    models: cards,
    daySpacing: 20,
    headerView: { day in
        HeaderView(selectedDay: day) // your view here
    },
    dayView: { day in
        DayComponentView(day: day) // your view here
    },
    weekBackground: {
        RoundedRectangle(cornerRadius: 20).fill(Color.pink.opacity(0.25)) // normal background here
    },
    dayContentView: {
        CardView(model: $0) // your view here
    },
    dayEmptyStateView: {
        EmptyCardView() // your view here
    }
)

Note: you need to implement your own views for:

  • Header
  • Day inside the week
  • Background of the week
  • Content of the Day
  • Empty state when there is no content for the Day

calendarweek's People

Contributors

gabrielabezerra avatar

Stargazers

Johan Sørensen avatar xiaogege avatar marcelle queiroz avatar  avatar Alley Pereira avatar

Watchers

 avatar

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.