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)
}
@ajaysinghthakur
ajaysinghthakur / annoation.swift
Created May 21, 2016 07:44
adding detail callout accesory view to mkannonationview to show map snapshot
func configureDetailView(annotationView: MKAnnotationView) {
let width = 300
let height = 200
let snapshotView = UIView()
let views = ["snapshotView": snapshotView]
snapshotView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:[snapshotView(300)]", options: [], metrics: nil, views: views))
snapshotView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:[snapshotView(200)]", options: [], metrics: nil, views: views))
self.takeSnapshot(mapView , annotationView: annotationView) { (image, error) in