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
let url = URL(string: "https://youtu.be/5IVsLLlRNXc")! | |
UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { (success) in | |
if !success { | |
// not a universal link or app not installed | |
let vc = SFSafariViewController(url: url) | |
self.present(vc, animated: true) | |
} | |
} |
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
// Mould | |
extension UILabel { | |
class var heading: UILabel { | |
let mould: UILabel = .init() | |
mould.font = .systemFont(ofSize: 18.0) | |
mould.textColor = .black | |
mould.translatesAutoresizingMaskIntoConstraints = false | |
return mould | |
} |
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 testPaswordRetrive() { | |
let password = "123456" | |
let account = "User" | |
keyChainService.save(password, for: account) | |
XCTAssertEqual(keyChainService.retrivePassword(for: account), password) | |
} | |
//... | |
class KeychainService { | |
func save(_ password: String, for account: String) { |
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
enum Environment { | |
case development | |
case staging | |
case production | |
} | |
let environment: Environment = .development | |
switch environment { | |
case .development: |
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
// | |
// NetworkManager.swift | |
// | |
// Created by Ryan Daulton on 8/15/17. | |
// Copyright © 2017 Ryan Daulton. All rights reserved. | |
// | |
import Foundation | |
import Alamofire | |
import SwiftyJSON |
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
/* | |
* A Spotify Authorization Code Flow, used specifically for Android. | |
* I have been trying to do a refresh token in an android client, but I | |
* notice that when a user logs in using Spotify's SDK, they do not | |
* receive a refresh_token. I do not want my users to have to log in every | |
* time they use the app. | |
* | |
* After finding this issue: | |
* | |
* https://github.com/spotify/android-sdk/issues/259 |