Skip to content

Instantly share code, notes, and snippets.

@sandeeplearner
sandeeplearner / .swift
Last active May 11, 2020 22:01
class confirming to description protocol
class A: Description {
func discribe() -> String {
return "Class Name - A and Author is Sandeep Bhandari"
}
}
class B: Description {
func discribe() -> String {
return "Class Name - B and Author is Sandeep Bhandari"
}
@sandeeplearner
sandeeplearner / .swift
Created May 11, 2020 21:46
NameAndAuthorName
protocol Description {
func discribe() -> String
}
@sandeeplearner
sandeeplearner / .swift
Created May 11, 2020 21:01
Variable declaration
var genericOperationClass: GenericOperations!
@sandeeplearner
sandeeplearner / .swift
Created May 11, 2020 20:50
ViewController confirming to protocol
class ViewController: UIViewController,GenericOperations {
typealias Operand = Int
override func viewDidLoad() {
super.viewDidLoad()
let a = 100
let b = 200
debugPrint(self.add(operand1: a, operand2: b))
}
}
@sandeeplearner
sandeeplearner / .swift
Last active May 11, 2020 20:49
Protoco Extension work around
protocol GenericOperations {
associatedtype Operand
func add(operand1: Operand, operand2: Operand) -> Operand
}
extension GenericOperations where Operand == Int {
func add(operand1: Operand, operand2: Operand) -> Operand {
return operand1 + operand2
}
}
@sandeeplearner
sandeeplearner / .swift
Created May 11, 2020 20:17
Classes to confirm GenericOperations
class A: GenericOperations {
typealias Operand = Int
func add(operand1: Int, operand2: Int) -> Int {
return operand1 + operand2
}
}
class B: GenericOperations {
typealias Operand = String
@sandeeplearner
sandeeplearner / GenericOperations.swift
Created May 11, 2020 20:01
Generic Operations Protocol
protocol GenericOperations {
associatedtype Operand
func add(operand1: Operand, operand2: Operand) -> Operand
}
@sandeeplearner
sandeeplearner / altool command
Created December 3, 2017 21:47
altool command
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f ~/Desktop/your_project.ipa -u [email protected] -p your_itunes_connect_password
@sandeeplearner
sandeeplearner / concatenated command
Created December 3, 2017 20:38
concatenated command
security unlock-keychain -p "your_system_password" ~/Library/Keychains/login.keychain-db && xcodebuild -workspace your_project.xcworkspace/ -scheme your_project_schema -sdk iphoneos -configuration "${CONFIGURATION}" archive -archivePath /Users/Shared/Jenkins/Documents/build/your_project.xcarchive PROVISIONING_PROFILE="${PROVISION_PROFILE}" && xcodebuild -exportArchive -archivePath /Users/Shared/Jenkins/Documents/build/your_project.xcarchive/ -exportPath ~/Desktop/ -exportOptionsPlist ExportOptions.plist
@sandeeplearner
sandeeplearner / unlock keychain
Created December 3, 2017 20:33
unlock keychain
security unlock-keychain -p "your_system_password" ~/Library/Keychains/login.keychain-db