Last active
March 1, 2020 15:34
-
-
Save hasanalisiseci/9c53bf08604d2fb5da926e57c3064d6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getLyric() { | |
// Hedef URL'yi tanımlıyoruz | |
let url = URL(string: "https://api.kanye.rest/?format=text") | |
do { | |
//URL ile ulaştığımız veriyi String olarak alıyoruz. | |
let contents = try String(contentsOf: url!) | |
//String değeri text view'a gönderiyoruz. | |
textView.text = "\"\(contents)\"" | |
} catch { | |
// İçerik yüklenemez ise | |
textView.text = "Could not load" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment