Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topsort/cocoasdk
https://github.com/topsort/cocoasdk
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/topsort/cocoasdk
- Owner: Topsort
- License: mit
- Created: 2022-04-11T19:15:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-20T19:52:23.000Z (over 2 years ago)
- Last Synced: 2024-09-16T09:13:40.452Z (4 months ago)
- Language: Swift
- Size: 801 KB
- Stars: 0
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TopsortSDK for iOS
## Overview
This is an API client generated by the [OpenAPI Generator](https://openapi-generator.tech) project.- API version: 1.0.0
- Package version: 1.0.0## Installation
### With Cocoapods
```ruby
target MyApp do
pod 'TopsortSDK', '~> 1.0.0'
end
```And run `pod install`
### With Carthage
```
github "Topsort/CocoaSDK" ~> 1.0.0
```And run `carthage update`
### With Swift Packages
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/Topsort/CocoaSDK", from: "1.0.0"),
],
targets: [
.target(
name: "MyApp",
dependencies: ["TopsortSDK", ]
)
]
)
```And run `swift package update`
## Usage
### With SwiftUI
#### Sending Hit Events whenever a product is tapped.
```swift
struct TopsortProduct : View {
var topsort: TopsortSDK
var product: Productvar body: some View {
MyProduct(...)
.onGestureTap() {
Task {
let event = HitEvent(,
productId: product.productId,
auctionId: product.auctionId,
resolvedBidId: product.resolvedBidId,
)
try? await topsort.logHitAsync(hitEvent)
}
}
}
}
```#### Sending impression events when products are rendered.
```swift
struct Content : View {var products: [Products]
var body: some View {
LazyVGrid(columns: columns, spacing: 2) {
ForEach(products, id: \self) { product in
TopsortProduct(product: product)
}
}
.task {
try? await topsort.logImpressionsAsync(impressions: products.map { p in
Impression(productId: p.productId, auctionId: p.auctionId, resolvedBidId: p.resolvedBidId)
})
}
}
}
```