The watch is a little different from the phone but has the same states
- not running
- inactive
- active
- background
- suspended
| /// Request to form the search URLRequests for the Open library app (Version 1) | |
| /// - For subject searches the search terms must be lowercased or it will return XML + a 200 response | |
| enum SearchRequest: NetworkRequestProtocol { | |
| var timeout: TimeInterval? { | |
| TimeInterval(BookAPIConstants.standardTimeout) | |
| } | |
| case subjectSearch(String) | |
| // case subjectSearchParameters(SubjectSearchInfo) |
| fn main() { | |
| println!("Hello, world!"); | |
| // fixed sized array | |
| let arr1 : [i32; 4] = [3, 23, 4, 2]; | |
| println!("first element of array {}", arr1[0]); | |
| println!("the array is {} long", arr1.len()); | |
| let xs: [i64; 2] = [1, 3]; | |
| // Arrays are stack allocated. | |
| println!("Array occupies {} bytes", std::mem::size_of_val(&xs)); |
| fn main() { | |
| let tuple = array_and_vec(); | |
| println!("{:?} array and {:?} vector", tuple.0, tuple.1); | |
| } | |
| fn array_and_vec() -> ([u32; 4], Vec<u32>) { | |
| let a = [1, 25, 200, 203]; | |
| let mut v = Vec::new(); | |
| // reference symbol in a (a pointer to the stack) | |
| for element in &a { |
| import os | |
| import re | |
| import subprocess | |
| import argparse | |
| # Set up argument parsing | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("-f", "--format", action='append', choices=['tex', 'pdf', 'epub'], type=str.lower, required=True) | |
| parser.add_argument("--skip-image-generation", help="skip image generation", action="store_true") | |
| args = parser.parse_args() |
| // | |
| // 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