Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-watchOS'
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Aug 18, 2016
2 parents 9aac071 + b98859e commit 52eb001
Show file tree
Hide file tree
Showing 28 changed files with 1,075 additions and 83 deletions.
133 changes: 133 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Created by https://www.gitignore.io/api/swift

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData
.swift-version
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots


# Created by https://www.gitignore.io/api/swift

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots

263 changes: 198 additions & 65 deletions RRuleSwift.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "D31B13961CA8E02E00D0B863"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift"
BlueprintName = "RRuleSwift-iOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -47,7 +47,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "D31B13961CA8E02E00D0B863"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift"
BlueprintName = "RRuleSwift-iOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -65,7 +65,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "D31B13961CA8E02E00D0B863"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift"
BlueprintName = "RRuleSwift-iOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EB48D1361D641AD6001EE872"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift-watchOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EB48D1361D641AD6001EE872"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift-watchOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EB48D1361D641AD6001EE872"
BuildableName = "RRuleSwift.framework"
BlueprintName = "RRuleSwift-watchOS"
ReferencedContainer = "container:RRuleSwift.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Did you know that git does not support storing empty directories?
26 changes: 26 additions & 0 deletions RRuleSwiftExample-Watch Extension/ExtensionDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ExtensionDelegate.swift
// RRuleSwiftExample-Watch Extension
//
// Created by DangGu on 16/8/17.
// Copyright © 2016年 Teambition. All rights reserved.
//

import WatchKit

class ExtensionDelegate: NSObject, WKExtensionDelegate {

func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}

func applicationDidBecomeActive() {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillResignActive() {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, etc.
}

}
38 changes: 38 additions & 0 deletions RRuleSwiftExample-Watch Extension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>RRuleSwiftExample-Watch Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>Teambition.RRuleSwiftExample.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>WKExtensionDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
</dict>
</plist>
74 changes: 74 additions & 0 deletions RRuleSwiftExample-Watch Extension/InterfaceController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// InterfaceController.swift
// RRuleSwiftExample-Watch Extension
//
// Created by DangGu on 16/8/17.
// Copyright © 2016年 Teambition. All rights reserved.
//

import WatchKit
import Foundation
import RRuleSwift

class InterfaceController: WKInterfaceController {
let dateFormatter: NSDateFormatter = {
let dateFormatter = NSDateFormatter()
dateFormatter.timeZone = NSTimeZone.defaultTimeZone()
dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss EEE"
return dateFormatter
}()

override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
let ruleString = "RRULE:FREQ=WEEKLY;DTSTART=20151119T014500Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;UNTIL=20170101T014500Z"
var rule = RecurrenceRule(recurrenceWithRRuleString: ruleString)!
rule.exdate = ExclusionDate(exdateString: "EXDATE:20151120T014500Z,20151123T014500Z,20151126T014500Z,20151127T014500Z,20151130T014500Z,20151201T014500Z,20151202T014500Z,20151203T014500Z,20151207T014500Z,20151210T014500Z,20151211T014500Z,20151215T014500Z,20151216T014500Z,20151217T014500Z,20151221T014500Z,20151222T014500Z,20151223T014500Z,20151228T014500Z,20151229T014500Z", unitGranularity: .Day)
rule.toRRuleString()

// let occurrences1 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences2 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences3 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences4 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences5 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences6 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences7 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences8 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences9 = rule.occurrencesBetween(date: date1, andDate: date2)
// let occurrences10 = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
// let _ = rule.occurrencesBetween(date: date1, andDate: date2)
//
// print(occurrences1)
// print(occurrences2)
// print(occurrences3)
// print(occurrences4)
// print(occurrences5)
// print(occurrences6)
// print(occurrences7)
// print(occurrences8)
// print(occurrences9)
// print(occurrences10)

// Configure interface objects here.
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

}
Loading

0 comments on commit 52eb001

Please sign in to comment.