Skip to content

Commit b21c43a

Browse files
tibFranzBusch
andauthored
Update readme instructions & version (#164)
* update readme instructions & version * add full package example * Update README.md Co-authored-by: Franz Busch <[email protected]> * Update README.md Co-authored-by: Franz Busch <[email protected]> * add getting started to docc index --------- Co-authored-by: Franz Busch <[email protected]>
1 parent 0503127 commit b21c43a

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

Package.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// swift-tools-version:5.7
2-
32
import PackageDescription
43

54
let package = Package(

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,29 @@ To add a dependency on the package, declare it in your `Package.swift`:
2323
and to your application target, add `ServiceLifecycle` to your dependencies:
2424

2525
```swift
26-
.target(name: "MyApplication", dependencies: [.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")]),
26+
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
27+
```
28+
29+
Example `Package.swift` file with `ServiceLifecycle` as a dependency:
30+
31+
```swift
32+
// swift-tools-version:5.9
33+
import PackageDescription
34+
35+
let package = Package(
36+
name: "my-application",
37+
dependencies: [
38+
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"),
39+
],
40+
targets: [
41+
.target(name: "MyApplication", dependencies: [
42+
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
43+
]),
44+
.testTarget(name: "MyApplicationTests", dependencies: [
45+
.target(name: "MyApplication"),
46+
]),
47+
]
48+
)
2749
```
2850

2951
### Using ServiceLifecycle

Sources/ServiceLifecycle/Docs.docc/index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@ to their business logic if and how to do that.
2222
Library authors should conform their services to the ``Service`` protocol and application authors
2323
should use the ``ServiceGroup`` to orchestrate all their services.
2424

25+
## Getting started
26+
27+
If you have a server-side Swift application or a cross-platform (e.g. Linux, macOS) application, and you would like to manage its startup and shutdown lifecycle, Swift Service Lifecycle is a great idea. Below you will find all you need to know to get started.
28+
29+
### Adding the dependency
30+
31+
To add a dependency on the package, declare it in your `Package.swift`:
32+
33+
```swift
34+
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"),
35+
```
36+
37+
and to your application target, add `ServiceLifecycle` to your dependencies:
38+
39+
```swift
40+
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
41+
```
42+
43+
Example `Package.swift` file with `ServiceLifecycle` as a dependency:
44+
45+
```swift
46+
// swift-tools-version:5.9
47+
import PackageDescription
48+
49+
let package = Package(
50+
name: "my-application",
51+
dependencies: [
52+
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"),
53+
],
54+
targets: [
55+
.target(name: "MyApplication", dependencies: [
56+
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
57+
]),
58+
.testTarget(name: "MyApplicationTests", dependencies: [
59+
.target(name: "MyApplication"),
60+
]),
61+
]
62+
)
63+
```
64+
2565
## Topics
2666

2767
### Articles

0 commit comments

Comments
 (0)