Swiftpack.co - nashysolutions/Calendar as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by nashysolutions.
nashysolutions/Calendar 1.1.1
A skinable calendar menu.
⭐️ 0
🕓 1 week ago
iOS
.package(url: "https://github.com/nashysolutions/Calendar.git", from: "1.1.1")

Calendar

A skinnable calendar.

Usage

The onus is on the implementing developer to build the following.

  • 4 x UICollectionViewCell subclasses representing DayPositions.
  • 2 x UICollectionReusableView subclasses representing TitlePositions.

Take a look at the SummerSnowflake example.

let dayTypes = DayPosition.allCases.map { SummerSnowflake.userInterface(for: $0) }
let titleTypes = TitlePosition.allCases.map { SummerSnowflake.userInterface(for: $0) }
let userInterface = UserInterface(dayTypes: dayTypes, titleTypes: titleTypes)

do {
    let calendarView = try PagingGridView(startDate: start, endDate: end, userInterface: userInterface)
    calendarView.backgroundColor = backgroundColor
    // add subview
} catch let error as PagingGridView.Error {
    handleError(error) // The date ranges must make sense.
} catch let error as UserInterface.Error {
    handleError(error) // All UI elements must be present.
} catch {
    fatalError("Unexpected error.")
}

// Switch over the error cases or print like this.
private func handleError(_ error: LocalizedError) {
    let errorDescription = error.errorDescription!
    let failureReason = error.failureReason!
    let recoverySuggestion = error.recoverySuggestion!
    fatalError(errorDescription + failureReason + recoverySuggestion)
}

// Find the current selection like so
let date = calendarView.currentSelection?.date

Demo

A demo App is available here.

Tap the following image to launch Appetize.

Appetize

Installation

List this package in your Package.swift manifest file as a Swift Package dependency. Releases Page.

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Release 1.1.1
1 week ago

Some refactoring.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics