Skip to content

Instantly share code, notes, and snippets.

View surjeet-probo's full-sized avatar

Surjeet Singh Rajput surjeet-probo

View GitHub Profile
@luthviar
luthviar / BottomSheetPeopleDetectedInputView+SwiftUI+UIKit.swift
Created August 12, 2024 03:26
Create a Bottom Sheet SwiftUI View and present from UIKit UIViewController
class ViewController: UIViewController, BottomSheetPeopleDetectedInputDelegate {
private var overlayView: UIView?
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
let showButton = UIButton(type: .system)
showButton.setTitle("Show Bottom Sheet", for: .normal)
showButton.addTarget(self, action: #selector(showBottomSheet), for: .touchUpInside)
@huynguyencong
huynguyencong / #BuildiOSWithGitHubAction.md
Last active November 29, 2025 16:44
Script to build iOS and deploy it to TestFlight using GitHub action

When merging code to build/test-flight branch, it is built and uploaded to TestFlight automatically by GitHub Action.

Set up/update the following secrets:

  • CERTIFICATES_FILE_BASE64: Base64 of the App Store distribution certificate.
  • CERTIFICATES_PASSWORD: App Store distribution certificate password.
  • APPSTORE_ISSUER_ID: App Store Connect API key's issuer ID.
  • APPSTORE_KEY_ID: App Store Connect API key's key ID.
  • APPSTORE_PRIVATE_KEY: App Store Connect API key's private key (raw p8 file).
@brennanMKE
brennanMKE / README.md
Last active September 5, 2025 12:21
Create SSH Key on Mac for Xcode

Create SSH Key on Mac for Xcode

The docs for GitHub show a command to create a key with the ed25519 encryption method which is not allowed by Xcode. Even if you are not using the Source Control features in Xcode you will often need to use an account with GitHub when you are consuming Swift packages which are pulled from GitHub.

For SSH keys there are 4 algorithms.

  • 🚨 DSA: This is an older algorithm which is no longer supported and is superceded with more modern algorithms.
  • ⚠️ RSA: This algorithm was an improvement but it is now outdated and a more modern method should be used.
  • 👀 ECDSA: Another improvement which is dependent on your computer's ability to generate random numbers.
  • ✅ Ed25519: The most recommended public-key algorithm today which you should use with GitHub.
@globulus
globulus / SwiftUIFreeformDrawing.swift
Created June 29, 2021 15:27
SwiftUI freeform drawing
struct DrawingPath {
private var points = [CGPoint]()
private var breaks = [Int]()
mutating func addPoint(_ point: CGPoint) {
points.append(point)
}
mutating func addBreak() {
breaks.append(points.count)
@patriknyblad
patriknyblad / xcrun_simctl_cheatsheet.md
Last active September 10, 2025 15:53
iOS Simulator Terminal Commands `$ xcrun simctl`

Managing iOS Simulators

List all simulators created

$ xcrun simctl list --json

Delete old and unavailable simulators

$ xcrun simctl delete unavailable
@hcn1519
hcn1519 / GradientLayer.md
Last active February 8, 2025 21:59
UITableViewCell with GradientLayer in swift

Create GradientLayer on your tableViewCell(collectionViewCell)

1. Create CAGradientLayer Instance on your tableViewCell

class MyCell: UITableViewCell {
    let gradientLayer = CAGradientLayer()
}
@mwaterfall
mwaterfall / StringExtensionHTML.swift
Last active April 17, 2025 13:04
Decoding HTML Entities in Swift
// Very slightly adapted from http://stackoverflow.com/a/30141700/106244
// 99.99% Credit to Martin R!
// Mapping from XML/HTML character entity reference to character
// From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
private let characterEntities : [String: Character] = [
// XML predefined entities:
""" : "\"",
"&" : "&",