Skip to content

Instantly share code, notes, and snippets.

@mao-test-h
mao-test-h / SourceEditorCommand.swift
Created December 10, 2020 20:03
Xcode Source Editor Extensionsを用いてprintメソッドの内容を全てもなふわすい〜とる〜むのURLに変更する為のEditor拡張
import Foundation
import XcodeKit
// このGistでは実装のコア部分である`SourceEditorCommand.swift`のみアップ (実装は適当)
// Xcode Source Editor Extensionsの導入に関しては以下を参照
//
// - Creating a Source Editor Extension
// https://developer.apple.com/documentation/xcodekit/creating_a_source_editor_extension
//
// - Xcode Source Editor Extension を使った Xcode プラグインの作り方
@mao-test-h
mao-test-h / AVAudioSessionBridge.cs
Last active May 7, 2021 20:26
Unity上からiOS端末のシステムボリュームを取得する
using System.Runtime.InteropServices;
namespace iOSNative
{
/// <summary>
/// `AVAudioSession`のBridge
/// </summary>
/// <remarks>
/// - https://developer.apple.com/documentation/avfaudio/avaudiosession
/// </remarks>
@mao-test-h
mao-test-h / UIScreenBridge.cs
Last active May 7, 2021 20:48
Unity上からiOS端末の画面輝度を取得/設定
using System.Runtime.InteropServices;
using UnityEngine;
namespace iOSNative
{
/// <summary>
/// `UIScreen`のBridge
/// </summary>
/// <remarks>
/// - https://developer.apple.com/documentation/uikit/uiscreen
@mao-test-h
mao-test-h / NativeImageEncoder.mm
Created August 9, 2021 15:45
RenderTexture.GetNativeTexturePtr()からネイティブ側でpngに変換+保存
#import <Metal/Metal.h>
#import <UnityFramework/UnityFramework-Swift.h>
#ifdef __cplusplus
extern "C" {
#endif
// P/Invoke code.
// [DllImport("__Internal", EntryPoint = "encodeToPNG2")]
// static extern string EncodeToPNG(IntPtr nativeTexturePtr, string fileName);