blog
blog copied to clipboard
🍁 What you don't know is what you haven't learned
From https://github.com/xhamr/paintcode-path-scale with some updates ```swift extension CGRect { var center: CGPoint { return CGPoint( x: self.size.width/2.0,y: self.size.height/2.0) } } extension CGPoint { func vector(to p1:CGPoint) -> CGVector { return...
Make a dedicate DebounceObject to debounce (or throttle). Then we can even observe with `onChange` on the `debouncedText` or just use it directly to sort ```swift import Combine public final...
Read [newDocument](https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1514997-newdocument) > This method calls [openUntitledDocumentAndDisplay(_:)](https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1515014-openuntitleddocumentanddisplay). Read [openUntitledDocumentAndDisplay](https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1515014-openuntitleddocumentanddisplay) > The default implementation of this method calls [defaultType](https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1514986-defaulttype) to determine the type of new document to create, calls [makeUntitledDocument(ofType:)](https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1514963-makeuntitleddocument) to...
From iOS 13, use `UITabBarAppearance` and `UITabBarItemAppearance` ```swift let appearance = UITabBarAppearance() let itemAppearance = UITabBarItemAppearance(style: .stacked) itemAppearance.normal.badgeBackgroundColor = .clear itemAppearance.normal.badgeTextAttributes = [.foregroundColor: UIColor.red] profileViewController.tabBarItem.badgeValue = "●" ``` ## Read...
Use assistant ```swift let assistant = MCAdvertiserAssistant(serviceType: "my-service, discoveryInfo: nil, session: mcSession) assistant.start() let browser = MCBrowserViewController(serviceType: "my-service", session: mcSession) browser.delegate = self present(browser, animated: true) ``` Manual ```swift let...
Use `NSSharingService.sharingServices(forItems:)` with an array of one empty string gives a list of sharing items. There we show `image` and `title` of each menu item. We should cache sharing items...
Use libraries - https://github.com/argentlabs/web3.swift - https://github.com/bswags/web3keystore ```swift import web3 import web3keystore import KeychainAccess private final class KeyStorage: EthereumKeyStorageProtocol { enum Key: String { case privateKey case phrase } private let...
### Building - https://dev.to/dabit3/building-scalable-full-stack-apps-on-ethereum-with-polygon-2cfb ### Sidechain - https://docs.polygon.technology/docs/home/new-to-polygon - https://hackernoon.com/what-are-sidechains-and-childchains-7202cc9e5994 ### USDC - Testnet https://mumbai.polygonscan.com/token/0x566368d78dbdec50f04b588e152de3cec0d5889f - Mainnet https://polygonscan.com/token/0x2791bca1f2de4661ed88a30c99a7a9449aa84174 ### Faucet - Testnet https://faucet.polygon.technology/
### General - https://solanacookbook.com/#contributing - https://learn.figment.io/protocols/solana - https://dev.to/dabit3/the-complete-guide-to-full-stack-solana-development-with-react-anchor-rust-and-phantom-3291 - https://dev.to/kelvinkirima014/a-gentle-introduction-to-solana-2h3k - https://buildspace.so/learn-solana ### Transaction - https://medium.com/@asmiller1989/solana-transactions-in-depth-1f7f7fe06ac2 ### Token program - https://spl.solana.com/token - https://www.brianfriel.xyz/how-to-create-a-token-on-solana/ - https://pencilflip.medium.com/solanas-token-program-explained-de0ddce29714
We can use `PropertyListEncoder` from Swift 4 ```swift let encoder = PropertyListEncoder() encoder.outputFormat = .xml let data = try encoder.encode(model) ``` Or we can manually do with resultBuilder style Declare...