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
extension UIScrollView { | |
fileprivate var layoutGuideID: String { #function } | |
public var headerLayoutGuide: UILayoutGuide { | |
if let layoutGuide = addedHeaderLayoutGuide() { | |
return layoutGuide | |
} | |
// workaround: UIScrollView can't add new layoutGuide directly. | |
let anchorView = UIView() | |
addSubview(anchorView) |
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 SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
SquareLayout { | |
Button { | |
} label: { | |
Color.green | |
.frame(width: 320, height: 640) |
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
extension UIWindowScene { | |
func scrollToTop() { | |
guard let window = keyWindow else { return } | |
var nextResponder: UIResponder? = window.hitTest(window.center, with: UIEvent()) | |
while let responder = nextResponder?.next { | |
if let scrollView = responder as? UIScrollView { | |
scrollView.setContentOffset(.zero, animated: true) | |
} | |
nextResponder = responder | |
} |
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
protocol FooRepository { | |
func foo() -> String | |
} | |
final class FooClient { | |
static let shared = FooClient() | |
private init() {} | |
} |
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
// swift-tools-version: 5.5 | |
// WARNING: | |
// This file is automatically generated. | |
// Do not edit it by hand because the contents will be replaced. | |
import PackageDescription | |
import AppleProductTypes | |
let package = Package( |
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
// swift-tools-version:5.5 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "AppPackage", | |
platforms: [.iOS(.v15)], | |
products: [ | |
.library(name: "AppModule", targets: ["AppModule", "DebugMenuModule"]), |
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
if (arFaceManager.subsystem is ARKitFaceSubsystem subsystem) { | |
using(var blendShapes = subsystem.GetBlendShapeCoefficients(face.trackableId, Allocator.Temp)) { | |
view.SetBlendShapes(blendShapes); | |
} | |
} | |
private void SetBlendShapes(NativeArray < ARKitBlendShapeCoefficient > blendShapes) { | |
foreach(var blendShape in blendShapes) { | |
float x = 0.0 f; | |
float fixedCoefficient = 0.0 f; |
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
// | |
// ViewController.swift | |
// a | |
// | |
// Created by Tomoya Hirano on 2021/06/15. | |
// | |
import UIKit | |
class ViewController: UIViewController { |
NewerOlder