Inspektify is Kotlin Multiplatform Library for iOS, Android and Desktop platforms. It allows you to observe the network of your application in real-time directly on your device.
This library can be used only on projects that are using Ktor for network communication. If there is a need to support a different networking library besides Ktor open an issue for it. Inspektify is supported only for projects that are using the Ktor library equal to or greater than 2.3.1.
This library is available on mavenCentral. To use it in your project add the following repository if you don't have it yet.
repositories {
...
mavenCentral()
}
If your project is using Ktor version in the 3.x.x family add Inspektify with this line:
commonMain.dependencies {
...
implementation("io.github.bvantur:inspektify-ktor3:{mavenVersion}")
}
If your project is using Ktor version between 2.3.1 and 3.0.0 add Inspektify with this line:
commonMain.dependencies {
...
implementation("io.github.bvantur:inspektify-ktor2:{mavenVersion}")
}
Depending on your project setting there are 2 different ways that need to be done to make it work on iOS target.
If your iOS targets are set as static you need to follow the next steps:
- Open your iOS project in Xcode
- Select your root element in your iOS project directory tree(usually named with iosApp by default)
- Select your TARGET
- Go to Build Settings
- Search for Other Linker Flags
- Add
-lsqlite3
to it
If your iOS targets are set to be dynamic, then it is necessary to add this additional gradle configuration to your project:
iosTarget.binaries.all {
linkerOpts("-lsqlite3")
}
The sample project is currently configured as dynamic, so you can see how this approach can be implemented there.
You need to configure the library wherever you are creating a Ktor client in your project. Configuration follows the defined design of the Ktor library by installing a plugin directly to the Ktor client. The minimum code for including the Inspektify library in the project is:
HttpClient() {
...
install(InspektifyKtor)
}
This library was built with flexibility in mind. We don't want to force the behavior of the library upon the developer who uses this library, so we implemented a couple of configurations for the library to make it more flexible. The library also tracks which network transactions are from current active app sessions and highlights them in the list with a different background color. Network transactions from previous sessions have a background in light gray color.
- Presentation type
- Log level
- Data retention policy
- Shortcut for mobile clients
- Excluding Inspektify from Release Builds
- Redact data from Inspektify
A sample project is included where you can test the behavior of the Inspektify library. By default, the sample is configured to use Ktor from the 3.x.x family, but if you want to test with Ktor from 2.3.1 to 3.0.0 versions you need to change the next line in gradle.properties:
inspektify.ktorVersion=v2