Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nighthawk/asweekselectorview
iOS calendar-inspired simple mini week view to swipe through weeks and tap on days
https://github.com/nighthawk/asweekselectorview
Last synced: 15 days ago
JSON representation
iOS calendar-inspired simple mini week view to swipe through weeks and tap on days
- Host: GitHub
- URL: https://github.com/nighthawk/asweekselectorview
- Owner: nighthawk
- License: other
- Created: 2014-04-16T04:35:10.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T01:58:34.000Z (over 2 years ago)
- Last Synced: 2024-10-04T11:58:39.948Z (about 1 month ago)
- Language: Objective-C
- Homepage:
- Size: 548 KB
- Stars: 60
- Watchers: 8
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `ASWeekSelectorView`
[![CocoaPod badge w/ platform](http://cocoapod-badges.herokuapp.com/p/ASWeekSelectorView/badge.png)](http://cocoadocs.org/docsets/ASWeekSelectorView)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/nighthawk/ASWeekSelectorView?display_name=tag&label=spm)
[![CocoaPod badge w/ version](http://cocoapod-badges.herokuapp.com/v/ASWeekSelectorView/badge.png)](http://cocoadocs.org/docsets/ASWeekSelectorView)
![GitHub all releases](https://img.shields.io/github/downloads/nighthawk/ASWeekSelectorView/total)A mini week view to select a day. You can swipe through weeks and tap on a day to select them, somewhat similar to the iOS calendar app (since iOS 7).
It's using the methodology described in Apple's excellent WWDC 2011 session 104 "Advanced ScrollView Techniques".![Week selector](https://github.com/nighthawk/ASWeekSelectorView/raw/main/weekpicker.gif)
# Setup
1) Add to your project.
Using Swift Package Manager:
```swift
.package(url: "https://github.com/nighthawk/ASWeekSelectorView.git", from: "1.0.0")
```Using Cocoapods:
```ruby
pod 'ASWeekSelectorView', '~> 1.0'
```2) Add an instance of `ASWeekSelectorView` to your view hierarchy, configure it, provide a delegate and implement the delegate smethod. (Note that you won't need to use `ASDaySelectionView` and `ASSingleWeekView` yourself - they are internal helper class.)
3) When using Auto Layout, adjust the frame in `viewWillLayoutSubviews`:
```swift
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
weekSelector.frame.size.width = self.view.frame.width
}
``````objective-c
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
CGRect frame = self.weekSelector.frame;
frame.size.width = CGRectGetWidth(self.view.frame);
self.weekSelector.frame = frame;
}
```# Example
See the included example project for a very basic implementation.