Skip to content

Instantly share code, notes, and snippets.

View quocnb's full-sized avatar
♟️

Quoc Nguyen quocnb

♟️
View GitHub Profile

Tools:

*** Install Xcode first for save the time *** Homebrew need xcode command line tools first

Homebrew

https://brew.sh/

Gitcomplete

Install Git and bash-completion:

brew install git && brew install bash-completion
@quocnb
quocnb / XibLocalized.swift
Created October 31, 2017 23:50
#iOS#Swift Localized String For Xib File
public protocol Localizable {
func localize()
}
public extension Localizable {
public func localize(_ string: String?) -> String? {
guard let term = string, term.hasPrefix("@") else {
return string
}
@quocnb
quocnb / UserNotificationsExample.swift
Last active March 16, 2022 12:28
UserNotifications iOS 10 Example
import UserNotifications
// 1. Request Permission
func requestAuthorization() {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { (granted, error) in
if granted {
// Success
} else {
// Error
print(error?.localizedDescription)