Code Monkey home page Code Monkey logo

calendarlist's Introduction

CalendarList

Badge Badge Badge Badge

SwiftUI view to display paginated calendar months and list events per selected day.

Features

  • Internationalized, localized reusable SwiftUI calendar view
  • Generic event data type
  • List representation of events for a given day
  • View generation for each event is handled by the parent view
  • Customizable styles for "today" and "selected" dates

Usage

CalendarList takes two main arguments:

  • Array of CalendarEvent elements. This type wraps the date for the event and the actual data you want to use. As long as the data comforms to the Hashable protocol, you can use any type you want.
  • A @ViewBuilder block that will be used to generate the view that represents an event on a given day.

This is a very basic example using String as type for the data and a Text view to represent the event data:

struct ContentView: View {
    var events = [
        CalendarEvent(dateString: "03/21/2020", data: "Event 1"),
        CalendarEvent(dateString: "03/23/2020", data: "Event 2"),
        CalendarEvent(dateString: "03/26/2020", data: "Event 3"),
        CalendarEvent(dateString: "03/26/2020", data: "Event 4"),
    ]
    
    var body: some View {
        CalendarList(events: self.events) { event in
            Text("\(event.data)")
        }
    }
}

This results in the following:

Requirements

  • iOS 13+ / macOS 10.15+
  • Xcode 11+
  • Swift 5+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CalendarList into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'CalendarList', '~> 1.0'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate CalendarList into your Xcode project using Carthage, specify it in your Cartfile:

github "tiusender/CalendarList" ~> 1.0

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Just add the following dependency on your Xcode project:

https://github.com/tiusender/CalendarList.git

Questions or feedback?

Feel free to open an issue, or find me @tiusender on Twitter.

calendarlist's People

Contributors

tiusender 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.