Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nbwar/NWCalendarView
An availability calendar implementation for iOS
https://github.com/nbwar/NWCalendarView
Last synced: 6 days ago
JSON representation
An availability calendar implementation for iOS
- Host: GitHub
- URL: https://github.com/nbwar/NWCalendarView
- Owner: nbwar
- Created: 2015-07-28T19:45:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-03T18:18:04.000Z (over 8 years ago)
- Last Synced: 2024-08-16T04:31:21.893Z (4 months ago)
- Language: Swift
- Homepage:
- Size: 45.9 KB
- Stars: 60
- Watchers: 10
- Forks: 11
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ios - NWCalendarView - An availability calendar implementation for iOS (UI / Calendar)
- awesome-ios-star - NWCalendarView - An availability calendar implementation for iOS (UI / Calendar)
README
# NWCalendarView
NWCalendar View is an iOS control that displays a calendar. It is perfect for appointment or availibilty selection. It allows for selection of a single date or a range. It also allows to disable dates that are unavailable.
## Sample Usage
```swift
@IBOutlet weak var calendarView: NWCalendarView!override func viewDidLoad() {
super.viewDidLoad()calendarView.layer.borderWidth = 1
calendarView.layer.borderColor = UIColor.lightGrayColor().CGColor
calendarView.backgroundColor = UIColor.whiteColor()var date = NSDate()
let newDate = date.dateByAddingTimeInterval(60*60*24*8)
let newDate2 = date.dateByAddingTimeInterval(60*60*24*9)
let newDate3 = date.dateByAddingTimeInterval(60*60*24*30)
calendarView.disabledDates = [newDate, newDate2, newDate3]
calendarView.selectionRangeLength = 7
calendarView.maxMonths = 4
calendarView.delegate = self
calendarView.createCalendar()
}
```## Customization
Make sure to call `createCalendar()` setting your custom options
**disable dates**
```swift
// Takes an array of NSDates
calendarView.disabledDates = [newDate, newDate2, newDate3]
```**Set Max Months**
You may only want to allow going 4 months into the future
```swift
calendarView.maxMonths = 4
```**Set selection Range** (defaults to 0)
```swift
selectionRangeLength = 7
```## Delegate
**didChangeFromMonthToMonth(fromMonth: NSDateComponents, toMonth: NSDateComponents)**
```swift
func didChangeFromMonthToMonth(fromMonth: NSDateComponents, toMonth: NSDateComponents) {
println("Change From month \(fromMonth) to month \(toMonth)")
}
```**didSelectDate(fromDate: NSDateComponents, toDate: NSDateComponents)**
```swift
func didSelectDate(fromDate: NSDateComponents, toDate: NSDateComponents) {
println("Selected date \(fromDate.date!) to date \(toDate.date!)")
}
```## TODO
1. Enable going into the past
2. Dynamic adding of months when scrolling in to past
3. Make all aspects customizable (font, colors, etc..)
4. Turn into cocoapod## License
MIT