Skip to content

Instantly share code, notes, and snippets.

View NicholasTD07's full-sized avatar

Nicholas T. NicholasTD07

View GitHub Profile
@RuiAAPeres
RuiAAPeres / SwiftUIBindsWithReactiveSwift.swift
Last active December 12, 2023 09:30
Couple of methods to bridge ReactiveSwift with SwiftUI
import Combine
import ReactiveSwift
import SwiftUI
class AnySubscription: Subscription {
private let cancelable: Cancellable
init(cancelable: Cancellable) {
self.cancelable = cancelable
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use a Kotlin MPP library depending on an iOS Framework in a XCode iOS App

This gist demonstrates how to use a Kotlin MPP library which depends on an iOS Framework in a native iOS application (XCode project).

First, see [how the Kotlin MPP Library is built][lib-build].

Key ideas:

  • We can currently only use a single Kotlin MPP library in an iOS project, so we need to create a MPP project local to our iOS XCode project whose sole purpose is to aggregate multiple MPP dependencies into a single Framework.
  • To keep our working environment clean, we create the gradle project in a subdirectory instead of at the root of our iOS XCode project. I name my subdirectory mpp.
  • We need to have the Frameworks used by our dependencies locally, as we only have bindings provided by the cinterop klibs, so we use [Carthage] again.
  • As the only goal of our gradle project is to create a Framework, we only use ios* targets.
  • Our project won't have any source code, but we NEED at least one source file, or Gradle will refuse to build anything, returning just a rude NO-SOURCE. Just create
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use an iOS Framework in a Kotlin MPP library published to Maven

This gist demonstrates how to build a Kotlin MPP library so that the iOS sourceSet depends on and uses an iOS Framework as a dependency.

Key ideas:

  • We use [Carthage] to retrieve/build the iOS Framework.
  • We use [cinterop] to create bindings allowing us to use the iOS Framework from Kotlin
  • We build and publish the library using ./gradlew publishToMavenLocal
  • We build and publish [klib] artifacts for both the arm64 and x86_64 architectures, you can easily add arm32 if you need.
  • Note that the publish process also publishes a cinterop klib artifact, allowing dependents to also know about the iOS Framework headers.

You can find a gist explaining how to use such library in an iOS app [here][ios-app].

@NicholasTD07
NicholasTD07 / clean_up_and_create_sims.rb
Last active October 11, 2018 23:38
This script can be used to delete all your iOS simulators and recreate the ones you want.
require 'pp'
require 'fastlane'
require 'snapshot/reset_simulators'
# Run the script where you have fastlane installed with `bundle exec ruby clean_up_and_create_sims.rb`
def delete_all_iOS_sims
FastlaneCore::Simulator.delete_all
end
@thomaswitt
thomaswitt / VPNConfigurationProfiles.mobileconfig
Last active May 1, 2024 18:03
An OnDemand VPN iOS profile for iPad and iPhone that automatically connects you to different VPNs (e.g. Meraki, FRITZ!Box and Streisand) | Blog-Entry: https://thomas-witt.com/auto-connect-your-ios-device-to-a-vpn-when-joining-an-unknown-wifi-d1df8100c4ba
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<!-- Home: Manual -->
<dict>
<key>UserDefinedName</key>
@NicholasTD07
NicholasTD07 / codecov-with-spm.md
Created May 10, 2017 23:29
Generate code coverage report with Swift Package Manager

Set up

gem install xcov # required | might need sudo
gem install fastlane # optional | might also need sudo

Generate code coverage report

@fpillet
fpillet / Results+Rx.swift
Created February 13, 2016 17:23
turn Realm auto-updating Results into an RxSwift Observable sequence
//
// Results+Rx.swift
//
// Make Realm auto-updating Results observable. Works with Realm 0.98 and later, RxSwift 2.1.0 and later.
//
// Created by Florent Pillet on 12/02/16.
// Copyright (c) 2016 Florent Pillet. All rights reserved.
//
import Foundation
@NicholasTD07
NicholasTD07 / how-to-download-iOS-simulator-in-command-line-and-install-it.md
Last active November 10, 2023 19:39
How to Download iOS Simulator (Xcode) in Command Line and Install it

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@alanzeino
alanzeino / lldb-debugging.md
Last active April 28, 2024 10:21
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@NicholasTD07
NicholasTD07 / TimeTracking.swift
Last active March 5, 2021 01:26
I use this to know how many hours I work a day.
#!/usr/bin/env xcrun swift
// Usage: path/to/TimeTracking.swift
// Go to bottom to see how it's used.
// The MIT License (MIT)
// Copyright (c) 2015 Nicholas T.
// Permission is hereby granted, free of charge, to any person obtaining a copy