This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftSyntax | |
@SwiftSyntaxRule | |
struct OneDelarationPerFileRule: OptInRule { | |
var configuration = SeverityConfiguration<Self>(.warning) | |
static let description = RuleDescription( | |
identifier: "one_declaration_per_file", | |
name: "One Declaration Per File", | |
description: "Only a single declaration is allowed in a file", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
var make: String | |
var model: String | |
init(make: String, model: String) { | |
self.make = make | |
self.model = model | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
var make: String | |
var model: String | |
init(make: String, model: String) { | |
self.make = make | |
self.model = model | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReverseGeoCodingViewModel { | |
var requestIdentifier: Int = 0 | |
func reverseGeoCodeLocation(_ coordinate: CLLocationCoordinate2D, | |
completion: @escaping GMSReverseGeocodeCallback) { | |
self.requestIdentifier += 1 | |
let currentRequestIdentifier = self.requestIdentifier | |
let geocoder = GMSGeocoder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReverseGeoCodingViewModel { | |
func reverseGeoCodeLocation(_ coordinate: CLLocationCoordinate2D, | |
completion: @escaping GMSReverseGeocodeCallback) { | |
let geocoder = GMSGeocoder() | |
geocoder.reverseGeocodeCoordinate(coordinate) { response, error in | |
completion(response, error) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Product { | |
func startingPrice() -> Double { | |
return self.variants.min(by: {$0.price < $1.price})?.price ?? 0.0 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product { | |
var id: Int | |
var name: String | |
var image: String | |
var variants: [Variant] | |
} | |
class Variant { | |
var id: Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let limit = 13 | |
let queryString = "text" | |
let targettedString = "Lorem Ipsum is simply dummy text of the printing and typesetting" | |
let queryRange = targettedString.range(of: queryString) | |
let distanceToStart = max(self.distance(from: queryRange.lowerBound, to: self.startIndex), -limit) | |
let distanceToEnd = min(self.distance(from: queryRange.upperBound, to: self.endIndex), limit) | |
let start = self.index(queryRange.lowerBound, offsetBy: distanceToStart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// splashanimation | |
// | |
// Created by Muhammad Zeeshan on 05/04/2020. | |
// Copyright © 2020 mzeeshanid. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var images: [UIImage] = [] | |
var currentIndex: Int = 0 | |
var isScreenVisible: Bool = false |
NewerOlder