let valuesArray = ["ab","bc","cd"]
valuesArray.contains(str) // -> Bool
More Related Contents:
- Swift 2 – Pattern matching in “if”
- How to compare one value against multiple values in Swift?
- Codewars – Swift Solution (Multiply Function)
- type 'UIViewController' has no member updateTimer
- What is the “?” or “!” in front of a function in swift code
- What does it mean print(_:separator:terminator:)
- Why Choose Struct Over Class?
- Swift – Sort array of objects with multiple criteria
- How to stop a DispatchWorkItem in GCD?
- Swift 3 for loop with increment
- binary operator * cannot be applied to operands of type Int and Double
- Decrement index in a loop after Swift C-style loops deprecated
- What is the meaning of the ‘#’ mark in swift language
- Can you execute an Applescript script from a Swift Application
- Extend array types using where clause in Swift
- Is there a Swift alternative for NSLog(@”%s”, __PRETTY_FUNCTION__)
- TabView resets navigation stack when switching tabs
- What is the best way to determine if a string contains a character from a set in Swift
- PNG/JPEG representation from CIImage always returns nil
- Checking if an object is a given type in Swift
- Closure with generic parameters
- Include SwiftUI views in existing UIKit application
- Determining if Swift dictionary contains key and obtaining any of its values
- try, try! & try? what’s the difference, and when to use each?
- Sharing UserDefaults between extensions
- Swift optional inout parameters and nil
- Saving WebView to PDF returns blank image?
- How to use an NSAttributedString with a ScrollView in SwiftUI?
- Swift Protocol inheritance and protocol conformance issue
- How to configure ContextMenu buttons for delete and disabled in SwiftUI?