This file contains hidden or 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
class ViewController: UIViewController { | |
static let dispatchQueue = DispatchQueue(label: "test") | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
ViewController.dispatchQueue.async { | |
Thread.current.name = "test thread" | |
print("done") | |
} | |
} |
This file contains hidden or 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
struct State { | |
var title: String | |
init(hash: Int) { | |
// speacialTextが二箇所で使われてしまい、改修時に漏れそう | |
// またreducer以外の場所でロジックが実行されているので気持ち悪い | |
title = specialText(hash: hash) | |
} | |
} |
This file contains hidden or 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 SwiftUI | |
struct ContentView: View { | |
@ObservedObject var vm: VM = .init() | |
var body: some View { | |
NavigationView { | |
List(vm.items, rowContent: { (item) in | |
NavigationLink( | |
destination: DestinationView(vm: vm), |
This file contains hidden or 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
name: Broadcast | |
configs: | |
Debug: debug | |
Release: release | |
targetTemplates: | |
Project: | |
platform: iOS | |
deploymentTarget: "14.0" | |
settings: | |
base: |
This file contains hidden or 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 UIKit | |
import AVFoundation | |
class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate { | |
lazy var session: AVCaptureSession = .init() | |
lazy var input: AVCaptureDeviceInput = try! AVCaptureDeviceInput(device: device) | |
lazy var device: AVCaptureDevice = AVCaptureDevice.default(for: .video)! | |
lazy var output: AVCaptureVideoDataOutput = .init() | |
override func viewDidLoad() { |
This file contains hidden or 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
using (var blendShapes = subsystem.GetBlendShapeCoefficients(face.trackableId, Allocator.Temp)) { | |
foreach (var blendShape in blendShapes) { | |
var location = blendShape.blendShapeLocation.ToString(); | |
var key = new BlendShapeKey(location); | |
blendShapeProxy.AccumulateValue(key, blendShape.coefficient); | |
} | |
} |
This file contains hidden or 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
extension Result { | |
init(_ successValue: Success?, _ failureValue: Failure?) { | |
if let failureValue = failureValue { | |
self = .failure(failureValue) | |
} else if let successValue = successValue { | |
self = .success(successValue) | |
} else { | |
preconditionFailure() | |
} | |
} |
This file contains hidden or 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 UIKit | |
import AVFoundation | |
import Vision | |
class ViewController: UIViewController { | |
lazy var device = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front)! | |
lazy var input = try! AVCaptureDeviceInput(device: device) | |
lazy var output = AVCaptureVideoDataOutput() | |
lazy var session = AVCaptureSession() | |
This file contains hidden or 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
class Unity: UnityFrameworkListener { | |
static let shared = Unity() | |
private let unityFramework: UnityFramework | |
var view: UIView { unityFramework.appController()!.window } | |
override init() { | |
let frameworkPath = Bundle.main.bundlePath.appending("/Frameworks/UnityFramework.framework") | |
let bundle = Bundle(path: frameworkPath)! | |
unityFramework = bundle.principalClass!.getInstance() | |
super.init() |
This file contains hidden or 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
```main.swift | |
import Foundation | |
print("a".appending("b")) | |
``` | |
``` | |
$ swift main.swift | |
Stack dump: | |
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret main.swift -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main |