Skip to content

Commit 393c0bb

Browse files
authored
Readme and License (#1)
* Update README.md * Create LICENSE
1 parent 1fe16a2 commit 393c0bb

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 SpaceNation Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# swift-equatable
1+
# Swift Equatable Macro
2+
![Swift Version](https://img.shields.io/badge/Swift-5.10-DE5D43)
3+
[![License](https://img.shields.io/badge/License-MIT-blue)](LICENSE)
4+
5+
This package automatically generates `Equatable` conformance for both classes and actors. This means that you do not need to manually implement the `==` operator for your classes and actors, as this package will handle it for you.
6+
7+
By conforming to `Equatable`, instances of your classes and actors can be easily compared for equality, which is useful for many operations such as sorting, searching, and maintaining collections. This package ensures that the generated `==` operator correctly compares all relevant properties of your classes and actors, providing a robust and efficient implementation.
8+
9+
**Note**: Classes must be marked as final to use this package. This ensures that the synthesized `==` operator is accurate and efficient, as it does not need to account for potential subclassing.
10+
11+
## Usage
12+
13+
Add `@Equatable` annotation to class or actor
14+
15+
```swift
16+
import Equatable
17+
18+
@Equatable
19+
public final class Planet {
20+
let name: String
21+
let mass: Mass
22+
}
23+
24+
/// Expands to
25+
extension Planet: Equatable {
26+
public static func == (lhs: Planet, rhs: Planet) -> Bool {
27+
lhs.name == rhs.name &&
28+
lhs.mass == rhs.mass
29+
}
30+
}
31+
```
32+
33+
## Installation
34+
35+
To use the `Equatable` library in a SwiftPM project,
36+
add it to the dependencies for your package and your target:
37+
38+
```swift
39+
let package = Package(
40+
// name, platforms, products, etc.
41+
dependencies: [
42+
// other dependencies
43+
.package(url: "https://github.com/spacenation/swift-equatable", from: "1.0.0"),
44+
],
45+
targets: [
46+
.target(
47+
// name, etc.
48+
dependencies: [
49+
// other dependencies
50+
.product(name: "Equatable", package: "wift-equatable")
51+
]
52+
)
53+
// other targets
54+
]
55+
)
56+
```
57+
58+
## Contributions
59+
60+
Feel free to contribute via fork/pull request to the main branch. If you want to request a feature or report a bug, please start a new issue.
61+
62+
## Become a Sponsor
63+
64+
If you find this project useful, please consider becoming our [GitHub Sponsor](https://github.com/sponsors/spacenation).

0 commit comments

Comments
 (0)