GithubHelp home page GithubHelp logo

mijick / calendarview Goto Github PK

View Code? Open in Web Editor NEW
109.0 2.0 4.0 46 KB

Calendars made simple (SwiftUI)

License: MIT License

Swift 98.44% Ruby 1.56%
calendar calendar-component calendar-view cocoapods ios-sdk ios-swift swift swift-calendar swift-library swift-package-manager

calendarview's Introduction


Mijick Header

Mijick GitHub Mijick Twitter Mijick Mail Separator


CalendarView Logo

Calendar View

Create fully customisable calendar in no time. Keep your code clean

Try demo we prepared


SwiftUI logo Platforms: iOS, iPadOS, macOS, tvOS Current Version License: MIT

Made in Kraków Stargazers

Calendar Example 1 Calendar Example 2 Calendar Example 3 Calendar Example 4


CalendarView is a free and open-source library designed for SwiftUI that makes the process of creating calendars easier and much cleaner.

  • Improves code quality. Create a calendar using MCalendarView constructor and pass the selected date / range to it. Simple as never!
  • Customize calendar in no time. We know how important customisation is; that's why we give you the opportunity to design your calendar in any way you like.
  • Designed for SwiftUI. While developing the library, we have used the power of SwiftUI to give you powerful tool to speed up your implementation process.

Getting Started

✋ Requirements

Platforms Minimum Swift Version
iOS 14+ 5.0
iPadOS 14+ 5.0
macOS 11+ 5.0
watchOS 7+ 5.0

⏳ Installation

Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.

Once you have your Swift package set up, adding CalendarView as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/Mijick/CalendarView.git", branch(“main”))
]

Cocoapods is a dependency manager for Swift and Objective-C Cocoa projects that helps to scale them elegantly.

Installation steps:

    pod init
  • Add CocoaPods dependency into your Podfile
    pod 'MijickCalendarView'
  • Install dependency and generate .xcworkspace file
    pod install
  • Use new XCode project file .xcworkspace

Usage

1. Call initialiser

To declare a CalendarView, call the constructor:

struct ContentView: View {
    @State private var selectedDate: Data? = nil
    @State private var selectedRange: MDateRange? = .init()

    var body: some View {
        MCalendarView(selectedDate: $selectedDate, selectedRange: $selectedRange)
    }
}

2. Customise Calendar

Your MCalendarView can be customised by calling configBuilder inside the initialiser:

struct ContentView: View {
    @State private var selectedDate: Data? = nil
    @State private var selectedRange: MDateRange? = .init()

    var body: some View {
        MCalendarView(selectedDate: nil, selectedRange: $selectedRange) {
            $0
                (...)
                .dayView(NewDayView.init)
                .firstWeekday(.wednesday)
                .monthLabelToDaysDistance(12)
                .weekdaysView(NewWeekdaysView.init)
                (...)
        }
    }
}

3. Customizing WeekdaysView / WeekdayLabel / MonthLabel / DayView

Each calendar element can be easily customised by creating your own view by inheriting the protocol (check Demo Project for more details).


Try our demo

See for yourself how does it work by cloning project we created

License

CalendarView is released under the MIT license. See LICENSE for details.



Our other open source SwiftUI libraries

PopupView - The most powerful popup library that allows you to present any popup
Navigattie - Easier and cleaner way of navigating through your app
GridView - Lay out your data with no effort
Timer - Modern API for Timer

calendarview's People

Contributors

fulcrumone avatar jay-jay-lama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

calendarview's Issues

scrollToDate not working correctly when resizing daylabels

I have custom dayviews which have a frame height of 300; that means that by far not the full month is visible at once. When I try to scroll to the current date (which is the month' last currently) the scrollview is centered to the current month. I found the according line in the code, it seems as if this is intended behavior.

But wouldn't it make more sense if the given date is centered instead of the current month? Or at least provide an option to achieve this behavior?

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.