Skip to content

Instantly share code, notes, and snippets.

View noppefoxwolf's full-sized avatar
🦊
きつねかわいい!!!

noppe noppefoxwolf

🦊
きつねかわいい!!!
View GitHub Profile
@noppefoxwolf
noppefoxwolf / gist:511a1646cd4ef53a1cbc4379a8d1b2ed
Created September 27, 2019 06:07
Generambaのswift_viperテンプレートでクラッシュするパターン
//
// ViewController.swift
// ViperAsyncIssue
//
// Created by Tomoya Hirano on 2019/09/27.
// Copyright © 2019 Tomoya Hirano. All rights reserved.
//
import UIKit
@noppefoxwolf
noppefoxwolf / emoji.swift
Last active October 14, 2019 07:19
Unified string to emoji.
let unified = "0023-FE0F-20E3"
var emoji = unified
.split(separator: "-")
.compactMap { Int($0, radix: 16) }
.compactMap { Unicode.Scalar($0) }
.reduce(into: "", { $0.append(String($1)) })
@noppefoxwolf
noppefoxwolf / gist:c46d331c6ab555c45ac77d53c81610a0
Created October 19, 2019 16:30
AppStoreConnectのメールのregex
App Store Connect: Version (.+?) \((.+?)\) for (.+?) has completed processing.$
@noppefoxwolf
noppefoxwolf / popover.swift
Created October 22, 2019 17:56
Popover dismiss issue
import SwiftUI
struct Item: Identifiable {
let id: String
}
struct ContentView : View {
@State var item: Item? = nil
var body: some View {
import Accelerate
/// This object provides easy color sampling of the `capturedImage` property of an ARFrame.
///
/// - Warning: This class is NOT thread safe. The `rawRGBBuffer` property is shared between instances
/// and will cause a lot of headaches if 2 instances try to simultaneously access it.
/// If you need multi-threading, make the shared buffer an instance property instead.
/// Just remember to release it when you're done with it.
class CapturedImageSampler {
struct ContentView: View {
var body: some View {
NavigationView {
List {
NavigationLink(destination: Text("text")) {
Text("ok")
}
}
}
}
```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
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()
@noppefoxwolf
noppefoxwolf / ViewController.swift
Created June 22, 2020 22:58
VNDetectHumanHandPoseRequest
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()
extension Result {
init(_ successValue: Success?, _ failureValue: Failure?) {
if let failureValue = failureValue {
self = .failure(failureValue)
} else if let successValue = successValue {
self = .success(successValue)
} else {
preconditionFailure()
}
}