From 165fef8bcdf492c7ae28272aa01ac47a565d39c4 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Mon, 3 Dec 2018 16:00:51 +0900 Subject: [PATCH] Initial commit --- .gitignore | 25 ++ holidaycalendar.xcodeproj/project.pbxproj | 377 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + holidaycalendar/Application/AppDelegate.swift | 24 ++ .../Application/HolidayCalendarMenu.swift | 28 ++ .../HolidayCalendarWindowController.swift | 25 ++ holidaycalendar/Application/Utils.swift | 26 ++ holidaycalendar/Application/main.swift | 19 + .../AppIcon.appiconset/Contents.json | 58 +++ holidaycalendar/Assets.xcassets/Contents.json | 6 + ...idayCalendarCollectionViewController.swift | 31 ++ .../HolidayCalendarCollectionViewItem.swift | 160 ++++++++ .../HolidayCalendarDataSource.swift | 24 ++ .../HolidayCalendarFlowLayout.swift | 30 ++ holidaycalendar/Info.plist | 30 ++ .../HolidayCalendarHelpViewController.swift | 28 ++ .../Toolbar/HolidayCalendarToolbar.swift | 46 +++ holidaycalendar/holidaycalendar.entitlements | 10 + 19 files changed, 962 insertions(+) create mode 100644 .gitignore create mode 100644 holidaycalendar.xcodeproj/project.pbxproj create mode 100644 holidaycalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 holidaycalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 holidaycalendar/Application/AppDelegate.swift create mode 100644 holidaycalendar/Application/HolidayCalendarMenu.swift create mode 100644 holidaycalendar/Application/HolidayCalendarWindowController.swift create mode 100644 holidaycalendar/Application/Utils.swift create mode 100644 holidaycalendar/Application/main.swift create mode 100644 holidaycalendar/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 holidaycalendar/Assets.xcassets/Contents.json create mode 100644 holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewController.swift create mode 100644 holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewItem.swift create mode 100644 holidaycalendar/HolidayCalendarView/HolidayCalendarDataSource.swift create mode 100644 holidaycalendar/HolidayCalendarView/HolidayCalendarFlowLayout.swift create mode 100644 holidaycalendar/Info.plist create mode 100644 holidaycalendar/Toolbar/HolidayCalendarHelpViewController.swift create mode 100644 holidaycalendar/Toolbar/HolidayCalendarToolbar.swift create mode 100644 holidaycalendar/holidaycalendar.entitlements diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f9b233 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +.DS_Store diff --git a/holidaycalendar.xcodeproj/project.pbxproj b/holidaycalendar.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ee8622f --- /dev/null +++ b/holidaycalendar.xcodeproj/project.pbxproj @@ -0,0 +1,377 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 2E2E824021A666900059405A /* HolidayCalendarWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E2E823F21A666900059405A /* HolidayCalendarWindowController.swift */; }; + 2E331C8F21A232DF00AD1DD3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E331C8E21A232DF00AD1DD3 /* AppDelegate.swift */; }; + 2E331C9121A232DF00AD1DD3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2E331C9021A232DF00AD1DD3 /* Assets.xcassets */; }; + 2E331C9D21A236B400AD1DD3 /* HolidayCalendarCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E331C9C21A236B400AD1DD3 /* HolidayCalendarCollectionViewController.swift */; }; + 2E331C9F21A23F2C00AD1DD3 /* HolidayCalendarFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E331C9E21A23F2C00AD1DD3 /* HolidayCalendarFlowLayout.swift */; }; + 2E9680AF21B4CC310083AA84 /* HolidayCalendarToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E9680AE21B4CC310083AA84 /* HolidayCalendarToolbar.swift */; }; + 2E9680B121B4CD300083AA84 /* HolidayCalendarCollectionViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E9680B021B4CD300083AA84 /* HolidayCalendarCollectionViewItem.swift */; }; + 2E9680B521B4E84C0083AA84 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E9680B421B4E84C0083AA84 /* Utils.swift */; }; + 2E9680B721B4F63B0083AA84 /* HolidayCalendarHelpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E9680B621B4F63B0083AA84 /* HolidayCalendarHelpViewController.swift */; }; + 2E9680B921B4F7180083AA84 /* HolidayCalendarDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E9680B821B4F7180083AA84 /* HolidayCalendarDataSource.swift */; }; + 2EF97EE321B41E670087AC41 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EF97EE221B41E670087AC41 /* main.swift */; }; + 2EF97EE521B425720087AC41 /* HolidayCalendarMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EF97EE421B425720087AC41 /* HolidayCalendarMenu.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2E2E823F21A666900059405A /* HolidayCalendarWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarWindowController.swift; sourceTree = ""; }; + 2E331C8B21A232DF00AD1DD3 /* holidaycalendar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = holidaycalendar.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2E331C8E21A232DF00AD1DD3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 2E331C9021A232DF00AD1DD3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2E331C9521A232DF00AD1DD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2E331C9621A232DF00AD1DD3 /* holidaycalendar.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = holidaycalendar.entitlements; sourceTree = ""; }; + 2E331C9C21A236B400AD1DD3 /* HolidayCalendarCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarCollectionViewController.swift; sourceTree = ""; }; + 2E331C9E21A23F2C00AD1DD3 /* HolidayCalendarFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarFlowLayout.swift; sourceTree = ""; }; + 2E9680AE21B4CC310083AA84 /* HolidayCalendarToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarToolbar.swift; sourceTree = ""; }; + 2E9680B021B4CD300083AA84 /* HolidayCalendarCollectionViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarCollectionViewItem.swift; sourceTree = ""; }; + 2E9680B421B4E84C0083AA84 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; + 2E9680B621B4F63B0083AA84 /* HolidayCalendarHelpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarHelpViewController.swift; sourceTree = ""; }; + 2E9680B821B4F7180083AA84 /* HolidayCalendarDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarDataSource.swift; sourceTree = ""; }; + 2EF97EE221B41E670087AC41 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; + 2EF97EE421B425720087AC41 /* HolidayCalendarMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HolidayCalendarMenu.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2E331C8821A232DF00AD1DD3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2E331C8221A232DF00AD1DD3 = { + isa = PBXGroup; + children = ( + 2E331C8D21A232DF00AD1DD3 /* holidaycalendar */, + 2E331C8C21A232DF00AD1DD3 /* Products */, + ); + sourceTree = ""; + }; + 2E331C8C21A232DF00AD1DD3 /* Products */ = { + isa = PBXGroup; + children = ( + 2E331C8B21A232DF00AD1DD3 /* holidaycalendar.app */, + ); + name = Products; + sourceTree = ""; + }; + 2E331C8D21A232DF00AD1DD3 /* holidaycalendar */ = { + isa = PBXGroup; + children = ( + 2E9680BC21B4F7CB0083AA84 /* Toolbar */, + 2E9680BB21B4F7B80083AA84 /* HolidayCalendarView */, + 2E9680BA21B4F7930083AA84 /* Application */, + 2E331C9021A232DF00AD1DD3 /* Assets.xcassets */, + 2E331C9521A232DF00AD1DD3 /* Info.plist */, + 2E331C9621A232DF00AD1DD3 /* holidaycalendar.entitlements */, + ); + path = holidaycalendar; + sourceTree = ""; + }; + 2E9680BA21B4F7930083AA84 /* Application */ = { + isa = PBXGroup; + children = ( + 2E9680B421B4E84C0083AA84 /* Utils.swift */, + 2E331C8E21A232DF00AD1DD3 /* AppDelegate.swift */, + 2E2E823F21A666900059405A /* HolidayCalendarWindowController.swift */, + 2EF97EE221B41E670087AC41 /* main.swift */, + 2EF97EE421B425720087AC41 /* HolidayCalendarMenu.swift */, + ); + path = Application; + sourceTree = ""; + }; + 2E9680BB21B4F7B80083AA84 /* HolidayCalendarView */ = { + isa = PBXGroup; + children = ( + 2E331C9C21A236B400AD1DD3 /* HolidayCalendarCollectionViewController.swift */, + 2E331C9E21A23F2C00AD1DD3 /* HolidayCalendarFlowLayout.swift */, + 2E9680B021B4CD300083AA84 /* HolidayCalendarCollectionViewItem.swift */, + 2E9680B821B4F7180083AA84 /* HolidayCalendarDataSource.swift */, + ); + path = HolidayCalendarView; + sourceTree = ""; + }; + 2E9680BC21B4F7CB0083AA84 /* Toolbar */ = { + isa = PBXGroup; + children = ( + 2E9680AE21B4CC310083AA84 /* HolidayCalendarToolbar.swift */, + 2E9680B621B4F63B0083AA84 /* HolidayCalendarHelpViewController.swift */, + ); + path = Toolbar; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2E331C8A21A232DF00AD1DD3 /* holidaycalendar */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2E331C9921A232DF00AD1DD3 /* Build configuration list for PBXNativeTarget "holidaycalendar" */; + buildPhases = ( + 2E331C8721A232DF00AD1DD3 /* Sources */, + 2E331C8821A232DF00AD1DD3 /* Frameworks */, + 2E331C8921A232DF00AD1DD3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = holidaycalendar; + productName = holidaycalendar; + productReference = 2E331C8B21A232DF00AD1DD3 /* holidaycalendar.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2E331C8321A232DF00AD1DD3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1010; + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Ryan McGrath"; + TargetAttributes = { + 2E331C8A21A232DF00AD1DD3 = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 2E331C8621A232DF00AD1DD3 /* Build configuration list for PBXProject "holidaycalendar" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2E331C8221A232DF00AD1DD3; + productRefGroup = 2E331C8C21A232DF00AD1DD3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2E331C8A21A232DF00AD1DD3 /* holidaycalendar */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2E331C8921A232DF00AD1DD3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2E331C9121A232DF00AD1DD3 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2E331C8721A232DF00AD1DD3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2E9680B721B4F63B0083AA84 /* HolidayCalendarHelpViewController.swift in Sources */, + 2E9680B521B4E84C0083AA84 /* Utils.swift in Sources */, + 2E331C9F21A23F2C00AD1DD3 /* HolidayCalendarFlowLayout.swift in Sources */, + 2EF97EE321B41E670087AC41 /* main.swift in Sources */, + 2E2E824021A666900059405A /* HolidayCalendarWindowController.swift in Sources */, + 2E9680B921B4F7180083AA84 /* HolidayCalendarDataSource.swift in Sources */, + 2E331C8F21A232DF00AD1DD3 /* AppDelegate.swift in Sources */, + 2E9680B121B4CD300083AA84 /* HolidayCalendarCollectionViewItem.swift in Sources */, + 2E331C9D21A236B400AD1DD3 /* HolidayCalendarCollectionViewController.swift in Sources */, + 2EF97EE521B425720087AC41 /* HolidayCalendarMenu.swift in Sources */, + 2E9680AF21B4CC310083AA84 /* HolidayCalendarToolbar.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 2E331C9721A232DF00AD1DD3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 2E331C9821A232DF00AD1DD3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 2E331C9A21A232DF00AD1DD3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = holidaycalendar/holidaycalendar.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 8JNDBG9U79; + INFOPLIST_FILE = holidaycalendar/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rymc.holidaycalendar; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + }; + name = Debug; + }; + 2E331C9B21A232DF00AD1DD3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = holidaycalendar/holidaycalendar.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 8JNDBG9U79; + INFOPLIST_FILE = holidaycalendar/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rymc.holidaycalendar; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2E331C8621A232DF00AD1DD3 /* Build configuration list for PBXProject "holidaycalendar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2E331C9721A232DF00AD1DD3 /* Debug */, + 2E331C9821A232DF00AD1DD3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2E331C9921A232DF00AD1DD3 /* Build configuration list for PBXNativeTarget "holidaycalendar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2E331C9A21A232DF00AD1DD3 /* Debug */, + 2E331C9B21A232DF00AD1DD3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2E331C8321A232DF00AD1DD3 /* Project object */; +} diff --git a/holidaycalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/holidaycalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..618534f --- /dev/null +++ b/holidaycalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/holidaycalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/holidaycalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/holidaycalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/holidaycalendar/Application/AppDelegate.swift b/holidaycalendar/Application/AppDelegate.swift new file mode 100644 index 0000000..ff69556 --- /dev/null +++ b/holidaycalendar/Application/AppDelegate.swift @@ -0,0 +1,24 @@ +// +// AppDelegate.swift +// holidaycalendar +// +// Created by Ryan McGrath on 11/18/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class AppDelegate: NSObject, NSApplicationDelegate { + var windowController: HolidayCalendarWindowController? + + func applicationDidFinishLaunching(_ aNotification: Notification) { + NSApp.mainMenu = HolidayCalendarMenu() + windowController = HolidayCalendarWindowController() + windowController?.window?.toolbar = HolidayCalendarToolbar() + windowController?.contentViewController = HolidayCalendarCollectionViewController() + windowController?.showWindow(self) + } + + func applicationWillTerminate(_ aNotification: Notification) { + } +} diff --git a/holidaycalendar/Application/HolidayCalendarMenu.swift b/holidaycalendar/Application/HolidayCalendarMenu.swift new file mode 100644 index 0000000..47355c4 --- /dev/null +++ b/holidaycalendar/Application/HolidayCalendarMenu.swift @@ -0,0 +1,28 @@ +// +// HolidayCalendarMenu.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/2/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +fileprivate func configureApplicationMenu(_ menu: NSMenu) { + let menuItem = menu.addItem(withTitle: "Application", action: nil, keyEquivalent: "") + let submenu = NSMenu(title: "Application") + + let title = NSLocalizedString("Quit", comment:"Quit menu item") //+ " " + applicationName + let quitItem = submenu.addItem(withTitle:title, action:#selector(NSApplication.terminate(_:)), keyEquivalent:"q") + quitItem.target = NSApp + + menu.setSubmenu(submenu, for: menuItem) +} + +public func HolidayCalendarMenu() -> NSMenu { + let menu = NSMenu(title: "MainMenu") + + configureApplicationMenu(menu) + + return menu +} diff --git a/holidaycalendar/Application/HolidayCalendarWindowController.swift b/holidaycalendar/Application/HolidayCalendarWindowController.swift new file mode 100644 index 0000000..ab8488d --- /dev/null +++ b/holidaycalendar/Application/HolidayCalendarWindowController.swift @@ -0,0 +1,25 @@ +// +// HolidayCalendarWindowController.swift +// holidaycalendar +// +// Created by Ryan McGrath on 11/21/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarWindowController: NSWindowController { + convenience init() { + let styleMask: NSWindow.StyleMask = [.resizable, .miniaturizable, .closable, .titled] + let initialRect = CGRect(x: 100.0, y: 100.0, width: 600.0, height: 350.0) + let appWindow = NSWindow(contentRect: initialRect, styleMask: styleMask, backing: .buffered, defer: false) + appWindow.backgroundColor = Styles.windowBackgroundColor + appWindow.contentMinSize = CGSize(width: 600.0, height: 350.0) + appWindow.title = "Holiday Calendar" + appWindow.titlebarAppearsTransparent = true + appWindow.titleVisibility = .hidden + appWindow.appearance = NSAppearance(named: .vibrantDark) + + self.init(window: appWindow) + } +} diff --git a/holidaycalendar/Application/Utils.swift b/holidaycalendar/Application/Utils.swift new file mode 100644 index 0000000..28ebe43 --- /dev/null +++ b/holidaycalendar/Application/Utils.swift @@ -0,0 +1,26 @@ +// +// Utils.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/3/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa +import Foundation + +struct Styles { + static let windowBackgroundColor = NSColor(red: 26.0/255.0, green: 28.0/255.0, blue: 47.0/255.0, alpha: 1) + static let presentBackgroundColor = NSColor(red: 236.0/255.0, green: 88.0/255.0, blue: 65.0/255.0, alpha: 1) + static let openPresentBackgroundColor = NSColor(red: 60.0/255.0, green: 189.0/255.0, blue: 172.0/255.0, alpha: 1) +} + +enum Cells: String { + case calendarDay + + var reuseIdentifier: NSUserInterfaceItemIdentifier { + switch self { + case .calendarDay: return NSUserInterfaceItemIdentifier(rawValue: "LOL") + } + } +} diff --git a/holidaycalendar/Application/main.swift b/holidaycalendar/Application/main.swift new file mode 100644 index 0000000..ae49d1c --- /dev/null +++ b/holidaycalendar/Application/main.swift @@ -0,0 +1,19 @@ +// +// main.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/2/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +autoreleasepool { + let delegate = AppDelegate() + withExtendedLifetime(delegate, { + let application = NSApplication.shared + application.delegate = delegate + application.run() + application.delegate = nil + }) +} diff --git a/holidaycalendar/Assets.xcassets/AppIcon.appiconset/Contents.json b/holidaycalendar/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/holidaycalendar/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/holidaycalendar/Assets.xcassets/Contents.json b/holidaycalendar/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/holidaycalendar/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewController.swift b/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewController.swift new file mode 100644 index 0000000..120ffa6 --- /dev/null +++ b/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewController.swift @@ -0,0 +1,31 @@ +// +// HolidayCalendarCollectionView.swift +// holidaycalendar +// +// Created by Ryan McGrath on 11/18/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarCollectionViewController: NSViewController { + var layout = HolidayCalendarFlowLayout() + var dataSource = HolidayCalendarDataSource() + + override func loadView() { + let collectionView = NSCollectionView(frame: .zero) + collectionView.collectionViewLayout = layout + collectionView.delegate = layout + collectionView.dataSource = dataSource + collectionView.register(HolidayCalendarCollectionViewItem.self, forItemWithIdentifier: Cells.calendarDay.reuseIdentifier) + collectionView.allowsEmptySelection = true + collectionView.allowsMultipleSelection = false + collectionView.isSelectable = true + collectionView.backgroundColors = [Styles.windowBackgroundColor] + view = collectionView + } + + convenience init() { + self.init(nibName: nil, bundle: nil) + } +} diff --git a/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewItem.swift b/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewItem.swift new file mode 100644 index 0000000..d034bd5 --- /dev/null +++ b/holidaycalendar/HolidayCalendarView/HolidayCalendarCollectionViewItem.swift @@ -0,0 +1,160 @@ +// +// HolidayCalendarCollectionViewItem.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/3/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarCollectionViewItem: NSCollectionViewItem { + public var leftAnchor: NSLayoutConstraint? + public var initialTouchOne: NSTouch? + public var initialTouchTwo: NSTouch? + public var currentTouchOne: NSTouch? + public var currentTouchTwo: NSTouch? + public var initialPoint: CGPoint? + public var isTracking = false + + public lazy var contentView: NSView = { + let view = NSView(frame: .zero) + view.translatesAutoresizingMaskIntoConstraints = false + view.wantsLayer = true + view.layer?.backgroundColor = Styles.presentBackgroundColor.cgColor + return view + }() + + public lazy var dayLabel: NSTextField = { + let label = NSTextField.init(labelWithString: "") + label.translatesAutoresizingMaskIntoConstraints = false + label.font = NSFont(name: "Impact", size: 32.0) + label.alignment = .center + return label + }() + + override func loadView() { + let itemView = NSView(frame: .zero) + itemView.postsFrameChangedNotifications = false + itemView.postsBoundsChangedNotifications = false + itemView.wantsLayer = true + itemView.layer?.backgroundColor = Styles.openPresentBackgroundColor.cgColor + itemView.allowedTouchTypes = [.direct, .indirect] + + contentView.addSubview(dayLabel) + itemView.addSubview(contentView) + + leftAnchor = contentView.leftAnchor.constraint(equalTo: itemView.leftAnchor) + NSLayoutConstraint.activate([ + dayLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 18.0), + dayLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), + dayLabel.widthAnchor.constraint(equalTo: contentView.widthAnchor), + + contentView.topAnchor.constraint(equalTo: itemView.topAnchor), + leftAnchor!, + contentView.bottomAnchor.constraint(equalTo: itemView.bottomAnchor), + contentView.widthAnchor.constraint(equalTo: itemView.widthAnchor), + ]) + + view = itemView + } + + override func touchesBegan(with event: NSEvent) { + if(isTracking) { return } + + let initialTouches = event.touches(matching: .touching, in: view) + if(initialTouches.count != 2) { return } + + isTracking = true + initialPoint = view.convert(event.locationInWindow, from: nil) + + let touches = Array(initialTouches) + initialTouchOne = touches[0] + initialTouchTwo = touches[1] + currentTouchOne = touches[0] + currentTouchTwo = touches[1] + } + + override func touchesMoved(with event: NSEvent) { + if(!isTracking) { return } + + let currentTouches = event.touches(matching: .touching, in: view) + if(currentTouches.count != 2) { return } + + currentTouchOne = nil + currentTouchTwo = nil + + currentTouches.forEach { (touch: NSTouch) in + if(touch.identity.isEqual(initialTouchOne?.identity)) { + currentTouchOne = touch + } else { + currentTouchTwo = touch + } + } + + let initialXPoint = [ + initialTouchOne?.normalizedPosition.x ?? 0.0, + initialTouchTwo?.normalizedPosition.x ?? 0.0 + ].min() ?? 0.0 + + let currentXPoint = [ + currentTouchOne?.normalizedPosition.x ?? 0.0, + currentTouchTwo?.normalizedPosition.x ?? 0.0 + ].min() ?? 0.0 + + let deviceWidth = initialTouchOne?.deviceSize.width ?? 0.0 + let oldX = (initialXPoint * deviceWidth).rounded(.up) + let newX = (currentXPoint * deviceWidth).rounded(.up) + + var delta: CGFloat = 0.0 + if(oldX > newX) { // Swiping left + delta = (oldX - newX) * -1.0 + } else if(newX > oldX) { // Swiping right + delta = newX - oldX + } + + NSAnimationContext.runAnimationGroup { [weak self] (context: NSAnimationContext) in + context.timingFunction = CAMediaTimingFunction(name: .easeIn) + context.duration = 0.2 + context.allowsImplicitAnimation = true + self?.leftAnchor?.animator().constant = delta + } + } + + func endTracking(_ delta: CGFloat) { + initialTouchOne = nil + initialTouchTwo = nil + currentTouchOne = nil + currentTouchTwo = nil + isTracking = false + + let leftThreshold: CGFloat = 50.0 + let rightThreshold: CGFloat = -50.0 + var to: CGFloat = 0.0 + + if(delta > leftThreshold) { + to = leftThreshold + } else if(delta < rightThreshold) { + to = rightThreshold + } + + NSAnimationContext.runAnimationGroup { [weak self] (context: NSAnimationContext) in + context.timingFunction = CAMediaTimingFunction(name: .easeIn) + context.duration = 0.5 + context.allowsImplicitAnimation = true + self?.leftAnchor?.animator().constant = to + } + } + + override func touchesEnded(with event: NSEvent) { + if(self.isTracking) { + self.endTracking(leftAnchor?.constant ?? 0) + } + } + + override func touchesCancelled(with event: NSEvent) { + if(self.isTracking) { + self.endTracking(leftAnchor?.constant ?? 0) + } + } +} diff --git a/holidaycalendar/HolidayCalendarView/HolidayCalendarDataSource.swift b/holidaycalendar/HolidayCalendarView/HolidayCalendarDataSource.swift new file mode 100644 index 0000000..903e853 --- /dev/null +++ b/holidaycalendar/HolidayCalendarView/HolidayCalendarDataSource.swift @@ -0,0 +1,24 @@ +// +// HolidayCalendarDataSource.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/3/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarDataSource: NSObject, NSCollectionViewDataSource { + func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int { + return 25 + } + + func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { + guard let item = collectionView.makeItem(withIdentifier: Cells.calendarDay.reuseIdentifier, for: indexPath) as? HolidayCalendarCollectionViewItem else { + fatalError("Couldn't get a valid NSCollectionViewItem. Did the type change or something...?") + } + + item.dayLabel.stringValue = String(indexPath.item + 1) + return item + } +} diff --git a/holidaycalendar/HolidayCalendarView/HolidayCalendarFlowLayout.swift b/holidaycalendar/HolidayCalendarView/HolidayCalendarFlowLayout.swift new file mode 100644 index 0000000..fe53ef8 --- /dev/null +++ b/holidaycalendar/HolidayCalendarView/HolidayCalendarFlowLayout.swift @@ -0,0 +1,30 @@ +// +// HolidayCalendarFlowLayout.swift +// holidaycalendar +// +// Created by Ryan McGrath on 11/18/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarFlowLayout: NSCollectionViewFlowLayout, NSCollectionViewDelegateFlowLayout { + override init() { + super.init() + sectionInset = NSEdgeInsetsMake(10, 10, 10, 10) + minimumInteritemSpacing = 10.0 + minimumLineSpacing = 10.0 + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func collectionView(_ collectionView: NSCollectionView, layout: NSCollectionViewLayout, sizeForItemAt: IndexPath) -> NSSize { + return NSSize(width: 74.0, height: 74.0) + } +} + +extension HolidayCalendarFlowLayout: NSCollectionViewDelegate { + +} diff --git a/holidaycalendar/Info.plist b/holidaycalendar/Info.plist new file mode 100644 index 0000000..2db6b60 --- /dev/null +++ b/holidaycalendar/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2018 Ryan McGrath. All rights reserved. + NSPrincipalClass + NSApplication + + diff --git a/holidaycalendar/Toolbar/HolidayCalendarHelpViewController.swift b/holidaycalendar/Toolbar/HolidayCalendarHelpViewController.swift new file mode 100644 index 0000000..bda8ae8 --- /dev/null +++ b/holidaycalendar/Toolbar/HolidayCalendarHelpViewController.swift @@ -0,0 +1,28 @@ +// +// HolidayCalendarHelpViewController.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/3/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarHelpViewController: NSViewController { + override func loadView() { + let label = NSTextField(wrappingLabelWithString: "This is just a demo! Two-finger swipe right on a day with your trackpad.") + label.translatesAutoresizingMaskIntoConstraints = false + + let rootView = NSView(frame: CGRect(x: 0.0, y: 0.0, width: 300.0, height: 150.0)) + rootView.addSubview(label) + + NSLayoutConstraint.activate([ + label.topAnchor.constraint(equalTo: rootView.topAnchor, constant: 10.0), + label.leadingAnchor.constraint(equalTo: rootView.leadingAnchor, constant: 10.0), + label.trailingAnchor.constraint(equalTo: rootView.trailingAnchor, constant: -10.0), + label.bottomAnchor.constraint(equalTo: rootView.bottomAnchor, constant: -10.0) + ]) + + view = rootView + } +} diff --git a/holidaycalendar/Toolbar/HolidayCalendarToolbar.swift b/holidaycalendar/Toolbar/HolidayCalendarToolbar.swift new file mode 100644 index 0000000..4279062 --- /dev/null +++ b/holidaycalendar/Toolbar/HolidayCalendarToolbar.swift @@ -0,0 +1,46 @@ +// +// HolidayCalendarToolbar.swift +// holidaycalendar +// +// Created by Ryan McGrath on 12/3/18. +// Copyright © 2018 Ryan McGrath. All rights reserved. +// + +import Cocoa + +class HolidayCalendarToolbar: NSToolbar { + convenience init() { + self.init(identifier: "DefaultToolbar") + delegate = self + } + + lazy var helpButton: NSButton = { + return NSButton(title: "Help", target: self, action: #selector(onHelpPressed)) + }() + + @objc func onHelpPressed() { + let popover = NSPopover() + popover.behavior = .transient + popover.contentSize = CGSize(width: 300.0, height: 150.0) + popover.contentViewController = HolidayCalendarHelpViewController() + popover.show(relativeTo: .zero, of: helpButton, preferredEdge: .maxY) + } +} + +extension HolidayCalendarToolbar: NSToolbarDelegate { + func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? { + let item = NSToolbarItem(itemIdentifier: itemIdentifier) + + if(itemIdentifier.rawValue == "HelpButton") { + item.view = helpButton + item.minSize = CGSize(width: 80.0, height: 24.0) + item.maxSize = CGSize(width: 80.0, height: 24.0) + } + + return item + } + + func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { + return [.flexibleSpace, NSToolbarItem.Identifier("HelpButton")] + } +} diff --git a/holidaycalendar/holidaycalendar.entitlements b/holidaycalendar/holidaycalendar.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/holidaycalendar/holidaycalendar.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + +