-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
227 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# CHANGELOG | ||
|
||
The changelog for `Pai`. Also see the [releases](https://github.com/lkmfz/Pai/releases) on GitHub. | ||
The changelog for `Pai`. Also see the [releases](https://github.com/kaodim/Pai/releases) on GitHub. | ||
|
||
-------------------------------------- | ||
|
||
## Upcoming Releases | ||
|
||
### [Pre-release 0.1.0](https://github.com/lkmfz/Ubud/releases/tag/0.1.0) | ||
### [Pre-release 0.1.0](https://github.com/kaodim/Pai/releases/tag/0.1.0) | ||
|
||
### [Pre-release 0.2.0](https://github.com/kaodim/Pai/releases/tag/0.2.0) | ||
* Alignment user interface & specs according to [Kaodim](https://github.com/kaodim) product needs. | ||
* Ownership transfer of the project to [Kaodim](https://github.com/kaodim). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'Pai' | ||
s.version = '0.1.0' | ||
s.version = '0.2.0' | ||
s.license = { :type => "MIT", :file => "LICENSE.md" } | ||
|
||
s.summary = 'Calendar view library for iOS.' | ||
s.homepage = 'https://github.com/lkmfz/Pai' | ||
s.social_media_url = 'https://twitter.com/lkmfz' | ||
s.author = { "Luqman Fauzi" => "[email protected]" } | ||
s.homepage = 'https://github.com/kaodim/Pai' | ||
s.author = { "Kaodim" => "[email protected]" } | ||
|
||
s.source = { :git => 'https://github.com/lkmfz/Pai.git', :tag => s.version } | ||
s.source = { :git => 'https://github.com/kaodim/Pai.git', :tag => s.version } | ||
s.source_files = 'Pai/Sources/**/*.swift' | ||
|
||
s.pod_target_xcconfig = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// PaiMonthEvent.swift | ||
// Pai | ||
// | ||
// Created by augustius cokroe on 23/03/2018. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct PaiMonthEvent { | ||
|
||
public let monthYearStr: String // yyyy M | ||
|
||
public let monthEvents: [PaiDateEvent] | ||
|
||
/// Initlizer of the struct | ||
/// | ||
/// - Parameters: | ||
/// - monthYearStr: date of event in `yyyy M` format | ||
/// - monthEvents: array of PaiDateEvent object | ||
public static func initObject(monthYearStr: String, monthEvents: [PaiDateEvent]) -> PaiMonthEvent { | ||
return PaiMonthEvent(monthYearStr: monthYearStr, monthEvents: monthEvents) | ||
} | ||
} | ||
|
||
public extension PaiMonthEvent { | ||
/// Generate random events | ||
/// | ||
/// - Parameters: | ||
/// - numberOfEvents: `Date` of event | ||
/// - numberOfDays: `[UIColor]` array of tag color | ||
/// - monthYearArr: `[String]` array of string of date with format `yyyy M` | ||
public static func generateRandom(numberOfEvents: Int, numberOfDays: Int, monthYearArr: [String]) -> [PaiMonthEvent] { | ||
|
||
/// get array of color for each day | ||
var tagColors = [UIColor]() | ||
for i in 1...numberOfEvents { | ||
let color: UIColor = (i % 2 == 0) ? .red : .blue | ||
tagColors.append(color) | ||
} | ||
|
||
/// get array of PaiMonthEvent with events | ||
var monthEvents: [PaiMonthEvent] = [] | ||
let secondsInDays: TimeInterval = 60 * 60 * 24 | ||
for (index,str) in monthYearArr.enumerated() { | ||
var dayEvents: [PaiDateEvent] = [] | ||
for day in 1...numberOfDays { | ||
var date = Date().addingTimeInterval(Double(day - 1) * secondsInDays) | ||
date = Calendar.current.date(byAdding: .month, value: index, to: date) ?? Date() | ||
let event = PaiDateEvent(date: date, tagColors: tagColors) | ||
dayEvents.append(event) | ||
} | ||
let mEvent = PaiMonthEvent.initObject(monthYearStr: str, monthEvents: dayEvents) | ||
monthEvents.append(mEvent) | ||
} | ||
|
||
return monthEvents | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.