Code Monkey home page Code Monkey logo

jhcalendar's Introduction

JHCalendar

SwiftUI Customizable Calendar Library

Version badge License

Overview

SwiftUI Customizable Calendar Library.

Download

Use swift package manager.

https://github.com/jaeho0718/JHCalendar > Exact Version 2.0.0

ScreenShot

WeekdayMode MonthMode ScrollDisplayMode
WeekdayMode MonthMode ScrollDisplayMode

Basic

Check Sources/JHCalendar/ExampleView.swift

    import SwiftUI

    struct ContentView : View {

        @StateObject var calendarManager = CalendarManger(mode : .Month,
                                                          startDate : .startDefault,
                                                          endDate : .endDefault,
                                                          startPoint : .current)

        var body : some View {
            JHCalendar(cellHeight : 50) { comp in 
                DefaultCalendarDayView(component: component)
            }
            .environmentObject(calendarManager)
        }
    }

Usage

  • Declare CalendarManager

    • To use JHCalendar,CalendarManager sould be declared. (Important)
        CalendarManger(mode : .Month,startDate: .startDefault, endDate: .endDefault, startPoint: .currentDefault)
    • mode : Calendar mode (Month/Week) (In macos,only support Month mode)
    • startDate : Calendar first date
    • endDate : Calendar last date
    • startPoint : Calendar start point when view appears.
    • you can get page info in CalendarManager.page.current
  • Declare JHCalendar

        JHCalendar(cellHeight : 50) { comp in 
            DefaultCalendarDayView(component: component)
        }
        .environmentObject(calendarManager)
    • content : The view that will be used to display the day content in the calendar. (you can use DefaultCalendarDayView)

    • component : A structure containing specific information about the day.

          struct CalendarComponent {
              var year : Int
              var month : Int
              var day : Int
          }
  • Customize Calendar

    • You can customize all components of calendar by using Modifier.
        JHCalendar(content: { component in 
            DefaultCalendarDayView(component: component)
        })
        .customWeekdaySymbols(symbols : ["S","M,"T","Wed","T","F","S"])
        .weekdaySymbolColor(color : .primary)
        .weekdayFont(font : .caption2)
        .calendarCellAccentColor(primary : .primary,secondary : .secondary)
        .showTitle(false)
        .showWeekBar(true)
        .calendarDisplayMode(.page)
    view modifier content
    customWeekdaySymbols set custom weekday symbol
    weekdaySymbolColor set weekday color
    weekdayFont set weekday font
    calendarCellAccentColor set calendar accent Color.
    showTitle set title visibility
    showWeekBar set weekday visivility
    calendarDisplayMode set calendar displaymode (page/scroll) (only support iOS)

jhcalendar's People

Contributors

jaeho0718 avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

kobeisgod zedom1

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.