Skip to content

Instantly share code, notes, and snippets.

View ajaysinghthakur's full-sized avatar
🏠
Working from home

ajay singh thakur ajaysinghthakur

🏠
Working from home
View GitHub Profile
@ajaysinghthakur
ajaysinghthakur / macros.swift
Last active March 30, 2022 07:41
Swift preprocessory macros #swift #debug
// MARK: - <#label#>
// TODO: [your to-do item]
// FIXME: [your bug fix reminder]
#warning("Some string to display")
#error("Some error to display")
@ajaysinghthakur
ajaysinghthakur / middleloop.swift
Created September 16, 2021 08:32
Iterate an array from the any index then the beginning, can transverse array all element from any starting index
let a = [1,2,3,4,5,6]
let startIndex = 5
let endIndex = a.count
for i in stride(from: 0, to: endIndex, by: 1) {
let newIndex = (i + startIndex) % endIndex
print(newIndex)
}