This file contains hidden or 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 urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
guard let serverTrust = challenge.protectionSpace.serverTrust else { | |
completionHandler(.cancelAuthenticationChallenge, nil); | |
return | |
} | |
let certificate = SecTrustGetCertificateAtIndex(serverTrust, 0) | |
// SSL Policies for domain name check | |
let policy = NSMutableArray() |
This file contains hidden or 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
# Docker commands | |
# Show all containers (default shows just running) | |
docker ps -a | |
# Start the docker service | |
systemctl start docker | |
# List images | |
docker images |
This file contains hidden or 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
struct ContentView: View { | |
@State var transactionId: String = "Not set yet!" | |
var body: some View { | |
NavigationView { | |
WWidgetPreview(transaction: Helper.getTransaction(from: transactionId)) | |
.onOpenURL(perform: { (transactionId) in | |
self.transactionId = transactionId.absoluteString | |
}) |
This file contains hidden or 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
ForEach(self.transactions, id: \.self) { transaction in | |
Link(destination: URL(string: transaction.stringId)!) { | |
VStack { | |
HStack { |
This file contains hidden or 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
struct Provider: TimelineProvider { | |
public typealias Entry = WalletWidgetEntry | |
public func placeholder(in context: Context) -> Entry { | |
let entry = WalletWidgetEntry(date: Date()) | |
return entry | |
} | |
} |
This file contains hidden or 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
public func timeline(with context: Context, completion: @escaping (Timeline<Entry>) -> ()) { | |
// Generate a timeline consisting of one entry with reload policy after 1 min. | |
let currentDate = Date() | |
let nextUpdateDate = Calendar.current.date(byAdding: .minute, | |
value: 1, | |
to: currentDate)! | |
let entry = WalletWidgetEntry(date: currentDate) | |
let timeline = Timeline(entries: [entry], policy: .after(nextUpdateDate)) | |
completion(timeline) |
This file contains hidden or 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
public func snapshot(with context: Context, completion: @escaping (WalletWidgetEntry) -> ()) { | |
let entry = WalletWidgetEntry(date: Date()) | |
completion(entry) | |
} |
This file contains hidden or 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
struct WalletWidgetEntryView : View { | |
var entry: Provider.Entry | |
@Environment(\.widgetFamily) var family | |
@ViewBuilder | |
var body: some View { | |
//Text(entry.date, style: .time) | |
switch family { | |
case .systemSmall: |
This file contains hidden or 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
@main | |
struct WalletWidget: Widget { | |
private let kind: String = "WalletWidget" | |
public var body: some WidgetConfiguration { | |
StaticConfiguration(kind: kind, provider: Provider()) { entry in | |
WalletWidgetEntryView(entry: entry) | |
} | |
.configurationDisplayName("Wallet Widget") | |
.description("Description for the Wallet app widget.") |
This file contains hidden or 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 backgroundQueue = DispatchQueue.global(qos: .background) | |
firstly { | |
showLoader() | |
}.then(on: backgroundQueue) { | |
self.fetchJSON() | |
}.then(on: backgroundQueue) { (photos) in | |
self.downloadPhotos(photos: Array(photos.prefix(40))) | |
}.done(on: DispatchQueue.main, flags: nil) { _ in | |
self.hideLoader() |
NewerOlder