Skip to content

Instantly share code, notes, and snippets.

@voluntas
voluntas / shiguredo.rst
Last active May 22, 2024 08:31
時雨堂コトハジメ
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 19, 2024 07:58
Swift Concurrency Manifesto
@tterb
tterb / README-badges.md
Last active May 14, 2024 09:43
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@royshil
royshil / SimpleVideoStabilizer.cpp
Last active May 8, 2024 05:49
A simple video stabilizer in OpenCV, based on goodFeaturesToTrack, calcOpticalFlowPyrLK and estimateRigidTransform.
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <iostream>
using namespace cv;
using namespace std;
@voluntas
voluntas / shiguredo_product_ strategy.rst
Last active April 16, 2024 13:24
時雨堂を支える製品戦略
@ha1f
ha1f / CIFilter+Extension.swift
Last active February 20, 2024 08:14
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {
@cromandini
cromandini / universal-framework.sh
Last active February 12, 2024 12:13 — forked from cconway25/gist:7ff167c6f98da33c5352
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@schickling
schickling / UIImageFixedOrientationExtension.swift
Last active February 4, 2024 15:00
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@chriseidhof
chriseidhof / swift.tex
Created October 8, 2014 13:44
Listings Swift config
\lstdefinelanguage{swift}
{
morekeywords={
func,if,then,else,for,in,while,do,switch,case,default,where,break,continue,fallthrough,return,
typealias,struct,class,enum,protocol,var,func,let,get,set,willSet,didSet,inout,init,deinit,extension,
subscript,prefix,operator,infix,postfix,precedence,associativity,left,right,none,convenience,dynamic,
final,lazy,mutating,nonmutating,optional,override,required,static,unowned,safe,weak,internal,
private,public,is,as,self,unsafe,dynamicType,true,false,nil,Type,Protocol,
},
morecomment=[l]{//}, % l is for line comment
@AkkeyLab
AkkeyLab / HowXcodePreviewsWorks.md
Last active November 8, 2023 05:23
How XcodePreviews works

XcodePreviews の仕組み

XcodePreviews は SwiftUI で記述された UI を Xcode 上でプレビューするための新しい拡張機能です。 SwiftUI と UIKit には互換性があるため、 UIKit で構築された UI を XcodePreviews でプレビューさせることも可能です。
これによって、アプリケーションの再コンパイル・再実行なしに UI の変更を即時プレビューすることを可能にします。

今回は、この XcodePreviews がどのような仕組みで実現されているのかを解説します。

Build artefacts

XcodePreviews を実現するために新しく導入された Build artefacts を調べるために PreviewsSample という Single View App を作成しました。このプロジェクをビルドし、プレビュー可能な状態にしたときの Build artefacts が以下です。新しい中間ディレクトリとして Previews ディレクトリが作成されていることがわかります。

$ tree --filelimit 40 ~/Library/Developer/Xcode/DerivedData/PreviewsSample-bwzdqecwyvbvpofgqyzocvibrlbd