Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
peterringset committed Oct 16, 2024
1 parent 5ffaf8d commit 577953d
Showing 1 changed file with 2 additions and 46 deletions.
48 changes: 2 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,14 @@
# JSONPatch
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/PRJSONPatch.svg)](https://img.shields.io/cocoapods/v/PRJSONPatch.svg)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)

A Swift μ-framework for creating [RFC6902](https://tools.ietf.org/html/rfc6902) compliant [JSON patch](http://jsonpatch.com) objects

## Requirements

- iOS 8.0+ / macOS 10.13+
- Swift 4.2+
- iOS 16.4+ / macOS 13.3+

### IMPORTANT!

The framework relies on the Objective C runtime for converting keypaths into strings, and so it is crucial that the properties the keypaths point to are representable in Objective C. To achieve this, you will have to add the `@objc` annotation at each variable declaration.

```swift
class Patch: NSObject {
@objc var baz: String!
@objc var foo: String!
@objc var hello: [String]!
}
```

Alternatively you can also use the `@objcMembers` annotation at the class level if all class members are representible in Objective C

```swift
@objcMembers class Patch: NSObject {
...
}
```
The `Package.swift` description declares requirements from iOS 16 and macOS 13, but in reality the requirement is actually iOS 16.4 and macOS 13.3. This is because the framework now relies on Swift's implementation of converting keypath's to strings, and that API is only available from iOS 16.4 and macOS 13.3.

## Installation
### Carthage

To integrate JSONPatch into your Xcode project using [Carthage](https://github.com/Carthage/Carthage), specify it in your `Cartfile`:

```ogdl
github "peterringset/JSONPatch" ~> 2.0
```

### CocoaPods

To integrate JSONPatch into your Xcode project using [CocoaPods](https://cocoapods.org), specify it in your `Podfile`:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
pod 'PRJSONPatch', '~> 2.0'
end
```

### Swift package manger
To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter `https://github.com/peterringset/JSONPatch`.

Expand Down

0 comments on commit 577953d

Please sign in to comment.