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
<<<<<<< HEAD | |
if let titleView: UIView = titleViewFromNavBarImagePath(navBarImagePath: navBarImagePath) { | |
titleView.contentMode = .scaleAspectFit | |
let container = UIView(frame: CGRect(x: 0, y: 0, width: 32, height: 32)) | |
titleView.frame = CGRect(x: 0, y: 0, width: 32, height: 32) | |
container.addSubview(titleView) | |
self.navigationItem.titleView = container | |
} | |
else { | |
self.navigationItem.titleView = nil |
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
import Foundation | |
let config = NSURLSessionConfiguration.defaultSessionConfiguration() | |
let userPasswordString = "username@gmail.com:password" | |
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding) | |
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil) | |
let authString = "Basic \(base64EncodedCredential)" | |
config.HTTPAdditionalHeaders = ["Authorization" : authString] | |
let session = NSURLSession(configuration: config) |
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
import Foundation | |
import SwiftUI | |
import CoreLocation | |
let jan = Calendar.current.date(from: DateComponents(year: 2021, month: 1, day: 1, hour: 2, minute: 0))! | |
let styles: [DateFormatter.Style] = [ | |
.none, | |
.short, | |
.medium, |
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
private func imageFrom(url: URL?, data: Data, response: HTTPURLResponse? = nil) -> AnyPublisher<UIImage?, Error> { | |
let type = response?.mimeType | |
if type?.hasPrefix("image/svg") == true || url?.pathExtension.lowercased() == "svg" { | |
return svgFrom(data: data) | |
} | |
return Just(UIImage(data: data)).setFailureType(to: Error.self).eraseToAnyPublisher() | |
} | |
private func svgFrom(data: Data) -> AnyPublisher<UIImage?, Error> { |
OlderNewer