-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated repo for Xcode 15 and re-formatted (#65)
- Ran XCode auto-upgrade - Bumped to latest swift-format config - Formatted with latest swift-format rules
- Loading branch information
1 parent
9c6ff9d
commit 6554843
Showing
28 changed files
with
491 additions
and
319 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
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
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 |
---|---|---|
|
@@ -25,5 +25,4 @@ instance.stateChangedHandler = { (state) in | |
} | ||
} | ||
|
||
|
||
RunLoop.main.run() |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// logger.swift | ||
// | ||
// | ||
// | ||
// Created by SJ on 2020-03-27. | ||
// | ||
|
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
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
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 |
---|---|---|
@@ -1,53 +1,53 @@ | ||
/* | ||
Briefly using a Dequeue from Ray Wenderlich to test out the notification queue. Need to create a | ||
"proper" queue with a thread-safe implementation, and a valid "peek" down the road... (Issue #45) | ||
https://github.com/raywenderlich/swift-algorithm-club/tree/master/Deque | ||
Deque (pronounced "deck"), a double-ended queue | ||
This particular implementation is simple but not very efficient. Several | ||
operations are O(n). A more efficient implementation would use a doubly | ||
linked list or a circular buffer. | ||
*/ | ||
public struct Deque<T> { | ||
private var array = [T]() | ||
private var array = [T]() | ||
|
||
public var isEmpty: Bool { | ||
return array.isEmpty | ||
} | ||
public var isEmpty: Bool { | ||
return array.isEmpty | ||
} | ||
|
||
public var count: Int { | ||
return array.count | ||
} | ||
public var count: Int { | ||
return array.count | ||
} | ||
|
||
public mutating func enqueue(_ element: T) { | ||
array.append(element) | ||
} | ||
public mutating func enqueue(_ element: T) { | ||
array.append(element) | ||
} | ||
|
||
public mutating func enqueueFront(_ element: T) { | ||
array.insert(element, at: 0) | ||
} | ||
public mutating func enqueueFront(_ element: T) { | ||
array.insert(element, at: 0) | ||
} | ||
|
||
public mutating func dequeue() -> T? { | ||
if isEmpty { | ||
return nil | ||
} else { | ||
return array.removeFirst() | ||
public mutating func dequeue() -> T? { | ||
if isEmpty { | ||
return nil | ||
} else { | ||
return array.removeFirst() | ||
} | ||
} | ||
} | ||
|
||
public mutating func dequeueBack() -> T? { | ||
if isEmpty { | ||
return nil | ||
} else { | ||
return array.removeLast() | ||
public mutating func dequeueBack() -> T? { | ||
if isEmpty { | ||
return nil | ||
} else { | ||
return array.removeLast() | ||
} | ||
} | ||
} | ||
|
||
public func peekFront() -> T? { | ||
return array.first | ||
} | ||
public func peekFront() -> T? { | ||
return array.first | ||
} | ||
|
||
public func peekBack() -> T? { | ||
return array.last | ||
} | ||
public func peekBack() -> T? { | ||
return array.last | ||
} | ||
} |
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
Oops, something went wrong.