Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
denissimon committed Jan 20, 2024
1 parent cb94540 commit d782c78
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ Comprehensive [unit test](https://github.com/denissimon/SwiftEvents/blob/master/
Installation
------------

#### Swift Package Manager

To install SwiftEvents using the [Swift Package Manager](https://swift.org/package-manager):

```txt
Xcode: File -> Add Packages
Enter Package URL: https://github.com/denissimon/SwiftEvents
```

#### CocoaPods

To install SwiftEvents using [CocoaPods](https://cocoapods.org), add this line to your `Podfile`:
Expand All @@ -31,23 +40,13 @@ pod 'SwiftEvents', '~> 2.1'

To install SwiftEvents using [Carthage](https://github.com/Carthage/Carthage), add this line to your `Cartfile`:

```
```ruby
github "denissimon/SwiftEvents"
```

#### Swift Package Manager

To install SwiftEvents using the [Swift Package Manager](https://swift.org/package-manager), add it to your `Package.swift` file:

```swift
dependencies: [
.package(url: "https://github.com/denissimon/SwiftEvents.git", from: "2.1")
]
```

#### Manually

Add `SwiftEvents.swift` to your project.
Copy `SwiftEvents.swift` into your project.

Usage
-----
Expand Down Expand Up @@ -137,15 +136,15 @@ Event and Observable conform to `Unsubscribable` and `Unbindable` protocols resp

### More examples

More usage examples can be found in [iOS-MVVM-Clean-Architecture](https://github.com/denissimon/iOS-MVVM-Clean-Architecture) demo app.
More usage examples can be found in [iOS-MVVM-Clean-Architecture](https://github.com/denissimon/iOS-MVVM-Clean-Architecture).

Also [tests](https://github.com/denissimon/SwiftEvents/blob/master/Tests/SwiftEventsTests/EventService.swift) contains a NotificationCenter-like implementation, and here is a [gist](https://gist.github.com/denissimon/3b8c5a02ad2ce5f290f3fbecdbfb2fda) with a cell-to-cellViewModel binding example.

### Advanced features

#### Removal of a subscriber / observer

Deallocated subscribers/observers are automatically removed from the Event/Observable. But they also can be removed manually:
Deallocated subscribers/observers are automatically removed from Event/Observable. But they also can be removed manually:

```swift
someEvent.subscribe(self) { [weak self] in self?.setValue($0) }
Expand Down Expand Up @@ -181,7 +180,7 @@ someObservable.triggersCount
By default, the provided handler is executed on the thread that triggers the Event/Observable. To change this default behaviour:

```swift
// This executes the handler on the main queue
// This executes the handler on the main thread
someEvent.subscribe(self, queue: .main) { [weak self] in self?.updateTable($0) }
someObservable.bind(self, queue: .main) { [weak self] in self?.updateTable($0) }
```
Expand Down

0 comments on commit d782c78

Please sign in to comment.