get url query in liquid

To get the URL query in Objective-C using Liquid, you can use the following code:

NSString *urlString = @"https://example.com/path?param1=value1&param2=value2";
NSURLComponents *urlComponents = [NSURLComponents componentsWithString:urlString];
NSArray<NSURLQueryItem > queryItems = urlComponents.queryItems;
NSMutableDictionary<NSString , NSString > *queryDictionary = [NSMutableDictionary dictionary];

for (NSURLQueryItem *queryItem in queryItems) {
    [queryDictionary setObject:queryItem.value forKey:queryItem.name];
}

// Access the query parameters
NSString *param1Value = queryDictionary[@"param1"];
NSString *param2Value = queryDictionary[@"param2"];

This code takes a URL string, parses it using NSURLComponents, and retrieves the query items using the queryItems property. It then creates a dictionary to store the query parameters, where the parameter names are the keys and the parameter values are the values. Finally, you can access the query parameters by using the keys in the dictionary.

Please note that this code assumes that the URL string is in the correct format and contains valid query parameters. You may need to add additional error handling and validation based on your specific requirements.

[[SOURCE 1]]