blog
blog copied to clipboard
🍁 What you don't know is what you haven't learned
Use [JWTKit](https://github.com/vapor/jwt-kit) and code from [AppStoreConnect](https://github.com/onmyway133/AppStoreConnect/blob/main/Sources/JWT.swift) library ```swift import JWTKit public struct Credential { let issuerId: String let privateKeyId: String let privateKey: String public init( issuerId: String, privateKeyId: String, privateKey:...
Using https://github.com/ajamaica/Solana.Swift and the `sendSPLToken` method. Note that the from is the token account address and amount can have decimals ```swift solana.action.sendSPLTokens( mintAddress: MINT_ADDRESS, from: SENDER_TOKEN_ACCOUNT_ADDRESS, to: RECEIVER_WALLET_ADDDRESS, amount: UInt64(Float(amount)...
A simple way is to use a fixed fee of `0.000005 ` For example from https://solscan.io/tx/5DkApvwTYuMqCiA94MhUVKJoLn8MGma9gAWXhreRJKqAs395P5CqEK3R84m3MWjcTKMem53XcLwYErGkaJAbQC2h?cluster=testnet And call some exchange API, like Coingecko https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd and show the price in USD...
We can define some `typealias` and build extensions on JSONDictionary to easily extract values ```swift typealias JSONDictionary = [String: Any] typealias JSONArray = [JSONDictionary] extension JSONDictionary { func dict(_ key:...
We will check USDC token balance on Solana testnet. Firstly, we will use https://usdcfaucet.com/ to airdrop some USDC tokens into our wallet. Secondly, we check USDC token mint address on...
Since `async URLSession.shared.data` is available in iOS 15+, we can build a custom one with `withCheckedThrowingContinuation` ```swift import UIKit enum HTTPMethod: String { case get = "GET" case post =...
`JSONEncoder` deals with type-safe, so we need to declare an enum `JSONValue` for all possible types. We also need a custom initializer to init `JSONValue` from a JSON Dictionary ```swift...
To parse [PKPayment](https://developer.apple.com/documentation/passkit/pkpayment) and used with Wyre [CreateAppleOrder](https://docs.sendwyre.com/reference/createapplepayorder) API, we can declare some Encodable structs ```swift import PassKit import Foundation struct PaymentObject: Encodable { var billingContact: Contact? var shippingContact: Contact?...
### Use isActive and `isDetailLink(false)` ### Use Introspect ```swift .introspectNavigationController { nav in self.nav = nav } ``` ## Read more - https://www.cuvenx.com/post/swiftui-pop-to-root-view
Use `PKPaymentRequest` and `PKPaymentAuthorizationViewController` ```swift @MainActor final class WalletViewModel: NSObject, ObservableObject { var canMakePayments: Bool { PKPaymentAuthorizationViewController.canMakePayments() } func showApplePay(amount: Amount, from window: UIWindow) { let request = PKPaymentRequest() request.supportedNetworks...