Skip to main content

Around2Me – Instantly Discover Nearby Essentials

In today’s fast-paced world, finding what you need — exactly when you need it — should be effortless. That’s where Around2Me comes in. Whether you're navigating a new city, running errands, or just looking for a bite nearby, Around2Me helps you instantly find nearby essentials like ATMs, restaurants, hospitals, gas stations , and much more. Around2Me 🚀 What Makes Around2Me Different? Unlike many location-based apps that are bloated with unnecessary features or force users to sign up, Around2Me is lightweight, private, and instant . Here's how: 📍 Location-Based Discovery The app instantly detects your current location and shows you relevant nearby places — from pharmacies to petrol pumps, cafes to banks. 🗺️ Map Integration Tap any place to view it on the map and get turn-by-turn directions in seconds. 🧩 Clean Categories Looking for something specific? Use quick-access filters like Hospitals , ATMs , Coffee Shops , or Parking . 🔐 No Signups, No Data Collection ...

Custom Higher Order Function Filter Even Number

An Any and AnyObject Difference

Custom Higher Order Function

 

 

 if an Any Declare 


 let anyValues: [Any] = [1, "two", 3, "four", ["name": "praveen"]]


 anyValues.forEach { (anyValue) in

    switch anyValue {

        

    case is Int:

        print("\(anyValue) is an Int!")

    case is String:

        print("\(anyValue) is String!")

    case is [String: Any]:

        print("\(anyValue) is Discnary!")

    default:

        print("\(anyValue) is de!")

        

    }

 }


Output => 


 1 is an Int!

 two is String!

 3 is an Int!

 four is String!

 ["name": "praveen"] is Discnary!


 if an AnyObject Declare 


let anyValues: [AnyObject] = [1, "two", 3, "four", ["name": "praveen"]]


Error==> Type of expression is ambiguous without more context



Custom Higher Order Function Filter Even Number 



 func coustomFilterNumber<T>(_ inputArray: [T], _ condition: (T) -> Int)-> [T]{

    

    var result = [T]()

    

    for element in inputArray{

        if (condition(element) != 0){

            result.append(element)

        }

    }

    

    return result

    

 }


 let nums = [2, 5, 10, 4, 6, 7, 11]

 let num = coustomFilterNumber(nums, {$0 % 2})

 print(num)


 Output -- > [5, 7, 11]



  Custom function to apply multiple conditions?



struct Person {

    let name: String

    let age: Int

    let isEmp: Bool

}



func EmpFilter(_ persons: [Person], _ filters: [(Person) -> Bool]) -> [Person]{

    

    var result: [Person] = []

    

    for person in persons{

        var shouldInc = true

    

        for filter in filters{

            if !filter(person){

                shouldInc = false

                break

            }

        }

        if shouldInc{

            result.append(person)

        }

    }

    return result

}


let people = [

    Person(name: "Alexander", age: 28, isEmp: true),

    Person(name: "Bob", age: 22, isEmp: false),

    Person(name: "Catalina", age: 35, isEmp: true),

    Person(name: "Diana", age: 40, isEmp: false),

    Person(name: "Emly", age: 19, isEmp: true)

]


let filter: [(Person) -> Bool] = [

    {$0.age > 25},

    {$0.isEmp},

    {$0.name.count > 5}

]


let filterPeson = EmpFilter(people, filter)


for feson in filterPeson{

    print("\(feson.name), Age: \(feson.age), Employed: \(feson.isEmp)")

}



Comments