Skip to content

Instantly share code, notes, and snippets.

View codelynx's full-sized avatar

Kaz Yoshikawa codelynx

View GitHub Profile
@codelynx
codelynx / UnsafePointer Converter.swift
Created September 13, 2020 14:57
[swift] Unsafe Pointer conversion
//
// Swift UnsafePointer converter
// Kaz Yoshikawa
//
// These code demonstrates how to convert swift pointers to the other forms of pointers.
//
// Source:
// Swift の Array やら ArraySlice やらポインタの変換まとめ
// https://qiita.com/Satachito/items/4c39c9b06304e4d86660
//
@codelynx
codelynx / Runtime.swift
Last active June 21, 2024 06:22
[Swift] To retrieve classes at runtime which conforms to a protocol or to retrieve subclasses of a given class
//
// Runtime.swift
// Swift Runtime [Swift 4]
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@codelynx
codelynx / PopoverButtonView.swift
Created June 13, 2024 02:25
SwiftUI Button to present popover with your content
//
// PopoverButtonView.swift
//
// Created by Kaz Yoshikawa on 2024/06/12.
//
import SwiftUI
/**
`PopoverButtonView` is a reusable SwiftUI view that displays a button, which presents a popover when tapped.
@codelynx
codelynx / gist:7458a592aaf108e9f518f726d7645d8d
Created June 10, 2024 00:36
Register Apple's push notification device token to Amazon AWS SNS
/*
Using AWS-SDK-SWIFT to register push notification deveice token
https://github.com/awslabs/aws-sdk-swift
*/
// import some others
import AWSSNS
@codelynx
codelynx / ZObjectRegistry.swift
Created May 10, 2024 16:17
A registry designed to facilitate the management of objects associated with UUIDs in SwiftUI applications.
//
// ZObjectRegistry.swift
// ZKit
//
// The MIT License (MIT)
//
// Copyright (c) 2024 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@codelynx
codelynx / MTLTexture+Z.swift
Created December 28, 2016 14:58
Piece of Utility code to make CGImage from MTLTexture under (BGRA8Unorm)
//
// MTLTexture+Z.swift
// ZKit
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@codelynx
codelynx / NSObject+class_copyPropertyList.swift
Last active March 21, 2024 08:22
Use class_copyPropertyList to extract properties from NSObject based object,
// source:
// https://stackoverflow.com/questions/24750186/i-cant-get-properties-of-a-class-using-swift-by-class-copypropertylist
import Foundation
extension NSObject {
func dictionaryRepresentation() -> [String: Any] {
@codelynx
codelynx / NSTextField+Blurred.swift
Created March 8, 2024 21:58
NSSecureTextField alternative
//
// NSTextField+Blurred.swift
// ZKit
//
// The MIT License (MIT)
//
// Copyright (c) 2024 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@codelynx
codelynx / Inspectables.swift
Created March 5, 2024 23:38
Inspectables helps you implementing inspector view and its model in swift
//
// Inspectable.swift
// Inspectables
//
// Created by Kaz Yoshikawa on 3/5/24.
//
//
// Overview:
// Inspectables a set of code help you implementing inspectable property values and its inspector value editing visual components, by using
// @InspectableValue, or @InspectableEnum property wrappers, then you may forcus writing property value editing components.
@codelynx
codelynx / Observable.swift
Created February 28, 2024 19:35
Observable property wrapper
// YObservable
// ZKit
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights