-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27e852c
commit 8474b4d
Showing
14 changed files
with
1,692 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
|
||
# Created by https://www.gitignore.io/api/linux,osx,xcode,swift | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
|
||
### OSX ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### Xcode ### | ||
# 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 | ||
*.xccheckout | ||
*.xcscmblueprint | ||
|
||
|
||
### 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/fastlane/docs/Gitignore.md | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Reactive", | ||
dependencies: [ | ||
.Package(url: "https://github.com/Zewo/Log.git", majorVersion: 0, minor: 6) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
PRODUCT_NAME = $(TARGET_NAME) | ||
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator tvos tvsimulator watchos watchsimulator | ||
MACOSX_DEPLOYMENT_TARGET = 10.10 | ||
DYLIB_INSTALL_NAME_BASE = @rpath | ||
OTHER_SWIFT_FLAGS = -DXcode | ||
COMBINE_HIDPI_IMAGES = YES | ||
USE_HEADERMAP = NO |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Reactive.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
Reactive.xcodeproj/xcshareddata/xcschemes/Reactive.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme LastUpgradeVersion = "9999" version = "1.3"> | ||
<BuildAction parallelizeBuildables = "YES" buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "______Target_C7" | ||
BuildableName = "libC7.dylib" | ||
BlueprintName = "C7" | ||
ReferencedContainer = "container:Reactive.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "______Target_Log" | ||
BuildableName = "libLog.dylib" | ||
BlueprintName = "Log" | ||
ReferencedContainer = "container:Reactive.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "______Target_Reactive" | ||
BuildableName = "libReactive.dylib" | ||
BlueprintName = "Reactive" | ||
ReferencedContainer = "container:Reactive.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "______Target_ReactiveTestSuite" | ||
BuildableName = "ReactiveTestSuite.xctest" | ||
BlueprintName = "ReactiveTestSuite" | ||
ReferencedContainer = "container:Reactive.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
</Scheme> |
12 changes: 12 additions & 0 deletions
12
Reactive.xcodeproj/xcshareddata/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>Reactive.xcscheme</key> | ||
<dict></dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict></dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// Bag.swift | ||
// Edge | ||
// | ||
// Created by Tyler Fleming Cloutier on 5/29/16. | ||
// | ||
// | ||
|
||
public final class RemovalToken { | ||
private var identifier: UInt? | ||
|
||
private init(identifier: UInt) { | ||
self.identifier = identifier | ||
} | ||
} | ||
|
||
/// An unordered, non-unique collection of values of type `Element`. | ||
public struct Bag<Element> { | ||
private var elements: [BagElement<Element>] = [] | ||
private var currentIdentifier: UInt = 0 | ||
|
||
public init() { | ||
|
||
} | ||
|
||
/// Inserts the given value in the collection, and returns a token that can | ||
/// later be passed to removeValueForToken(). | ||
public mutating func insert(value: Element) -> RemovalToken { | ||
let (nextIdentifier, overflow) = UInt.addWithOverflow(currentIdentifier, 1) | ||
if overflow { | ||
reindex() | ||
} | ||
|
||
let token = RemovalToken(identifier: currentIdentifier) | ||
let element = BagElement(value: value, identifier: currentIdentifier, token: token) | ||
|
||
elements.append(element) | ||
currentIdentifier = nextIdentifier | ||
|
||
return token | ||
} | ||
|
||
/// Removes a value, given the token returned from insert(). | ||
/// | ||
/// If the value has already been removed, nothing happens. | ||
public mutating func removeValueForToken(token: RemovalToken) { | ||
if let identifier = token.identifier { | ||
// Removal is more likely for recent objects than old ones. | ||
for i in elements.indices.reversed() { | ||
if elements[i].identifier == identifier { | ||
elements.remove(at: i) | ||
token.identifier = nil | ||
break | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// In the event of an identifier overflow (highly, highly unlikely), this | ||
/// will reset all current identifiers to reclaim a contiguous set of | ||
/// available identifiers for the future. | ||
private mutating func reindex() { | ||
for i in elements.indices { | ||
currentIdentifier = UInt(i) | ||
|
||
elements[i].identifier = currentIdentifier | ||
elements[i].token.identifier = currentIdentifier | ||
} | ||
} | ||
} | ||
|
||
extension Bag: Collection { | ||
public typealias Index = Array<Element>.Index | ||
public typealias SubSequence = Array<Element>.SubSequence | ||
|
||
public var startIndex: Index { | ||
return elements.startIndex | ||
} | ||
|
||
public var endIndex: Index { | ||
return elements.endIndex | ||
} | ||
|
||
public subscript(position: Index) -> Element { | ||
return elements[position].value | ||
} | ||
|
||
public subscript(bounds: Range<Index>) -> SubSequence { | ||
return elements[bounds].map{ $0.value }[0..<elements.count] | ||
} | ||
|
||
public func index(after i: Index) -> Index { | ||
return i + 1 | ||
} | ||
} | ||
|
||
private struct BagElement<Value> { | ||
let value: Value | ||
var identifier: UInt | ||
let token: RemovalToken | ||
} | ||
|
||
extension BagElement: CustomStringConvertible { | ||
var description: String { | ||
return "BagElement(\(value))" | ||
} | ||
} |
Oops, something went wrong.