Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
| PRODUCT_NAME := Foo | |
| SCHEME_NAME := ${PRODUCT_NAME} | |
| WORKSPACE_NAME := ${PRODUCT_NAME}.xcworkspace | |
| UI_TESTS_TARGET_NAME := ${PRODUCT_NAME}UITests | |
| TEST_SDK := iphonesimulator | |
| TEST_CONFIGURATION := Debug | |
| TEST_PLATFORM := iOS Simulator | |
| TEST_DEVICE ?= iPhone 11 Pro Max | |
| TEST_OS ?= 13.3 |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
| extension UserDefaults { | |
| subscript<T>(key: String) -> T? { | |
| get { | |
| return value(forKey: key) as? T | |
| } | |
| set { | |
| set(newValue, forKey: key) | |
| } | |
| } | |
| // listening for current item change | |
| self.audioQueueObserver = self.playerQueue?.observe(\.currentItem, options: [.new]) { | |
| [weak self] (player, _) in | |
| print("media item changed...") | |
| } | |
| // listening for current item status change | |
| self.audioQueueStatusObserver = self.playerQueue?.currentItem?.observe(\.status, options: [.new, .old], changeHandler: { | |
| (playerItem, change) in | |
| if playerItem.status == .readyToPlay { |
| // No Security | |
| { | |
| "rules": { | |
| ".read": true, | |
| ".write": true | |
| } | |
| } |
| //reduce | |
| //Use reduce to combine all items in a collection to create a single new value. | |
| let numbers = [1, 3, 5, 7, 9] | |
| //sum all values from the array (+) | |
| let result = numbers.reduce(0, +) | |
| //sum all values from the array (+) plus one | |
| let result2 = numbers.reduce(1, +) | |
| let result3 = numbers.reduce(1, *) |
| // | |
| // InAppManager.swift | |
| // | |
| // Created by Ellina Kuznetcova on 12/10/2016. | |
| // Copyright © 2016 Flatstack. All rights reserved. | |
| // | |
| import Foundation | |
| import StoreKit |
| import UIKit | |
| import StoreKit | |
| //MARK: SKProductsRequestDelegate | |
| extension IAPHelpers : SKProductsRequestDelegate | |
| { | |
| func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) | |
| { |
| version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"` | |
| build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"` | |
| export PATH=$PATH:/usr/local/bin | |
| function addOverlayInfo() { | |
| income_icon_name=$1 | |
| outcome_icon_name=$2 | |
| echo "addOverlayInfo with income ${income_icon_name} and outcoming ${outcome_icon_name}" | |