This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// ActivityRingAnimation WatchKit Extension | |
// | |
// Created by AppleDesignDev on 1/25/22. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
TimelineView(.periodic(from: .now, by: 1.0)) { timeline in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public protocol ValueTransforming: NSSecureCoding { | |
static var valueTransformerName: NSValueTransformerName { get } | |
} | |
public class NSSecureCodingValueTransformer<T: NSObject & ValueTransforming>: ValueTransformer { | |
public override class func transformedValueClass() -> AnyClass { T.self } | |
public override class func allowsReverseTransformation() -> Bool { true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://console.ng.bluemix.net/catalog/speech-to-text/ | |
# pip requests module required | |
import requests | |
url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize' | |
username = '<username>' | |
password = '<password>' | |
headers={'Content-Type': 'audio/wav'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// Given pointer to first element of a C array, invoke a function for each element | |
func enumerateCArray<T>(array: UnsafePointer<T>, count: UInt32, f: (UInt32, T) -> ()) { | |
var ptr = array | |
for i in 0..<count { | |
f(i, ptr.memory) | |
ptr = ptr.successor() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let config = NSURLSessionConfiguration.defaultSessionConfiguration() | |
let userPasswordString = "[email protected]:password" | |
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding) | |
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil) | |
let authString = "Basic \(base64EncodedCredential)" | |
config.HTTPAdditionalHeaders = ["Authorization" : authString] | |
let session = NSURLSession(configuration: config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# c.f. StackOverflow question/answer here: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 | |
# | |
# Version 2.5 | |
# | |
# Latest Change: | |
# - The "copy headers" section now respects the build setting for the location of the public headers | |
# - Opens the directory with the universal library after build (Can be annoying) | |
# | |
# Purpose: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################## | |
# | |
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 | |
# | |
# Version 2.82 | |
# | |
# Latest Change: | |
# - MORE tweaks to get the iOS 10+ and 9- working | |
# - Support iOS 10+ | |
# - Corrected typo for iOS 1-10+ (thanks @stuikomma) |