Skip to content

Instantly share code, notes, and snippets.

View stinger's full-sized avatar

Ilian Konchev stinger

View GitHub Profile
@stinger
stinger / FMCAQA.md
Created September 26, 2025 09:58
Notes from the FoundationModels code-along Q&A session (Sep 25, 2025)

FoundationModels code-along session Q&A (Sep 25, 2025)

Let me just say this format is AMAZINGLY well done, you guys. Is there a schedule somewhere of other "Code Along"s?

Thank you John, much appreciated! This is the only code along so far, but stay tuned to the Meet with Apple schedule for more events: https://developer.apple.com/events/view/upcoming-events

Will the recorded session be provided?

Great question! Yes, the code along will be available on-demand sometime after the event concludes. The code along will be made available on the Apple developer website and Youtube.

@stinger
stinger / ConcurrencyFetcher.swift
Created October 28, 2021 13:18
Swift Concurrency fetcher
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String), parserError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
case .apiError(let reason), .parserError(let reason):
return reason
}
@stinger
stinger / SplashScrollView.swift
Created March 26, 2021 13:10 — forked from valvoline/SplashScrollView.swift
A simple Parallax Effect based paged ScrollView
//
// ContentView.swift
// Shared
//
// Created by Costantino Pistagna on 25/03/21.
//
import SwiftUI
struct ContentView: View {
@stinger
stinger / String+IsValid.swift
Last active December 28, 2020 11:06
Functional String validation
func validate<T: Codable>(_ validator: @escaping (T) -> Bool) -> (T) -> Bool {
return { input in
return validator(input)
}
}
enum StringValidator: CustomStringConvertible {
case isNotEmpty
case lengthIn(ClosedRange<Int>)
@stinger
stinger / stinger.zsh-theme
Created July 3, 2019 14:58
My oh-my-zsh theme
function prompt_char {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[cyan]%}%n@)%m:%{$fg_bold[green]%}%(!.%~.%1~)%{$fg_bold[yellow]%} $(git_prompt_info)%{$fg_bold[cyan]%}$(prompt_char)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
@stinger
stinger / CombineMockClient.swift
Created July 3, 2019 12:26
Mock data loader using Combine
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknownError
case unknownURL
case unknownData
case parserError(reason: String)
case apiError(reason: String)
@stinger
stinger / CombineFetcherAndDecoder.swift
Last active February 17, 2024 02:07
Combine - fetching and decoding JSON data
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String), parserError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@stinger
stinger / CombineFetcher.swift
Last active January 28, 2023 18:07
Combine - fetching data using URLSession publishers
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@stinger
stinger / Iff.swift
Created June 17, 2019 07:28 — forked from sergdort/Iff.swift
Iff and Some operators for #SwiftUI. Inspired on some stuff we use in [Bento](). It lets you chain modifiers instead of doing "if - else" dance 🚀
extension View {
func iff(_ condition: Bool, _ modifier: (Self) -> AnyView) -> AnyView {
if condition {
return modifier(self).eraseToAnyView()
}
return eraseToAnyView()
}
func some<Value>(_ optional: Value?, modifier: (Value, Self) -> AnyView) -> some View {
guard let value = optional else {
import UIKit
extension UIImage {
/**
Resizes the image to width x height and converts it to an RGB CVPixelBuffer.
*/
public func pixelBuffer(width: Int, height: Int) -> CVPixelBuffer? {
var maybePixelBuffer: CVPixelBuffer?
let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue,
kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue]