Skip to content

Can we use the API directly with SwiftUI? #220

Closed Answered by lukeocodes
KakfaTamura asked this question in General help
Discussion options

You must be logged in to vote

You can integrate directly using Swift. Here is some auto-generated code from the examples in our docs:

import Foundation

let headers = [
  "content-type": "application/json",
  "Authorization": "Token YOUR_DEEPGRAM_API_KEY"
]
let parameters = ["url": "https://dpgr.am/spacewalk.wav"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.deepgram.com/v1/listen")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.h…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jpvajda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants