Skip to content

Instantly share code, notes, and snippets.

View samredai's full-sized avatar

Samuel Redai samredai

View GitHub Profile
@yoni-g
yoni-g / closeAppElegantly.swift
Last active May 12, 2024 17:57
How to exit an iOS app without it looking like a crash? - Swift
func showMessageResetApp(){
let exitAppAlert = UIAlertController(title: "Restart is needed",
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.",
preferredStyle: .alert)
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) {
(alert) -> Void in
// home button pressed programmatically - to thorw app to background
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
// terminaing app in background
@samredai
samredai / remove_latest_commit_in_github.sh
Last active January 24, 2020 18:30
Git: Remove the latest commit in GitHub
git push -f origin HEAD^:master
# Note that you if you just want to remove a commit locally and...
# ...keep the change as uncommited modifications to the local files, use the line below:
git reset --soft HEAD~1