Anonymous

My feedback

  1. 6 votes
    Vote
    Sign in
    (thinking…)
    Sign in with: Facebook Google
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    8 comments  ·  Bible Search API  ·  Flag idea as inappropriate…  ·  Admin →
    Anonymous commented  · 

    Swift 4:

    let path = "v1/bibles/\(bibleId)/chapters/\(bookId).\(chapterId)?content-type=text&include-notes=false&include-chapter-numbers=false"
    guard let biblesUrl = URL(string: path, relativeTo: URL(string: "https://api.scripture.api.bible")) else { return }
    let config = URLSessionConfiguration.default
    config.httpAdditionalHeaders = ["api-key": self.apiKey()]
    let session = URLSession(configuration: config)
    let task = session.dataTask(with: biblesUrl) { (data: Data?, resp: URLResponse?, err: Error?) in

    if err != nil {
    print("connection error:", err!)
    return
    }
    else if let r = resp as? HTTPURLResponse,
    r.statusCode > 299 {
    print("API error:", r)
    return
    }
    if let json = try? JSONSerialization.jsonObject(with: data!, options: []),
    let dict = json as? [String: Any] {
    }

    }

Feedback and Knowledge Base