Commit f2bafb84 by Daniel Dahan

removing Reminders for later release

parent b45ffad6
...@@ -32,18 +32,13 @@ import UIKit ...@@ -32,18 +32,13 @@ import UIKit
import Material import Material
class AppMenuController: MenuController { class AppMenuController: MenuController {
/// Menu diameter.
private let baseSize = CGSize(width: 56, height: 56) private let baseSize = CGSize(width: 56, height: 56)
/// Menu bottom inset.
private let bottomInset: CGFloat = 24 private let bottomInset: CGFloat = 24
/// Menu right inset.
private let rightInset: CGFloat = 24 private let rightInset: CGFloat = 24
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
view.backgroundColor = Color.black view.backgroundColor = Color.grey.lighten5
prepareMenu() prepareMenu()
} }
...@@ -58,7 +53,6 @@ class AppMenuController: MenuController { ...@@ -58,7 +53,6 @@ class AppMenuController: MenuController {
menu.views.first?.animate(animation: Animation.rotate(angle: 0)) menu.views.first?.animate(animation: Animation.rotate(angle: 0))
} }
/// Prepares the menuView.
private func prepareMenu() { private func prepareMenu() {
menu.baseSize = baseSize menu.baseSize = baseSize
......
...@@ -32,13 +32,8 @@ import UIKit ...@@ -32,13 +32,8 @@ import UIKit
import Material import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
/// A reference to the addButton.
internal var addButton: FabButton! internal var addButton: FabButton!
/// A reference to the audioLibraryMenuItem.
internal var audioLibraryMenuItem: MenuItem! internal var audioLibraryMenuItem: MenuItem!
/// A reference to the reminderMenuItem.
internal var reminderMenuItem: MenuItem! internal var reminderMenuItem: MenuItem!
open override func viewDidLoad() { open override func viewDidLoad() {
...@@ -73,22 +68,19 @@ class RootViewController: UIViewController { ...@@ -73,22 +68,19 @@ class RootViewController: UIViewController {
} }
} }
/// Prepares the addButton.
private func prepareAddButton() { private func prepareAddButton() {
addButton = FabButton(image: Icon.cm.add, tintColor: Color.white) addButton = FabButton(image: Icon.cm.add, tintColor: Color.white)
addButton.backgroundColor = Color.blue.base
addButton.addTarget(self, action: #selector(handleToggleMenu), for: .touchUpInside) addButton.addTarget(self, action: #selector(handleToggleMenu), for: .touchUpInside)
} }
/// Prepares the audioLibraryButton.
private func prepareAudioLibraryButton() { private func prepareAudioLibraryButton() {
audioLibraryMenuItem = MenuItem() audioLibraryMenuItem = MenuItem()
audioLibraryMenuItem.button.image = Icon.cm.audioLibrary audioLibraryMenuItem.button.image = Icon.cm.audioLibrary
audioLibraryMenuItem.button.backgroundColor = Color.blue.base audioLibraryMenuItem.button.backgroundColor = Color.green.base
audioLibraryMenuItem.button.depthPreset = .depth1
audioLibraryMenuItem.title = "Audio Library" audioLibraryMenuItem.title = "Audio Library"
} }
/// Prepares the bellButton.
private func prepareBellButton() { private func prepareBellButton() {
reminderMenuItem = MenuItem() reminderMenuItem = MenuItem()
reminderMenuItem.button.image = Icon.cm.bell reminderMenuItem.button.image = Icon.cm.bell
...@@ -96,7 +88,6 @@ class RootViewController: UIViewController { ...@@ -96,7 +88,6 @@ class RootViewController: UIViewController {
reminderMenuItem.title = "Reminders" reminderMenuItem.title = "Reminders"
} }
/// Prepares the menuController.
private func prepareMenuController() { private func prepareMenuController() {
guard let mc = menuController as? AppMenuController else { guard let mc = menuController as? AppMenuController else {
return return
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RemindersController.xcodeproj">
</FileRef>
</Workspace>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func applicationDidFinishLaunching(_ application: UIApplication) {
window = UIWindow(frame: Device.bounds)
window!.rootViewController = AppNavigationController(rootViewController: RemindersListViewController())
window!.makeKeyAndVisible()
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class AppNavigationController: NavigationController {
open override func prepare() {
super.prepare()
statusBarStyle = .default
prepareNavigationBar()
}
/// Prepares the navigationBar.
private func prepareNavigationBar() {
guard let v = navigationBar as? NavigationBar else {
return
}
v.depthPreset = .none
v.dividerColor = Color.grey.lighten3
}
}
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSRemindersUsageDescription</key>
<string>May I access your reminders?</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RemindersItemsCollectionView: UICollectionView {
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
super.init(frame: frame, collectionViewLayout: layout)
prepare()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
prepare()
}
func prepare() {
register(RemindersItemsCollectionViewCell.self, forCellWithReuseIdentifier: "RemindersItemsCollectionViewCell")
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RemindersItemsCollectionViewCell: CollectionViewCell {
/// A reference to the textLabel.
public private(set) lazy var textLabel: UILabel = UILabel()
/// A reference to the countLabel.
public private(set) lazy var countLabel: UILabel = UILabel()
open override func prepare() {
super.prepare()
prepareTextLabel()
prepareDivider()
}
/// Prepares the textLabel.
private func prepareTextLabel() {
textLabel.font = RobotoFont.regular
layout(textLabel).edges(top: 24, left: 24, bottom: 24, right: 24)
}
/// Prepares the divider.
private func prepareDivider() {
dividerColor = Color.grey.lighten3
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RemindersItemsViewController: UIViewController {
/// A reference to a RemindersDataSource.
internal var dataSource: RemindersDataSource!
/// A reference to the dateFormatter.
internal var dateFormatter: DateFormatter!
/// A collectionView used to display entries.
internal var collectionView: RemindersItemsCollectionView!
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
init(dataSource: RemindersDataSource) {
super.init(nibName: nil, bundle: nil)
self.dataSource = dataSource
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = Color.white
prepareDateFormatter()
prepareNavigationItem()
prepareCollectionView()
}
private func prepareNavigationItem() {
navigationItem.title = dataSource.list.title
navigationItem.detail = dataSource.list.source.title
navigationItem.titleLabel.textColor = Color.blueGrey.base
navigationItem.detailLabel.textColor = Color.blueGrey.lighten1
}
/// Prepares the collectionView.
private func prepareCollectionView() {
let layout = UICollectionViewFlowLayout()
layout.minimumLineSpacing = 1
layout.minimumInteritemSpacing = 1
layout.scrollDirection = .vertical
layout.itemSize = CGSize(width: view.bounds.width, height: 88)
collectionView = RemindersItemsCollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = Color.clear
collectionView.delegate = self
collectionView.dataSource = self
view.layout(collectionView).edges()
}
/// Prepares the dateFormatter.
private func prepareDateFormatter() {
dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .none
}
}
/// UICollectionViewDelegate methods.
extension RemindersItemsViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
}
/// CollectionViewDataSource methods.
extension RemindersItemsViewController: UICollectionViewDataSource {
/// Determines the number of items in the collectionView.
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1
}
/// Returns the number of sections.
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1 // dataSource.items.count
}
/// Prepares the cells within the collectionView.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RemindersItemsCollectionViewCell", for: indexPath) as! RemindersItemsCollectionViewCell
let item = dataSource.items.last!
cell.textLabel.text = item.title
return cell
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RemindersListCollectionView: UICollectionView {
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
super.init(frame: frame, collectionViewLayout: layout)
prepare()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
prepare()
}
func prepare() {
register(RemindersListCollectionViewCell.self, forCellWithReuseIdentifier: "RemindersListCollectionViewCell")
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RemindersListCollectionViewCell: CollectionViewCell {
/// A reference to the titleLabel.
public private(set) lazy var titleLabel: UILabel = UILabel()
/// A reference to the countLabel.
public private(set) lazy var countLabel: UILabel = UILabel()
open override func prepare() {
super.prepare()
prepareTitleLabel()
prepareCountLabel()
prepareDivider()
}
/// Prepares the titleLabel.
private func prepareTitleLabel() {
titleLabel.font = RobotoFont.regular(with: 22)
layout(titleLabel).edges(top: 24, left: 24, bottom: 24, right: 24)
}
/// Prepares the countLabel.
private func prepareCountLabel() {
countLabel.font = RobotoFont.regular(with: 22)
countLabel.textAlignment = .right
layout(countLabel).edges(top: 24, left: 24, bottom: 24, right: 24)
}
/// Prepares the divider.
private func prepareDivider() {
dividerColor = Color.grey.lighten3
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
import EventKit
public struct RemindersDataSource {
/// A reference to an EKCalendar returned from the fetchResult.
public private(set) var list: EKCalendar
/// A reference to an Array of EKReminders for the EKCalendar.
public private(set) var items: [EKReminder]
}
class RemindersListViewController: RemindersController {
/// A collectionView used to display entries.
internal var collectionView: RemindersListCollectionView!
/// An Array of ReminderDataSource items.
internal lazy var dataSourceItems = [RemindersDataSource]()
open override func prepare() {
super.prepare()
view.backgroundColor = Color.white
prepareNavigationItem()
prepareCollectionView()
reminders.requestAuthorization()
}
private func prepareNavigationItem() {
navigationItem.title = "Reminders"
navigationItem.titleLabel.textColor = Color.blueGrey.base
navigationItem.detail = "Lists"
}
/// Prepares the collectionView.
private func prepareCollectionView() {
let layout = UICollectionViewFlowLayout()
layout.minimumLineSpacing = 1
layout.minimumInteritemSpacing = 1
layout.scrollDirection = .vertical
layout.itemSize = CGSize(width: view.bounds.width, height: 88)
collectionView = RemindersListCollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = Color.clear
collectionView.delegate = self
collectionView.dataSource = self
view.layout(collectionView).edges()
}
}
extension RemindersListViewController {
func reminders(reminders: Reminders, status: RemindersAuthorizationStatus) {
print("Status", .authorized == status ? "Authorized" : "Denied")
}
func reminders(authorized reminders: Reminders) {
fetchLists { [weak self] in
self?.collectionView.reloadData()
}
}
func reminders(denied reminders: Reminders) {
print("Denied")
}
func reminders(reminders: Reminders, list: EKCalendar, created: Bool) {
}
func reminders(reminders: Reminders, list: EKCalendar, deleted: Bool) {
}
func reminders(reminders: Reminders, created: Bool) {
}
func reminders(reminders: Reminders, deleted: Bool) {
}
}
extension RemindersListViewController {
internal func fetchLists(completion: @escaping () -> Void) {
DispatchQueue.global(qos: .default).async { [weak self, completion = completion] in
guard let s = self else {
return
}
s.reminders.fetchLists { [weak self, completion = completion] (lists) in
guard let s = self else {
return
}
s.dataSourceItems.removeAll()
let endIndex = lists.count - 1
for i in 0...endIndex {
let list = lists[i]
s.reminders.fetchReminders(list: list) { [weak self, completion = completion] (reminders) in
guard let s = self else {
return
}
s.dataSourceItems.append(RemindersDataSource(list: list, items: reminders))
if i == endIndex {
completion()
}
}
}
}
}
}
}
/// UICollectionViewDelegate methods.
extension RemindersListViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
navigationController?.pushViewController(RemindersItemsViewController(dataSource: dataSourceItems[indexPath.section]), animated: true)
}
}
/// CollectionViewDataSource methods.
extension RemindersListViewController: UICollectionViewDataSource {
/// Determines the number of items in the collectionView.
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1
}
/// Returns the number of sections.
func numberOfSections(in collectionView: UICollectionView) -> Int {
return dataSourceItems.count
}
/// Prepares the cells within the collectionView.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RemindersListCollectionViewCell", for: indexPath) as! RemindersListCollectionViewCell
let dataSource = dataSourceItems[indexPath.section]
let list = dataSource.list
let items = dataSource.items
cell.titleLabel.text = list.title
cell.titleLabel.textColor = UIColor(cgColor: list.cgColor)
cell.countLabel.text = "1"
cell.countLabel.textColor = UIColor(cgColor: list.cgColor)
return cell
}
}
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
961EFC581D738FF600E84652 /* SnackbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961EFC571D738FF600E84652 /* SnackbarController.swift */; }; 961EFC581D738FF600E84652 /* SnackbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961EFC571D738FF600E84652 /* SnackbarController.swift */; };
961F18E81CD93E3E008927C5 /* ErrorTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961F18E71CD93E3E008927C5 /* ErrorTextField.swift */; }; 961F18E81CD93E3E008927C5 /* ErrorTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961F18E71CD93E3E008927C5 /* ErrorTextField.swift */; };
96230AB81D6A520C00AF47DC /* Divider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; }; 96230AB81D6A520C00AF47DC /* Divider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96230AB71D6A520C00AF47DC /* Divider.swift */; };
96264BE71D833D2800576F37 /* Reminders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96264BE61D833D2800576F37 /* Reminders.swift */; };
96264BE91D833D3400576F37 /* RemindersController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96264BE81D833D3400576F37 /* RemindersController.swift */; };
9628645A1D53FE3E00690B69 /* Material+UIWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 962864591D53FE3E00690B69 /* Material+UIWindow.swift */; }; 9628645A1D53FE3E00690B69 /* Material+UIWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 962864591D53FE3E00690B69 /* Material+UIWindow.swift */; };
9628645F1D540AF300690B69 /* DynamicFontType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9628645E1D540AF300690B69 /* DynamicFontType.swift */; }; 9628645F1D540AF300690B69 /* DynamicFontType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9628645E1D540AF300690B69 /* DynamicFontType.swift */; };
9631A7C11D95E3AC00CFB109 /* PresenterCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */; }; 9631A7C11D95E3AC00CFB109 /* PresenterCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */; };
...@@ -39,8 +37,6 @@ ...@@ -39,8 +37,6 @@
9697F7C61D8F2573004741EC /* PageTabBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963FBF071D669D14008F8512 /* PageTabBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7C61D8F2573004741EC /* PageTabBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963FBF071D669D14008F8512 /* PageTabBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C71D8F2573004741EC /* PhotoLibrary.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96EA9A421D4E68F80052C74D /* PhotoLibrary.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7C71D8F2573004741EC /* PhotoLibrary.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96EA9A421D4E68F80052C74D /* PhotoLibrary.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C81D8F2573004741EC /* PhotoLibraryController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96EA9A4A1D4E7A430052C74D /* PhotoLibraryController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7C81D8F2573004741EC /* PhotoLibraryController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96EA9A4A1D4E7A430052C74D /* PhotoLibraryController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7C91D8F2573004741EC /* Reminders.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96264BE61D833D2800576F37 /* Reminders.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7CA1D8F2573004741EC /* RemindersController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96264BE81D833D3400576F37 /* RemindersController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7CB1D8F2573004741EC /* Snackbar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963FBEFC1D669510008F8512 /* Snackbar.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7CB1D8F2573004741EC /* Snackbar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963FBEFC1D669510008F8512 /* Snackbar.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7CC1D8F2573004741EC /* SnackbarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 961EFC571D738FF600E84652 /* SnackbarController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7CC1D8F2573004741EC /* SnackbarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 961EFC571D738FF600E84652 /* SnackbarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9697F7CD1D8F2582004741EC /* Color.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9661222D1D3EC414008BB4CB /* Color.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9697F7CD1D8F2582004741EC /* Color.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9661222D1D3EC414008BB4CB /* Color.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -213,8 +209,6 @@ ...@@ -213,8 +209,6 @@
961EFC571D738FF600E84652 /* SnackbarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnackbarController.swift; sourceTree = "<group>"; }; 961EFC571D738FF600E84652 /* SnackbarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnackbarController.swift; sourceTree = "<group>"; };
961F18E71CD93E3E008927C5 /* ErrorTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorTextField.swift; sourceTree = "<group>"; }; 961F18E71CD93E3E008927C5 /* ErrorTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorTextField.swift; sourceTree = "<group>"; };
96230AB71D6A520C00AF47DC /* Divider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Divider.swift; sourceTree = "<group>"; }; 96230AB71D6A520C00AF47DC /* Divider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Divider.swift; sourceTree = "<group>"; };
96264BE61D833D2800576F37 /* Reminders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reminders.swift; sourceTree = "<group>"; };
96264BE81D833D3400576F37 /* RemindersController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemindersController.swift; sourceTree = "<group>"; };
962864591D53FE3E00690B69 /* Material+UIWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIWindow.swift"; sourceTree = "<group>"; }; 962864591D53FE3E00690B69 /* Material+UIWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIWindow.swift"; sourceTree = "<group>"; };
9628645E1D540AF300690B69 /* DynamicFontType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DynamicFontType.swift; sourceTree = "<group>"; }; 9628645E1D540AF300690B69 /* DynamicFontType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DynamicFontType.swift; sourceTree = "<group>"; };
9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresenterCard.swift; sourceTree = "<group>"; }; 9631A7C01D95E3AC00CFB109 /* PresenterCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresenterCard.swift; sourceTree = "<group>"; };
...@@ -370,15 +364,6 @@ ...@@ -370,15 +364,6 @@
name = Bar; name = Bar;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96264BE51D833CFF00576F37 /* Reminders */ = {
isa = PBXGroup;
children = (
96264BE61D833D2800576F37 /* Reminders.swift */,
96264BE81D833D3400576F37 /* RemindersController.swift */,
);
name = Reminders;
sourceTree = "<group>";
};
962DDD071D6FBBB7001C307C /* Page */ = { 962DDD071D6FBBB7001C307C /* Page */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -543,7 +528,6 @@ ...@@ -543,7 +528,6 @@
962DDD071D6FBBB7001C307C /* Page */, 962DDD071D6FBBB7001C307C /* Page */,
96EA9A411D4E68E60052C74D /* PhotoLibrary */, 96EA9A411D4E68E60052C74D /* PhotoLibrary */,
9631A7C51D95E5C400CFB109 /* Pulse */, 9631A7C51D95E5C400CFB109 /* Pulse */,
96264BE51D833CFF00576F37 /* Reminders */,
963FBF031D6696EF008F8512 /* SearchBar */, 963FBF031D6696EF008F8512 /* SearchBar */,
963FBEFB1D6694E8008F8512 /* Snackbar */, 963FBEFB1D6694E8008F8512 /* Snackbar */,
967A48171D0F424B00B8CEB7 /* StatusBar */, 967A48171D0F424B00B8CEB7 /* StatusBar */,
...@@ -855,8 +839,6 @@ ...@@ -855,8 +839,6 @@
9697F7C61D8F2573004741EC /* PageTabBarController.swift in Headers */, 9697F7C61D8F2573004741EC /* PageTabBarController.swift in Headers */,
9697F7C71D8F2573004741EC /* PhotoLibrary.swift in Headers */, 9697F7C71D8F2573004741EC /* PhotoLibrary.swift in Headers */,
9697F7C81D8F2573004741EC /* PhotoLibraryController.swift in Headers */, 9697F7C81D8F2573004741EC /* PhotoLibraryController.swift in Headers */,
9697F7C91D8F2573004741EC /* Reminders.swift in Headers */,
9697F7CA1D8F2573004741EC /* RemindersController.swift in Headers */,
9697F7CB1D8F2573004741EC /* Snackbar.swift in Headers */, 9697F7CB1D8F2573004741EC /* Snackbar.swift in Headers */,
9697F7CC1D8F2573004741EC /* SnackbarController.swift in Headers */, 9697F7CC1D8F2573004741EC /* SnackbarController.swift in Headers */,
); );
...@@ -1082,7 +1064,6 @@ ...@@ -1082,7 +1064,6 @@
96230AB81D6A520C00AF47DC /* Divider.swift in Sources */, 96230AB81D6A520C00AF47DC /* Divider.swift in Sources */,
96BCB7C41CB40DC500C806FE /* Font.swift in Sources */, 96BCB7C41CB40DC500C806FE /* Font.swift in Sources */,
96BCB7AA1CB40DC500C806FE /* Grid.swift in Sources */, 96BCB7AA1CB40DC500C806FE /* Grid.swift in Sources */,
96264BE91D833D3400576F37 /* RemindersController.swift in Sources */,
96BCB7E71CB40DC500C806FE /* TextView.swift in Sources */, 96BCB7E71CB40DC500C806FE /* TextView.swift in Sources */,
96BCB7C31CB40DC500C806FE /* EdgeInsets.swift in Sources */, 96BCB7C31CB40DC500C806FE /* EdgeInsets.swift in Sources */,
96BCB7CE1CB40DC500C806FE /* CornerRadius.swift in Sources */, 96BCB7CE1CB40DC500C806FE /* CornerRadius.swift in Sources */,
...@@ -1091,7 +1072,6 @@ ...@@ -1091,7 +1072,6 @@
96BCB7D81CB40DC500C806FE /* MenuController.swift in Sources */, 96BCB7D81CB40DC500C806FE /* MenuController.swift in Sources */,
96BCB7D41CB40DC500C806FE /* TransitionAnimation.swift in Sources */, 96BCB7D41CB40DC500C806FE /* TransitionAnimation.swift in Sources */,
967A48191D0F425A00B8CEB7 /* StatusBarController.swift in Sources */, 967A48191D0F425A00B8CEB7 /* StatusBarController.swift in Sources */,
96264BE71D833D2800576F37 /* Reminders.swift in Sources */,
96BCB7C21CB40DC500C806FE /* Device.swift in Sources */, 96BCB7C21CB40DC500C806FE /* Device.swift in Sources */,
96BCB7A41CB40DC500C806FE /* CaptureSession.swift in Sources */, 96BCB7A41CB40DC500C806FE /* CaptureSession.swift in Sources */,
963FBF081D669D14008F8512 /* PageTabBarController.swift in Sources */, 963FBF081D669D14008F8512 /* PageTabBarController.swift in Sources */,
......
...@@ -101,8 +101,6 @@ open class MenuItem: View { ...@@ -101,8 +101,6 @@ open class MenuItem: View {
titleLabel.backgroundColor = Color.white titleLabel.backgroundColor = Color.white
titleLabel.depthPreset = button.depthPreset titleLabel.depthPreset = button.depthPreset
titleLabel.cornerRadiusPreset = .cornerRadius1 titleLabel.cornerRadiusPreset = .cornerRadius1
titleLabel.shapePreset = .none
titleLabel.clipsToBounds = true
addSubview(titleLabel) addSubview(titleLabel)
} }
} }
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
open class RemindersController: UIViewController {
/// A reference to a Reminder.
open private(set) lazy var reminders: Reminders = Reminders()
open override func viewDidLoad() {
super.viewDidLoad()
prepare()
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method
to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open func prepare() {
view.clipsToBounds = true
view.backgroundColor = Color.white
view.contentScaleFactor = Device.scale
prepareReminder()
}
/// Prepares the reminder.
private func prepareReminder() {
reminders.delegate = self
}
}
extension RemindersController: RemindersDelegate {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment