- Simply log requests in your app with 2 lines of code.
- Magnified JSON view.
- cURL sharing.
- JSON file sharing.
- Copy a single row on long press.
Use Cocoapods:
pod 'RCProxy'
Use SPM:
- In Xcode, go to File -> Add packages...
- In the prompt's search bar, copy and paste this URL:
https://github.com/RCaroff/RCProxy.git
- Select RCProxy an click on
Add Package
import RCProxy
- When you want to start logging, just write
RCProxy.start()
- When you want to show the interface, just use
RCProxy.show(in: UIViewController)
- If you want to present the viewController in a different way, you can simply get the instance with
RCProxy.viewController
. - From SwiftUI view, use
RCProxy.view
:
@State var showRequests: Bool = false
var body: some View {
Button {
showRequests = true
} label: {
Text("Show requests")
}
.sheet(isPresented: $showRequests) {
RCProxy.view
}
}
- Choose the type of storage you want between
.session()
,.userDefaults()
and.database()
Be sure to setup this BEFORE callingRCProxy.start()
.
Example:
RCProxy.storageType = .database(maxRequestsCount: 50)
RCProxy.start()
Default value is .session(maxRequestsCount: 100)
.session(maxRequestsCount: //default: 100)
: Your requests will be stored in a singleton and will be cleared when app is terminated.userDefaults(maxRequestsCount: //default: 100)
: Your requests will be stored in UserDefaults.standard
instance, and will persist between sessions but it will allow only a limited amount of data..database(maxRequestsCount: //default: 100)
: Your requests will be stored in a sqlite file on the phone. It uses CoreData behind the hood.
- RCProxy is listening on
URLSession.shared
instance by default, but you can also inject your own custom.
To do so, use the static propertyurlSession
:
let session = URLSession(configuration: URLSessionConfiguration.default)
RCProxy.urlSession = session
Feel free to contribute and / or open issues!