Skip to content

Instantly share code, notes, and snippets.

import FloatingPanel
import SwiftUI
extension View {
public func floatingPanel() -> some View {
FloatingPanelView(parent: { self })
.ignoresSafeArea()
}
}
@scenee
scenee / WiFi.swift
Last active December 20, 2017 05:19
struct WiFi {
static func localWiFiIPAddress() -> String? {
var ret: String?
var addr: UnsafeMutablePointer<ifaddrs>?
guard getifaddrs(&addr) == 0 else { return nil }
guard let cursor = addr else { return nil }
for cur in sequence(first: cursor, next: { $0.pointee.ifa_next }) {
@scenee
scenee / WobblingEffect.swift
Last active December 20, 2017 05:16
UIView Wobbling animation
//
// WobblingEffect.swift
//
import UIKit
protocol WobblingEffect {
var wobbling: Bool { get set }
func startWobbling()
func stopWobbling()
@scenee
scenee / ThreadCountUtil.m
Last active October 28, 2016 08:05
Get number of the alive threads in iOS
#include <pthread.h>
#include <mach/mach.h>
/**
* @return -1 on error, else the number of threads for the current process
*/
static int currentThreadCount()
{
thread_act_array_t threads;
mach_msg_type_number_t thread_count = 0;
//
// Copyright © 2016 SCENEE. All rights reserved.
//
import Foundation
class KVObserver<Target, Value where Target: NSObject>: NSObject {
typealias blockType = ((Value) -> ())
let target: Target
let keyPath: String
@scenee
scenee / potatotips#3
Created January 15, 2014 15:34
Build Xcode project with specified Provisioning Profile file.
#!/bin/bash -eu
#############################
# build.sh
# Created by Shin Yamamoto
#
# Usage:
# $./build.sh [PROVISIONING_PROFILE_PATH]
#
#############################