Add basic protocols and type aliases
This commit is contained in:
parent
af62d8c1c2
commit
a0adfcf4ba
|
@ -2,3 +2,4 @@
|
|||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
.swiftpm
|
||||
|
|
|
@ -1,26 +1,17 @@
|
|||
// swift-tools-version:5.1
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
// swift-tools-version:5.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "Elementary",
|
||||
products: [
|
||||
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||
.library(
|
||||
name: "Elementary",
|
||||
targets: ["Elementary"]),
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
||||
.target(
|
||||
name: "Elementary",
|
||||
dependencies: []),
|
||||
name: "Elementary"),
|
||||
.testTarget(
|
||||
name: "ElementaryTests",
|
||||
dependencies: ["Elementary"]),
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
protocol Action {}
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
typealias Call = () -> Void
|
||||
typealias Dispatch = (Action) -> Call
|
|
@ -1,3 +0,0 @@
|
|||
struct Elementary {
|
||||
var text = "Hello, World!"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
protocol Store {
|
||||
func dispatch(_ action: Action) -> Call
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
typealias Update<State> = (State, Action) -> State
|
|
@ -6,7 +6,7 @@ final class ElementaryTests: XCTestCase {
|
|||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
||||
// results.
|
||||
XCTAssertEqual(Elementary().text, "Hello, World!")
|
||||
//XCTAssertEqual(Elementary().text, "Hello, World!")
|
||||
}
|
||||
|
||||
static var allTests = [
|
||||
|
|
Loading…
Reference in New Issue