Process user-inputted conditions (==, &&) inside app
I have the task, and I can understand how to deal with it (in what direction I need to start). Application need to understand user-inputted condition like that: ((VAR1 != 1 && VAR2 == 2) OR (VAR3 != 1 && VAR4 == 2)) AND (VAR5 = 2) I have that variables inside my database, so it's no problem to replace VAR1 with real data. How in what way I can process that condition inside application. I thought about separating full condition to little blocks, but I don't understand yet how to separate, there is no symbol that I can split string. So can you help in what direction I need to start working to process such conditions in Swift app?
Thanks to #Sulthan, NSPredicate is solution. let expressionString = "((1 == 1) or (1 == 2)) and (1 == 2)" let predicate = NSPredicate(format: expressionString) print(predicate.evaluateWithObject(nil)) // Output: false
Deprecated push segues and unwanted modal behavior
Message sent to deallocated instance in swift
How can I read a json file in the Documents Directory in swift?
NSFastEnumerationIterator.Element (aka Any) has no subscript members
What is the difference between the modal presentation style “over current context” and “over fullscreen”?
(iOS) Increasing memory consumption related to GameScene
UICollectionView crashes when scrolling to the bottom
Flexbox on IOS scrolls differently
Firing an embeded AVPlayerViewController programatically from a TableView
Dissmiss alertview created by LMAlertView on outside tap
Cordova build failed for ios after installing pushwoosh notifications plugin
Facebook not redirecting to application from safari view
Custom rounded UIView in Swift?
Swift concatenate string based on different values
Xcode 8 GM App running on simulator but not on device pods issue
WKWebView loadFileURL works only once