Skip to content

Instantly share code, notes, and snippets.

View devahmedshendy's full-sized avatar

Ahmed Shendy devahmedshendy

  • Egypt
View GitHub Profile
@devahmedshendy
devahmedshendy / DynamicFunctions.swift
Created February 28, 2024 00:23 — forked from neonichu/DynamicFunctions.swift
Using dlopen / dlsym to call C functions from Swift
import Darwin
let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW)
let sym = dlsym(handle, "random")
let functionPointer = UnsafeMutablePointer<() -> CLong>(sym)
let result = functionPointer.memory()
println(result)
@devahmedshendy
devahmedshendy / image_as_text_foreground.swift
Last active April 25, 2024 10:56
SwiftUI View: add image as a foreground for Text view
struct ContentView: View {
private let imageUrl: String = "https://picsum.photos/seed/picsum/200/300"
var body: some View {
text
.overlay(
AsyncImage(url: .init(string: imageUrl)) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
//
// TrimmingExample.swift
//
// Created by Vasilis Akoinoglou on 13/5/24.
//
import SwiftUI
struct Line: Identifiable {
let id = UUID()

~/Users/<USER>/Library/Developer/CoreSimulator/Devices/<DEVICE_ID>/data/Containers/Data/Application/<APP_ID>/Library/Preferences/<APP_BUNDLE_ID>.plist

  1. = MAC user name
  2. <DEVICE_ID> = Device/Simulator Identifier, e.g., 999271B8-FAA6-41DE-9864-4111F422ED12
  3. <APP_ID> = Application identifier, e.g., 69928AEF-BCD5-413A-B06F-BC4A07080D62
  4. <APP_BUNDLE_ID> = Your apps bundle identifier, e.g., com.company.appname.plist