Git Product home page Git Product logo

gouthamansriniv / sscalendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stevenpreston/sscalendar

0.0 2.0 0.0 4.87 MB

A Swift and Objective-C compatible iOS calendar UI library that can be used to display a calendar of events within your app. Note that this calendar is not designed as a picker but rather to display an existing set of events.

Home Page: http://www.stellar16.com

License: MIT License

Ruby 0.46% Objective-C 38.69% Swift 50.49% C 6.21% Shell 4.14%

sscalendar's Introduction

SSCalendar

Version License Platform

Introduction

SSCalendar is a UI library that can be used to display a calendar of events within your app. This calendar library was originally built in 2013 for a project that required a calendar experience similar to the revamped Apple calendar app in iOS 7. At the time, I found very few calendar libraries and decided to build one. Note that this calendar is not designed as a picker but rather to display an existing set of events.

SSCalendar provides 3 different calendar views:

Annual view

Annual

Monthly view

Monthly

Weekly and daily view

Daily/Weekly

Shortfalls

If any interest is shown in the library then I'll work on improving it. In its current state its limited and poorly constructed. Some areas that need work:

  • No tests
  • Inelegent and poorly constructed
  • Difficult to customize
  • Limited features

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 8 and up.

Installation

SSCalendar is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SSCalendar"

Usage

First, import the module:

import SSCalendar

Then, generate data to populate the calendar. Data should be in the form of an array of SSEvent objects:

private func generateEvents() -> [SSEvent] {
  var events: [SSEvent] = []
  for year in 2016...2021 {
    for _ in 1...200 {
      events.append(generateEvent(year));
    }
  }
  return events
}

private func generateEvent(year: Int) -> SSEvent {
  let month = Int(arc4random_uniform(12)) + 1
  let day = Int(arc4random_uniform(28)) + 1

  let event = SSEvent()
  event.startDate = SSCalendarUtils.dateWithYear(year, month: month, day: day)
  event.startTime = "09:00"
  event.name = "Example Event"
  event.desc = "Details of the event"

  return event
}

Next, instantiate the type of calendar view controller (SSCalendarAnnualViewController or SSCalendarMonthlyViewController) that you want to display; along with the array of events:

let annualViewController = SSCalendarAnnualViewController(events: generateEvents())
let navigationController = UINavigationController(rootViewController: annualViewController)
navigationController.navigationBar.translucent = false
self.presentViewController(navigationController, animated: true, completion: nil)

Author

Steven Preston, [email protected]

License

SSCalendar is available under the MIT license. See the LICENSE file for more info.

sscalendar's People

Contributors

stevenpreston avatar

Watchers

James Cloos avatar Goutham Srinivasan 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.