The watch is a little different from the phone but has the same states
- not running
- inactive
- active
- background
- suspended
// | |
// ExtensionURLRequest.swift | |
// | |
// Created by Abhishek Maurya on 16/07/20. | |
// Copyright © 2020. All rights reserved. | |
// | |
import Foundation | |
extension URLRequest { |
// super rusty on combine | |
// https://brightdigit.com/tutorials/combine-corelocation-publishers-delegates/ | |
class CLLocationManagerPublicist: NSObject, CLLocationManagerCombineDelegate { | |
... | |
let locationSubject = PassthroughSubject<[CLLocation], Never>() | |
func locationPublisher() -> AnyPublisher<[CLLocation], Never> { | |
return locationSubject.eraseToAnyPublisher() | |
} | |
func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) { |
Add a space in a state name
stateDiagram
classDef yourState font-style:italic,font-weight:bold,fill:white
yswsii: Your state with spaces in it
[*] --> yswsii:::yourState
//https://developer.apple.com/library/content/samplecode/TableSearch_UISearchController/Introduction/Intro.html | |
// MARK: - UISearchResultsUpdating | |
func updateSearchResults(for searchController: UISearchController) { | |
// Update the filtered array based on the search text. | |
let searchResults = products | |
// Strip out all the leading and trailing spaces. | |
let whitespaceCharacterSet = CharacterSet.whitespaces |
// https://stackoverflow.com/a/43532815/1492368 | |
extension SKSpriteNode { | |
func addSkew(value: CGFloat = -1){ | |
var effectNode = SKEffectNode() | |
effectNode.shouldRasterize = true | |
effectNode.shouldEnableEffects = true | |
effectNode.addChild(SKSpriteNode(texture: texture)) |
{ | |
"movies": [ | |
{ | |
"id": "771324839", | |
"title": "Jurassic World", | |
"year": 2015, | |
"mpaa_rating": "PG-13", | |
"runtime": 123, | |
"critics_consensus": "", | |
"release_dates": { |
// source | |
// http://stackoverflow.com/questions/9257992/how-to-combine-merge-2-images-into-1 | |
- (UIImage*)imageByCombiningImage:(UIImage*)firstImage withImage:(UIImage*)secondImage { | |
UIImage *image = nil; | |
CGSize newImageSize = CGSizeMake(MAX(firstImage.size.width, secondImage.size.width), MAX(firstImage.size.height, secondImage.size.height)); | |
if (UIGraphicsBeginImageContextWithOptions != NULL) { | |
UIGraphicsBeginImageContextWithOptions(newImageSize, NO, [[UIScreen mainScreen] scale]); | |
} else { | |
UIGraphicsBeginImageContext(newImageSize); |