From ea6298b65989a36131aa41f51af48052c8ff7d91 Mon Sep 17 00:00:00 2001 From: Tibor Bodecs Date: Sat, 18 Nov 2023 11:03:49 +0100 Subject: [PATCH 1/5] update readme instructions & version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 532c8e5..dd260cc 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,13 @@ If you have a server-side Swift application or a cross-platform (e.g. Linux, mac To add a dependency on the package, declare it in your `Package.swift`: ```swift -.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0-alpha.1"), +.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), ``` and to your application target, add `ServiceLifecycle` to your dependencies: ```swift -.target(name: "MyApplication", dependencies: [.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")]), +.product(name: "ServiceLifecycle", package: "swift-service-lifecycle") ``` ### Using ServiceLifecycle From cd909fe4802c9d86ac2bb6dad1cd8cbe1d326af7 Mon Sep 17 00:00:00 2001 From: Tibor Bodecs Date: Sat, 18 Nov 2023 11:12:59 +0100 Subject: [PATCH 2/5] add full package example --- Package.swift | 1 - README.md | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 28677d1..59c5a1e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,4 @@ // swift-tools-version:5.7 - import PackageDescription let package = Package( diff --git a/README.md b/README.md index dd260cc..9be12bf 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,28 @@ and to your application target, add `ServiceLifecycle` to your dependencies: .product(name: "ServiceLifecycle", package: "swift-service-lifecycle") ``` +Example `Package.swift` file with `ServiceLifecycle` as a dependency: + +```swift +// swift-tools-version:5.9 +import PackageDescription + +let package = Package( + name: "my-application", + dependencies: [ + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), + ], + targets: [ + .target(name: "MyApplication", dependencies: [ + .product(name: "ServiceLifecycle", package: "swift-service-lifecycle") + ]), + .testTarget(name: "MyApplicationTests", dependencies: [ + .target(name: "MyApplication"), + ]), + ] +) +``` + ### Using ServiceLifecycle Below is a short usage example however you can find detailed documentation on how to use ServiceLifecycle over [here](https://swiftpackageindex.com/swift-server/swift-service-lifecycle/main/documentation/servicelifecycle). From d26d1bb355d45a52852de451c1191c7c11270505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20B=C3=B6decs?= Date: Mon, 20 Nov 2023 12:49:48 +0100 Subject: [PATCH 3/5] Update README.md Co-authored-by: Franz Busch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9be12bf..014a23f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you have a server-side Swift application or a cross-platform (e.g. Linux, mac To add a dependency on the package, declare it in your `Package.swift`: ```swift -.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), +.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"), ``` and to your application target, add `ServiceLifecycle` to your dependencies: From c7006e274fd3a51ccad8e3cb84e94c33e02cbb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20B=C3=B6decs?= Date: Mon, 20 Nov 2023 12:49:55 +0100 Subject: [PATCH 4/5] Update README.md Co-authored-by: Franz Busch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 014a23f..9cd1ec6 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ import PackageDescription let package = Package( name: "my-application", dependencies: [ - .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"), ], targets: [ .target(name: "MyApplication", dependencies: [ From e15ff7f4e652baa686ccd4224cbb7d11488b6ce8 Mon Sep 17 00:00:00 2001 From: Tibor Bodecs Date: Mon, 20 Nov 2023 12:53:51 +0100 Subject: [PATCH 5/5] add getting started to docc index --- Sources/ServiceLifecycle/Docs.docc/index.md | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Sources/ServiceLifecycle/Docs.docc/index.md b/Sources/ServiceLifecycle/Docs.docc/index.md index 885c46b..5569e35 100644 --- a/Sources/ServiceLifecycle/Docs.docc/index.md +++ b/Sources/ServiceLifecycle/Docs.docc/index.md @@ -22,6 +22,46 @@ to their business logic if and how to do that. Library authors should conform their services to the ``Service`` protocol and application authors should use the ``ServiceGroup`` to orchestrate all their services. +## Getting started + +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. + +### Adding the dependency + +To add a dependency on the package, declare it in your `Package.swift`: + +```swift +.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"), +``` + +and to your application target, add `ServiceLifecycle` to your dependencies: + +```swift +.product(name: "ServiceLifecycle", package: "swift-service-lifecycle") +``` + +Example `Package.swift` file with `ServiceLifecycle` as a dependency: + +```swift +// swift-tools-version:5.9 +import PackageDescription + +let package = Package( + name: "my-application", + dependencies: [ + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"), + ], + targets: [ + .target(name: "MyApplication", dependencies: [ + .product(name: "ServiceLifecycle", package: "swift-service-lifecycle") + ]), + .testTarget(name: "MyApplicationTests", dependencies: [ + .target(name: "MyApplication"), + ]), + ] +) +``` + ## Topics ### Articles