Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
f2bafb84
Unverified
Commit
f2bafb84
authored
Oct 01, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing Reminders for later release
parent
b45ffad6
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
3 additions
and
1529 deletions
+3
-1529
Examples/Programmatic/MenuController/MenuController/AppMenuController.swift
+1
-7
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
+2
-11
Examples/Programmatic/RemindersController/RemindersController.xcodeproj/project.pbxproj
+0
-335
Examples/Programmatic/RemindersController/RemindersController.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+0
-7
Examples/Programmatic/RemindersController/RemindersController/AppDelegate.swift
+0
-45
Examples/Programmatic/RemindersController/RemindersController/AppNavigationController.swift
+0
-52
Examples/Programmatic/RemindersController/RemindersController/Assets.xcassets/AppIcon.appiconset/Contents.json
+0
-69
Examples/Programmatic/RemindersController/RemindersController/Base.lproj/LaunchScreen.storyboard
+0
-27
Examples/Programmatic/RemindersController/RemindersController/Info.plist
+0
-48
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsCollectionView.swift
+0
-50
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsCollectionViewCell.swift
+0
-59
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsViewController.swift
+0
-121
Examples/Programmatic/RemindersController/RemindersController/RemindersListCollectionView.swift
+0
-50
Examples/Programmatic/RemindersController/RemindersController/RemindersListCollectionViewCell.swift
+0
-66
Examples/Programmatic/RemindersController/RemindersController/RemindersListViewController.swift
+0
-185
Material.xcodeproj/project.pbxproj
+0
-20
Sources/iOS/MenuItem.swift
+0
-2
Sources/iOS/Reminders.swift
+0
-313
Sources/iOS/RemindersController.swift
+0
-62
No files found.
Examples/Programmatic/MenuController/MenuController/AppMenuController.swift
View file @
f2bafb84
...
...
@@ -32,18 +32,13 @@ import UIKit
import
Material
class
AppMenuController
:
MenuController
{
/// Menu diameter.
private
let
baseSize
=
CGSize
(
width
:
56
,
height
:
56
)
/// Menu bottom inset.
private
let
bottomInset
:
CGFloat
=
24
/// Menu right inset.
private
let
rightInset
:
CGFloat
=
24
open
override
func
prepare
()
{
super
.
prepare
()
view
.
backgroundColor
=
Color
.
black
view
.
backgroundColor
=
Color
.
grey
.
lighten5
prepareMenu
()
}
...
...
@@ -58,7 +53,6 @@ class AppMenuController: MenuController {
menu
.
views
.
first
?
.
animate
(
animation
:
Animation
.
rotate
(
angle
:
0
))
}
/// Prepares the menuView.
private
func
prepareMenu
()
{
menu
.
baseSize
=
baseSize
...
...
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
View file @
f2bafb84
...
...
@@ -32,13 +32,8 @@ import UIKit
import
Material
class
RootViewController
:
UIViewController
{
/// A reference to the addButton.
internal
var
addButton
:
FabButton
!
/// A reference to the audioLibraryMenuItem.
internal
var
audioLibraryMenuItem
:
MenuItem
!
/// A reference to the reminderMenuItem.
internal
var
reminderMenuItem
:
MenuItem
!
open
override
func
viewDidLoad
()
{
...
...
@@ -73,22 +68,19 @@ class RootViewController: UIViewController {
}
}
/// Prepares the addButton.
private
func
prepareAddButton
()
{
addButton
=
FabButton
(
image
:
Icon
.
cm
.
add
,
tintColor
:
Color
.
white
)
addButton
.
backgroundColor
=
Color
.
blue
.
base
addButton
.
addTarget
(
self
,
action
:
#selector(
handleToggleMenu
)
,
for
:
.
touchUpInside
)
}
/// Prepares the audioLibraryButton.
private
func
prepareAudioLibraryButton
()
{
audioLibraryMenuItem
=
MenuItem
()
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"
}
/// Prepares the bellButton.
private
func
prepareBellButton
()
{
reminderMenuItem
=
MenuItem
()
reminderMenuItem
.
button
.
image
=
Icon
.
cm
.
bell
...
...
@@ -96,7 +88,6 @@ class RootViewController: UIViewController {
reminderMenuItem
.
title
=
"Reminders"
}
/// Prepares the menuController.
private
func
prepareMenuController
()
{
guard
let
mc
=
menuController
as?
AppMenuController
else
{
return
...
...
Examples/Programmatic/RemindersController/RemindersController.xcodeproj/project.pbxproj
deleted
100644 → 0
View file @
b45ffad6
// !$*UTF8*$!
{
archiveVersion
=
1
;
classes
=
{
};
objectVersion
=
46
;
objects
=
{
/* Begin PBXBuildFile section */
96784F381D901F610061C06C
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F371D901F610061C06C
/* AppDelegate.swift */
;
};
96784F3A1D901F610061C06C
/* RemindersListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F391D901F610061C06C
/* RemindersListViewController.swift */
;
};
96784F3F1D901F610061C06C
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F3E1D901F610061C06C
/* Assets.xcassets */
;
};
96784F421D901F610061C06C
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F401D901F610061C06C
/* LaunchScreen.storyboard */
;
};
96784FD21D906CF10061C06C
/* RemindersListCollectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FD11D906CF10061C06C
/* RemindersListCollectionView.swift */
;
};
96784FD41D906D2F0061C06C
/* RemindersListCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FD31D906D2F0061C06C
/* RemindersListCollectionViewCell.swift */
;
};
96784FD61D906D780061C06C
/* RemindersItemsViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FD51D906D780061C06C
/* RemindersItemsViewController.swift */
;
};
96784FD81D906DCB0061C06C
/* RemindersItemsCollectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FD71D906DCB0061C06C
/* RemindersItemsCollectionView.swift */
;
};
96784FDA1D906DF60061C06C
/* RemindersItemsCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FD91D906DF60061C06C
/* RemindersItemsCollectionViewCell.swift */
;
};
96784FDC1D906E190061C06C
/* AppNavigationController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FDB1D906E190061C06C
/* AppNavigationController.swift */
;
};
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
96784FE01D906E940061C06C
/* Embed Frameworks */
=
{
isa
=
PBXCopyFilesBuildPhase
;
buildActionMask
=
2147483647
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
96784F341D901F610061C06C
/* RemindersController.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
RemindersController.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96784F371D901F610061C06C
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96784F391D901F610061C06C
/* RemindersListViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersListViewController.swift
;
sourceTree
=
"<group>"
;
};
96784F3E1D901F610061C06C
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
96784F411D901F610061C06C
/* Base */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.storyboard
;
name
=
Base
;
path
=
Base.lproj/LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
96784F431D901F610061C06C
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
96784FD11D906CF10061C06C
/* RemindersListCollectionView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersListCollectionView.swift
;
sourceTree
=
"<group>"
;
};
96784FD31D906D2F0061C06C
/* RemindersListCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersListCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
96784FD51D906D780061C06C
/* RemindersItemsViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersItemsViewController.swift
;
sourceTree
=
"<group>"
;
};
96784FD71D906DCB0061C06C
/* RemindersItemsCollectionView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersItemsCollectionView.swift
;
sourceTree
=
"<group>"
;
};
96784FD91D906DF60061C06C
/* RemindersItemsCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersItemsCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
96784FDB1D906E190061C06C
/* AppNavigationController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppNavigationController.swift
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
96784F311D901F610061C06C
/* Frameworks */
=
{
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
96784F2B1D901F610061C06C
=
{
isa
=
PBXGroup
;
children
=
(
96784F361D901F610061C06C
/* RemindersController */
,
96784F351D901F610061C06C
/* Products */
,
);
sourceTree
=
"<group>"
;
};
96784F351D901F610061C06C
/* Products */
=
{
isa
=
PBXGroup
;
children
=
(
96784F341D901F610061C06C
/* RemindersController.app */
,
);
name
=
Products
;
sourceTree
=
"<group>"
;
};
96784F361D901F610061C06C
/* RemindersController */
=
{
isa
=
PBXGroup
;
children
=
(
96784F371D901F610061C06C
/* AppDelegate.swift */
,
96784FDB1D906E190061C06C
/* AppNavigationController.swift */
,
96784F391D901F610061C06C
/* RemindersListViewController.swift */
,
96784FD11D906CF10061C06C
/* RemindersListCollectionView.swift */
,
96784FD31D906D2F0061C06C
/* RemindersListCollectionViewCell.swift */
,
96784FD51D906D780061C06C
/* RemindersItemsViewController.swift */
,
96784FD71D906DCB0061C06C
/* RemindersItemsCollectionView.swift */
,
96784FD91D906DF60061C06C
/* RemindersItemsCollectionViewCell.swift */
,
96784F3E1D901F610061C06C
/* Assets.xcassets */
,
96784F401D901F610061C06C
/* LaunchScreen.storyboard */
,
96784F431D901F610061C06C
/* Info.plist */
,
);
path
=
RemindersController
;
sourceTree
=
"<group>"
;
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
96784F331D901F610061C06C
/* RemindersController */
=
{
isa
=
PBXNativeTarget
;
buildConfigurationList
=
96784F461D901F610061C06C
/* Build configuration list for PBXNativeTarget "RemindersController" */
;
buildPhases
=
(
96784F301D901F610061C06C
/* Sources */
,
96784F311D901F610061C06C
/* Frameworks */
,
96784F321D901F610061C06C
/* Resources */
,
96784FE01D906E940061C06C
/* Embed Frameworks */
,
);
buildRules
=
(
);
dependencies
=
(
);
name
=
RemindersController
;
productName
=
RemindersController
;
productReference
=
96784F341D901F610061C06C
/* RemindersController.app */
;
productType
=
"com.apple.product-type.application"
;
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
96784F2C1D901F610061C06C
/* Project object */
=
{
isa
=
PBXProject
;
attributes
=
{
LastSwiftUpdateCheck
=
0800
;
LastUpgradeCheck
=
0800
;
ORGANIZATIONNAME
=
CosmicMind
;
TargetAttributes
=
{
96784F331D901F610061C06C
=
{
CreatedOnToolsVersion
=
8.0
;
ProvisioningStyle
=
Automatic
;
};
};
};
buildConfigurationList
=
96784F2F1D901F610061C06C
/* Build configuration list for PBXProject "RemindersController" */
;
compatibilityVersion
=
"Xcode 3.2"
;
developmentRegion
=
English
;
hasScannedForEncodings
=
0
;
knownRegions
=
(
en
,
Base
,
);
mainGroup
=
96784F2B1D901F610061C06C
;
productRefGroup
=
96784F351D901F610061C06C
/* Products */
;
projectDirPath
=
""
;
projectRoot
=
""
;
targets
=
(
96784F331D901F610061C06C
/* RemindersController */
,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
96784F321D901F610061C06C
/* Resources */
=
{
isa
=
PBXResourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
96784F421D901F610061C06C
/* LaunchScreen.storyboard in Resources */
,
96784F3F1D901F610061C06C
/* Assets.xcassets in Resources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
96784F301D901F610061C06C
/* Sources */
=
{
isa
=
PBXSourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
96784FD41D906D2F0061C06C
/* RemindersListCollectionViewCell.swift in Sources */
,
96784FDA1D906DF60061C06C
/* RemindersItemsCollectionViewCell.swift in Sources */
,
96784FD81D906DCB0061C06C
/* RemindersItemsCollectionView.swift in Sources */
,
96784F3A1D901F610061C06C
/* RemindersListViewController.swift in Sources */
,
96784F381D901F610061C06C
/* AppDelegate.swift in Sources */
,
96784FDC1D906E190061C06C
/* AppNavigationController.swift in Sources */
,
96784FD61D906D780061C06C
/* RemindersItemsViewController.swift in Sources */
,
96784FD21D906CF10061C06C
/* RemindersListCollectionView.swift in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
96784F401D901F610061C06C
/* LaunchScreen.storyboard */
=
{
isa
=
PBXVariantGroup
;
children
=
(
96784F411D901F610061C06C
/* Base */
,
);
name
=
LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
96784F441D901F610061C06C
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
CLANG_ANALYZER_NONNULL
=
YES
;
CLANG_CXX_LANGUAGE_STANDARD
=
"gnu++0x"
;
CLANG_CXX_LIBRARY
=
"libc++"
;
CLANG_ENABLE_MODULES
=
YES
;
CLANG_ENABLE_OBJC_ARC
=
YES
;
CLANG_WARN_BOOL_CONVERSION
=
YES
;
CLANG_WARN_CONSTANT_CONVERSION
=
YES
;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE
=
YES_ERROR
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_EMPTY_BODY
=
YES
;
CLANG_WARN_ENUM_CONVERSION
=
YES
;
CLANG_WARN_INFINITE_RECURSION
=
YES
;
CLANG_WARN_INT_CONVERSION
=
YES
;
CLANG_WARN_OBJC_ROOT_CLASS
=
YES_ERROR
;
CLANG_WARN_SUSPICIOUS_MOVES
=
YES
;
CLANG_WARN_UNREACHABLE_CODE
=
YES
;
CLANG_WARN__DUPLICATE_METHOD_MATCH
=
YES
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
COPY_PHASE_STRIP
=
NO
;
DEBUG_INFORMATION_FORMAT
=
dwarf
;
ENABLE_STRICT_OBJC_MSGSEND
=
YES
;
ENABLE_TESTABILITY
=
YES
;
GCC_C_LANGUAGE_STANDARD
=
gnu99
;
GCC_DYNAMIC_NO_PIC
=
NO
;
GCC_NO_COMMON_BLOCKS
=
YES
;
GCC_OPTIMIZATION_LEVEL
=
0
;
GCC_PREPROCESSOR_DEFINITIONS
=
(
"DEBUG=1"
,
"$(inherited)"
,
);
GCC_WARN_64_TO_32_BIT_CONVERSION
=
YES
;
GCC_WARN_ABOUT_RETURN_TYPE
=
YES_ERROR
;
GCC_WARN_UNDECLARED_SELECTOR
=
YES
;
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
10.0
;
MTL_ENABLE_DEBUG_INFO
=
YES
;
ONLY_ACTIVE_ARCH
=
YES
;
SDKROOT
=
iphoneos
;
SWIFT_ACTIVE_COMPILATION_CONDITIONS
=
DEBUG
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
};
name
=
Debug
;
};
96784F451D901F610061C06C
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ALWAYS_SEARCH_USER_PATHS
=
NO
;
CLANG_ANALYZER_NONNULL
=
YES
;
CLANG_CXX_LANGUAGE_STANDARD
=
"gnu++0x"
;
CLANG_CXX_LIBRARY
=
"libc++"
;
CLANG_ENABLE_MODULES
=
YES
;
CLANG_ENABLE_OBJC_ARC
=
YES
;
CLANG_WARN_BOOL_CONVERSION
=
YES
;
CLANG_WARN_CONSTANT_CONVERSION
=
YES
;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE
=
YES_ERROR
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_EMPTY_BODY
=
YES
;
CLANG_WARN_ENUM_CONVERSION
=
YES
;
CLANG_WARN_INFINITE_RECURSION
=
YES
;
CLANG_WARN_INT_CONVERSION
=
YES
;
CLANG_WARN_OBJC_ROOT_CLASS
=
YES_ERROR
;
CLANG_WARN_SUSPICIOUS_MOVES
=
YES
;
CLANG_WARN_UNREACHABLE_CODE
=
YES
;
CLANG_WARN__DUPLICATE_METHOD_MATCH
=
YES
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone Developer"
;
COPY_PHASE_STRIP
=
NO
;
DEBUG_INFORMATION_FORMAT
=
"dwarf-with-dsym"
;
ENABLE_NS_ASSERTIONS
=
NO
;
ENABLE_STRICT_OBJC_MSGSEND
=
YES
;
GCC_C_LANGUAGE_STANDARD
=
gnu99
;
GCC_NO_COMMON_BLOCKS
=
YES
;
GCC_WARN_64_TO_32_BIT_CONVERSION
=
YES
;
GCC_WARN_ABOUT_RETURN_TYPE
=
YES_ERROR
;
GCC_WARN_UNDECLARED_SELECTOR
=
YES
;
GCC_WARN_UNINITIALIZED_AUTOS
=
YES_AGGRESSIVE
;
GCC_WARN_UNUSED_FUNCTION
=
YES
;
GCC_WARN_UNUSED_VARIABLE
=
YES
;
IPHONEOS_DEPLOYMENT_TARGET
=
10.0
;
MTL_ENABLE_DEBUG_INFO
=
NO
;
SDKROOT
=
iphoneos
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
VALIDATE_PRODUCT
=
YES
;
};
name
=
Release
;
};
96784F471D901F610061C06C
/* Debug */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
RemindersController/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.RemindersController
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SWIFT_VERSION
=
3.0
;
};
name
=
Debug
;
};
96784F481D901F610061C06C
/* Release */
=
{
isa
=
XCBuildConfiguration
;
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
RemindersController/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io.cosmicmind.RemindersController
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SWIFT_VERSION
=
3.0
;
};
name
=
Release
;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
96784F2F1D901F610061C06C
/* Build configuration list for PBXProject "RemindersController" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
96784F441D901F610061C06C
/* Debug */
,
96784F451D901F610061C06C
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
96784F461D901F610061C06C
/* Build configuration list for PBXNativeTarget "RemindersController" */
=
{
isa
=
XCConfigurationList
;
buildConfigurations
=
(
96784F471D901F610061C06C
/* Debug */
,
96784F481D901F610061C06C
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
/* End XCConfigurationList section */
};
rootObject
=
96784F2C1D901F610061C06C
/* Project object */
;
}
Examples/Programmatic/RemindersController/RemindersController.xcodeproj/project.xcworkspace/contents.xcworkspacedata
deleted
100644 → 0
View file @
b45ffad6
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version =
"1.0"
>
<FileRef
location =
"self:RemindersController.xcodeproj"
>
</FileRef>
</Workspace>
Examples/Programmatic/RemindersController/RemindersController/AppDelegate.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
()
}
}
Examples/Programmatic/RemindersController/RemindersController/AppNavigationController.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
}
}
Examples/Programmatic/RemindersController/RemindersController/Assets.xcassets/AppIcon.appiconset/Contents.json
deleted
100644 → 0
View file @
b45ffad6
{
"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
Examples/Programmatic/RemindersController/RemindersController/Base.lproj/LaunchScreen.storyboard
deleted
100644 → 0
View file @
b45ffad6
<?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>
Examples/Programmatic/RemindersController/RemindersController/Info.plist
deleted
100644 → 0
View file @
b45ffad6
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
NSRemindersUsageDescription
<
/k
e
y
>
<
string
>
May
I
access
your
reminders
?
<
/string
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
(
EXECUTABLE_NAME
)<
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
$
(
PRODUCT_BUNDLE_IDENTIFIER
)<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
UILaunchStoryboardName
<
/k
e
y
>
<
string
>
LaunchScreen
<
/string
>
<
k
e
y
>
UIRequiredDeviceCapabilities
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
armv7
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
UISupportedInterfaceOrientations
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
string
>
UIInterfaceOrientationPortraitUpsideDown
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
UISupportedInterfaceOrientations
~
ipad
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
UIInterfaceOrientationPortrait
<
/string
>
<
string
>
UIInterfaceOrientationPortraitUpsideDown
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeLeft
<
/string
>
<
string
>
UIInterfaceOrientationLandscapeRight
<
/string
>
<
/
a
rr
a
y
>
<
/
d
i
c
t
>
<
/plist
>
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsCollectionView.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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"
)
}
}
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsCollectionViewCell.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
}
}
Examples/Programmatic/RemindersController/RemindersController/RemindersItemsViewController.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
}
}
Examples/Programmatic/RemindersController/RemindersController/RemindersListCollectionView.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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"
)
}
}
Examples/Programmatic/RemindersController/RemindersController/RemindersListCollectionViewCell.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
}
}
Examples/Programmatic/RemindersController/RemindersController/RemindersListViewController.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
}
}
Material.xcodeproj/project.pbxproj
View file @
f2bafb84
...
...
@@ -10,8 +10,6 @@
961EFC581D738FF600E84652
/* SnackbarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961EFC571D738FF600E84652
/* SnackbarController.swift */
;
};
961F18E81CD93E3E008927C5
/* ErrorTextField.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961F18E71CD93E3E008927C5
/* ErrorTextField.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 */
;
};
9628645F1D540AF300690B69
/* DynamicFontType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9628645E1D540AF300690B69
/* DynamicFontType.swift */
;
};
9631A7C11D95E3AC00CFB109
/* PresenterCard.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9631A7C01D95E3AC00CFB109
/* PresenterCard.swift */
;
};
...
...
@@ -39,8 +37,6 @@
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
,
);
};
};
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
,
);
};
};
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
,
);
};
};
...
...
@@ -213,8 +209,6 @@
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>"
;
};
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>"
;
};
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>"
;
};
...
...
@@ -370,15 +364,6 @@
name
=
Bar
;
sourceTree
=
"<group>"
;
};
96264BE51D833CFF00576F37
/* Reminders */
=
{
isa
=
PBXGroup
;
children
=
(
96264BE61D833D2800576F37
/* Reminders.swift */
,
96264BE81D833D3400576F37
/* RemindersController.swift */
,
);
name
=
Reminders
;
sourceTree
=
"<group>"
;
};
962DDD071D6FBBB7001C307C
/* Page */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -543,7 +528,6 @@
962DDD071D6FBBB7001C307C
/* Page */
,
96EA9A411D4E68E60052C74D
/* PhotoLibrary */
,
9631A7C51D95E5C400CFB109
/* Pulse */
,
96264BE51D833CFF00576F37
/* Reminders */
,
963FBF031D6696EF008F8512
/* SearchBar */
,
963FBEFB1D6694E8008F8512
/* Snackbar */
,
967A48171D0F424B00B8CEB7
/* StatusBar */
,
...
...
@@ -855,8 +839,6 @@
9697F7C61D8F2573004741EC
/* PageTabBarController.swift in Headers */
,
9697F7C71D8F2573004741EC
/* PhotoLibrary.swift in Headers */
,
9697F7C81D8F2573004741EC
/* PhotoLibraryController.swift in Headers */
,
9697F7C91D8F2573004741EC
/* Reminders.swift in Headers */
,
9697F7CA1D8F2573004741EC
/* RemindersController.swift in Headers */
,
9697F7CB1D8F2573004741EC
/* Snackbar.swift in Headers */
,
9697F7CC1D8F2573004741EC
/* SnackbarController.swift in Headers */
,
);
...
...
@@ -1082,7 +1064,6 @@
96230AB81D6A520C00AF47DC
/* Divider.swift in Sources */
,
96BCB7C41CB40DC500C806FE
/* Font.swift in Sources */
,
96BCB7AA1CB40DC500C806FE
/* Grid.swift in Sources */
,
96264BE91D833D3400576F37
/* RemindersController.swift in Sources */
,
96BCB7E71CB40DC500C806FE
/* TextView.swift in Sources */
,
96BCB7C31CB40DC500C806FE
/* EdgeInsets.swift in Sources */
,
96BCB7CE1CB40DC500C806FE
/* CornerRadius.swift in Sources */
,
...
...
@@ -1091,7 +1072,6 @@
96BCB7D81CB40DC500C806FE
/* MenuController.swift in Sources */
,
96BCB7D41CB40DC500C806FE
/* TransitionAnimation.swift in Sources */
,
967A48191D0F425A00B8CEB7
/* StatusBarController.swift in Sources */
,
96264BE71D833D2800576F37
/* Reminders.swift in Sources */
,
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
963FBF081D669D14008F8512
/* PageTabBarController.swift in Sources */
,
...
...
Sources/iOS/MenuItem.swift
View file @
f2bafb84
...
...
@@ -101,8 +101,6 @@ open class MenuItem: View {
titleLabel
.
backgroundColor
=
Color
.
white
titleLabel
.
depthPreset
=
button
.
depthPreset
titleLabel
.
cornerRadiusPreset
=
.
cornerRadius1
titleLabel
.
shapePreset
=
.
none
titleLabel
.
clipsToBounds
=
true
addSubview
(
titleLabel
)
}
}
Sources/iOS/Reminders.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
EventKit
@objc(RemindersAuthorizationStatus)
public
enum
RemindersAuthorizationStatus
:
Int
{
case
authorized
case
denied
}
@objc(RemindersDelegate)
public
protocol
RemindersDelegate
{
/**
A delegation method that is executed when the Reminder status is updated.
- Parameter reminders: A reference to the Reminder.
- Parameter status: A reference to the ReminderAuthorizationStatus.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
status
:
RemindersAuthorizationStatus
)
/**
A delegation method that is executed when Reminders is authorized.
- Parameter reminders: A reference to the Reminders.
*/
@objc
optional
func
reminders
(
authorized
reminders
:
Reminders
)
/**
A delegation method that is executed when Reminders is denied.
- Parameter reminders: A reference to the Reminders.
*/
@objc
optional
func
reminders
(
denied
reminders
:
Reminders
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminders.
- Parameter list: A reference to the calendar created
- Parameter created: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
list
:
EKCalendar
,
created
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter list: A reference to the calendar created
- Parameter deleted: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
list
:
EKCalendar
,
deleted
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter created: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
created
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter deleted: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
deleted
:
Bool
)
}
@objc(Reminders)
open
class
Reminders
:
NSObject
{
/// The current ReminderAuthorizationStatus.
public
var
authorizationStatus
:
RemindersAuthorizationStatus
{
return
.
authorized
==
EKEventStore
.
authorizationStatus
(
for
:
.
reminder
)
?
.
authorized
:
.
denied
}
/// A reference to the eventStore.
internal
lazy
var
eventStore
=
EKEventStore
()
/// A reference to a RemindersDelegate.
open
weak
var
delegate
:
RemindersDelegate
?
open
func
requestAuthorization
(
_
completion
:
((
RemindersAuthorizationStatus
)
->
Void
)?
=
nil
)
{
eventStore
.
requestAccess
(
to
:
.
reminder
)
{
[
weak
self
,
completion
=
completion
]
(
permission
,
_
)
in
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
if
permission
{
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
status
:
.
authorized
)
s
.
delegate
?
.
reminders
?(
authorized
:
s
)
completion
?(
.
authorized
)
}
else
{
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
status
:
.
denied
)
s
.
delegate
?
.
reminders
?(
denied
:
s
)
completion
?(
.
denied
)
}
}
}
}
}
// List CRUD operations
extension
Reminders
{
/**
A method for creating new Reminder lists
- Parameter list title: the name of the list
- Parameter completion: optional completion call back
*/
public
func
create
(
list
title
:
String
,
completion
:
((
Bool
,
Error
?)
->
Void
)?
=
nil
)
{
DispatchQueue
.
global
(
qos
:
.
default
)
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
let
list
=
EKCalendar
(
for
:
.
reminder
,
eventStore
:
s
.
eventStore
)
list
.
title
=
title
for
source
in
s
.
eventStore
.
sources
{
if
.
local
==
source
.
sourceType
{
list
.
source
=
source
var
created
=
false
var
error
:
Error
?
do
{
try
s
.
eventStore
.
saveCalendar
(
list
,
commit
:
true
)
created
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
list
:
list
,
created
:
created
)
completion
?(
created
,
error
)
}
}
}
}
}
/**
A method for deleting existing Reminder lists
- Parameter list identifier: the name of the list
- Parameter completion: optional completion call back
*/
public
func
delete
(
list
identifier
:
String
,
completion
:
((
Bool
,
Error
?)
->
Void
)?
=
nil
)
{
DispatchQueue
.
global
(
qos
:
.
default
)
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
guard
let
list
=
s
.
eventStore
.
calendar
(
withIdentifier
:
identifier
)
else
{
return
}
var
deleted
=
false
var
error
:
Error
?
do
{
try
s
.
eventStore
.
removeCalendar
(
list
,
commit
:
true
)
deleted
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
list
:
list
,
deleted
:
deleted
)
completion
?(
deleted
,
error
)
}
}
}
/**
A method for retrieving reminder lists
- Parameter completion: completion call back
*/
public
func
fetchLists
(
completion
:
([
EKCalendar
])
->
Void
)
{
completion
(
eventStore
.
calendars
(
for
:
.
reminder
))
}
}
// Reminder list CRUD operations
extension
Reminders
{
/**
A method for retrieving reminders from an optionally existing list.
if the list does not exist the reminders will be retrieved from the default reminders list
- Parameter list: An optional EKCalendar.
- Parameter completion: completion call back
*/
public
func
fetchReminders
(
list
:
EKCalendar
,
completion
:
@escaping
([
EKReminder
])
->
Void
)
{
var
lists
=
[
EKCalendar
]()
lists
.
append
(
list
)
eventStore
.
fetchReminders
(
matching
:
eventStore
.
predicateForReminders
(
in
:
lists
))
{
[
completion
=
completion
]
(
reminders
)
in
DispatchQueue
.
main
.
async
{
[
completion
=
completion
]
in
completion
(
reminders
??
[])
}
}
}
// FIX ME: Should we use the calendar identifier here instead of the title for finding the right cal?
/**
A method for adding a new reminder to an optionally existing list.
if the list does not exist it will be added to the default reminders list.
- Parameter completion: optional completion call back
*/
public
func
create
(
title
:
String
,
dateComponents
:
DateComponents
,
in
list
:
EKCalendar
?
=
nil
,
completion
:
((
Error
?)
->
Void
)?
=
nil
)
{
var
reminderCal
=
[
EKCalendar
]()
if
list
!=
nil
{
fetchLists
(
completion
:
{
(
calendars
)
in
for
calendar
in
calendars
{
if
calendar
.
title
==
list
!.
title
{
reminderCal
.
append
(
calendar
)
}
}
})
}
let
reminder
=
EKReminder
(
eventStore
:
eventStore
)
reminder
.
title
=
title
reminder
.
dueDateComponents
=
dateComponents
reminder
.
calendar
=
reminderCal
.
last
!
var
created
:
Bool
=
false
var
error
:
Error
?
do
{
try
eventStore
.
save
(
reminder
,
commit
:
true
)
created
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
created
:
created
)
if
let
c
=
completion
{
c
(
error
)
}
}
}
// FIX ME: Should we use the calendar identifier here instead of the title for finding the right cal?
/**
A method for adding a new reminder to an optionally existing list.
if the list does not exist it will be added to the default reminders list.
- Parameter completion: optional completion call back
*/
public
func
delete
(
reminder
:
EKReminder
,
completion
:
((
Error
?)
->
Void
)?
=
nil
)
{
var
deleted
:
Bool
=
false
var
error
:
Error
?
do
{
try
eventStore
.
remove
(
reminder
,
commit
:
true
)
deleted
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
deleted
:
deleted
)
if
let
c
=
completion
{
c
(
error
)
}
}
}
}
Sources/iOS/RemindersController.swift
deleted
100644 → 0
View file @
b45ffad6
/*
* 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
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment