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
# Xcode | |
# | |
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | |
.DS_Store | |
UserInterfaceState.xcuserstate | |
GoogleService-Info.plist | |
## User settings | |
xcuserdata/ |
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 UIKit | |
import CoreMedia | |
extension UIView { | |
func toCMSampleBuffer() -> CMSampleBuffer? { | |
let scale: CGFloat = UIScreen.main.scale | |
let size: CGSize = .init(width: bounds.width * scale, height: bounds.height * scale) | |
guard let pixelBuffer = makeCVPicelBuffer(scale: scale, size: size) else { return nil } | |
defer { | |
CVPixelBufferUnlockBaseAddress(pixelBuffer, CVPixelBufferLockFlags(rawValue: 0)) |
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 AVKit | |
import AVFoundation | |
extension Data { | |
func toCMBlockBuffer() throws -> CMBlockBuffer { | |
var blockBuffer: CMBlockBuffer? | |
let data: NSMutableData = .init(data: self) | |
var source: CMBlockBufferCustomBlockSource = .init() | |
source.refCon = Unmanaged.passRetained(data).toOpaque() |
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 UIKit | |
extension UIView { | |
var uiImage: UIImage { | |
let imageRenderer = UIGraphicsImageRenderer.init(size: bounds.size) | |
return imageRenderer.image { context in | |
layer.render(in: context.cgContext) | |
} | |
} | |
} |
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 TestPage: View { | |
@State private var rect: CGRect = .zero | |
@State private var uiImage: UIImage? = nil | |
@State private var showShareSheet = false | |
var body: some View { | |
VStack { | |
HStack { |
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 TestPage: View { | |
@State private var rect: CGRect = .zero | |
@State var uiImage: UIImage? = nil | |
var body: some View { | |
VStack { | |
HStack { | |
Image(systemName: "sun.haze") |
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
public class Member { | |
private int id; | |
private String name; | |
public Member(int id, String name){ | |
this.id = id; | |
this.name = name; | |
} | |
public Member(){ |
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
using UnityEngine; | |
public class DDManager : MonoBehaviour { | |
public GameObject gameObject; | |
void Start () { | |
DontDestroyOnLoad(gameObject); | |
} |
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
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class SlideController : MonoBehaviour, IDragHandler { | |
public RectTransform m_rectTransform = null; | |
public void OnDrag(PointerEventData eventData) | |
{ | |
m_rectTransform.position += new Vector3(eventData.delta.x*0.01f, 0f, 0f); |
NewerOlder