---
title: "Contentstack Delivery Objective C SDK"
description: "Documentation for Objective C  Delivery SDK"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/ios/reference"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2025-09-15"
---

# Contentstack Delivery Objective C SDK

## Contentstack - Objective-C Delivery SDK

## Overview

The Contentstack iOS CDA SDK (Objective-C) is planned for deprecation. We recommend migrating to the [Swift CDA SDK](/docs/developers/sdks/content-delivery-sdk/ios/get-started-with-swift-sdk#sdk-installation-and-setup) to ensure continued support and access to future updates.

## Objective C SDK for Contentstack's Content Delivery API

Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest.[Read More](https://www.contentstack.com/).

## Prerequisites

To get started with iOS SDK, you will need the following:

*   Latest version of Xcode
*   Objective-C and Swift 4.2 and above
*   iOS 10 or later.

## SDK installation and setup

Contentstack offers seven [regions](/docs/administration/about-regions) AWS North America (AWS NA), AWS Europe (AWS EU), AWS Australia (AWS AU), Azure North America (AZURE NA), Azure Europe (AZURE EU), GCP North America(GCP NA), and GCP Europe(GCP EU) as data centers to store customers' account details and data. These regions are independent of each other and therefore have a dedicated set of instructions to use SDKs offered by Contentstack.

To use SDKs for the Europe, Australia, Azure NA, or Azure EU region, you will have to make certain changes in the configuration of the SDK, as detailed below, and the rest of the instructions remain the same.

To add the Contentstack iOS SDK to your existing project, perform the following steps:

**SDK Installation:**

You can use the SDK using CocoaPods. Add the following line to your Podfile:

```
pod 'Contentstack'
```

Then, run the command given below to get the latest release of Contentstack.

```
pod install
```

**Import header/module:**

You can either import the header or the module. Import the header file in Objective-C project using the command given below:

```
#import <Contentstack/Contentstack.h>
```

Import the header files as a module too:

1.  Swift
    
    ```
    import Contentstack
    ```
    
2.  Objective C
    
    ```
    @import Contentstack
    ```

## Quickstart in 5 mins

## Initialize SDK

To initialize the SDK, specify application context, the stack’s API key, Delivery token, and name of the environment where you will publish the content, as shown in the snippet below:

1.  Swift
    
    ```
    let stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT")
    ```
    
2.  Objective C
    
    ```
    Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
    ```
    

**For Setting other Regions:**

To set and use the SDK for the AWS Europe, AWS AU, Azure NA, Azure EU, GCP NA, or GCP EU region refer to the code below:

1.  Swift
    
    ```
    var config: Config = Config();
    config.region = ContentstackRegion.EU; //ContentstackRegion.AU; or ContentstackRegion.AZURE_NA or ContentstackRegion.AZURE_EU or ContentstackRegion.GCP_NA or ContentstackRegion.GCP_EU
    
    lt stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN",environmentName:"ENVIRONMENT", config:config)
    ```
    
2.  Objective C
    
    ```
    Config *config = [[Config alloc] init];
    config.region = EU; //AU or AZURE_NA or AZURE_EU or GCP_NA or GCP_EU
     Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT" config:config];
    ```
    

Once you have initialized the SDK, you can query entries to fetch the required content.

**For Setting the Branch:**

If you want to initialize SDK in a particular branch use the code given below:

1.  Swift
    
    ```
    var config: Config = Config();
    config.branch = "branch";
    let stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN",environmentName:"ENVIRONMENT", config:config)
    ```
    
2.  Objective C
    
    ```
    Config *config = [[Config alloc] init];
    config.branch = @"branch";
    Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT" config:config];
    ```

## Basic Queries

**Get a Single Entry**

To retrieve a single entry from a content type, use the code snippet given below:

1.  Swift
    
    ```
    let stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT")var contentType:ContentType = stack.contentType(withName: "CONTENT_TYPE_UID")var entry:Entry = contentType.entry(withUID: "ENTRY_UID")entry.fetch { (responseType, error) -> Void in}
    ```
    
2.  Objective C
    
    ```
    Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];Entry *entry  = [contentType entryWithUID:@"ENTRY_UID"];[entry fetch:^(ResponseType type, NSError * _Nullable error) {}];
    ```
    

**Get Multiple Entries**To retrieve multiple entries of a particular content type, use the code snippet given below:

1.  Swift
    
    ```
    let stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT")var contentType:ContentType = stack.contentType(withName: "CONTENT_TYPE_UID")var query: Query = contentType.query()query.find { (responseType, result, error) -> Void in}
    ```
    
2.  Objective C
    
    ```
    Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];Query *query  = [contentType <span>query</span>];[query find:^(ResponseType type,  QueryResult *result,, NSError * _Nullable error) {}];
    ```

## Paginating Responses

In a single instance, the [Get Multiple Entries](/docs/developers/sdks/content-delivery-sdk/dot-net/get-started-with-dot-net-delivery-sdk) query will **retrieve only the first 100 items** of the specified content type. You can paginate and retrieve the rest of the items in batches using the skip and limit parameters in subsequent requests.

1.  Swift
    
    ```
    let stack:Stack = Contentstack.stack(withAPIKey: "API_KEY", accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT")var contentType:ContentType = stack.contentType(withName: "CONTENT_TYPE_UID")var query:Query = contentType.query()    query.limitObjects(NSNumber(int:20))query.skipObjects(NSNumber(int: 20))query.find { (responseType, result!, error!) -> Void in}
    ```
    
2.  Objective C
    
    ```
    Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];Query *query  = [contentType query</span>];[query limitObjects:@(20)];[query skipObjects:@(20)];[query find:^(ResponseType type, QueryResult *result, NSError *error) {}];
    ```

## Contentstack

Contentstack class that exposes Stack instance

## stackWithAPIKey:accessToken:environmentName:

Create a new Stack instance with stack’s API key, Delivery token, and Environment.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN"
environmentName:@"ENVIRONMENT"];
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT")
```

Stack API Key.

Environment specific delivery token.

Stack environment id to fetch content

## stackWithAPIKey:accessToken:environmentName:config:

Create a new Stack instance with stack’s API key, Delivery token, Environment and Config.

```
Obj-C
Config *config = [[Config alloc] init];
config.host = @"customcontentstack.io";
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN"
environmentName:@"ENVIRONMENT" config:config];
Swift
let config:Config = Config()
config.host = "customcontentstack.io"
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:"ENVIRONMENT", config:config)
```

Stack API Key.

Environment specific delivery token.

Stack environment id to fetch content

Config of stack.

## cancelAllRequestsOfStack:

Cancel all network request for Stack instance.

```
Obj-C
[Contentstack cancelAllRequestsOfStack:stack];
Swift
Contentstack.cancelAllRequestsOfStack(stack)
```

Instance of Stack.

## Contentstack | iOS Delivery SDK | Contentstack

Contentstack exposes the Stack instance in the iOS Delivery SDK, serving as the entry point for accessing your content.

## CachePolicy

The cache policies allow you to define the source from where the SDK will retrieve the content. Based on the selected policy, the SDK can get the data from cache, network, or both.Let’s look at the various cache policies available for use:  
  

**POLICIES**

**DESCTIPTION**

NETWORK\_ONLY (default)

If you set NETWORK\_ONLY as the cache policy, the SDK retrieves data through a network call, and saves the retrieved data in the cache. This is set as the default policy.

CACHE\_ELSE\_NETWORK

If you set CACHE\_ELSE\_NETWORK as the cache policy, the SDK gets data from the cache. However, if it fails to retrieve data from the cache, it makes a network call.

NETWORK\_ELSE\_CACHE

If you set NETWORK\_ELSE\_CACHE as the cache policy, the SDK gets data using a network call. However, if the call fails, it retrieves data from cache.

CACHE\_THEN\_NETWORK

If you set CACHE\_THEN\_NETWORK as the cache policy, the SDK gets data from cache, and then makes a network call. (A success callback will be invoked twice.)

CACHE\_ONLY

If you set CACHE\_ONLY as the cache policy, the SDK gets data from the cache.

## CachePolicy | iOS Delivery SDK | Contentstack

CachePolicy defines where the iOS Delivery SDK retrieves content from, choosing between cache, network, or a combination of both.

## ContentstackRegion

**Fields**

NAME

DESCRIPTION

EU

To specify the EU region

AU

To specify the AU region

US

To specify the US region

AZURE\_NA

To specify the AZURE NA region

AZURE\_EU

To specify the AZURE EU region

GCP\_NA

To specify the GCP NA region

GCP\_EU

To specify the GCP EU region

## ContentstackRegion | iOS Delivery SDK | Contentstack

ContentstackRegion lets you specify the data center region such as US, EU, AU, Azure, or GCP in the iOS Delivery SDK.

## Config

Stack configuration for setting stack details.

## setEarlyAccess

With the setEarlyAccess header support, you can access features that are part of the early access program.

```
Config *config = [[Config alloc] init];
[config setEarlyAccess:@[@"Taxonomy",@"Teams",@"Terms", @"LivePreview"]];
```

Host name of Contentstack api server.

You can choose from seven regions namely NA, EU, AU, Azure NA, Azure EU, GCP NA and GCP EU.

API version of Contentstack api server.

Branch id for getting content from Stack

## Config | iOS Delivery SDK | Contentstack

Config sets stack configuration details such as host and region in the iOS Delivery SDK before initializing a Contentstack stack.

## PublishType

**Publish type is to sync specific type of contents:**

NAME

DESCRIPTION

ASSET\_PUBLISHED

To get only published asset in sync

ENTRY\_PUBLISHED

To get only published entries in sync

ASSET\_UNPUBLISHED

To get only unpublished assets in sync

ENTRY\_UNPUBLISHED

To get only unpublished entries in sync

ASSET\_DELETED

To get only deleted assets in sync

ENTRY\_DELETED

To get only deleted entries in sync

CONTENT\_TYPE\_DELETED

To get only content for deleted ContentType in sync

## PublishType | iOS Delivery SDK | Contentstack

PublishType lets you sync specific content states such as published, unpublished, or deleted entries and assets in the iOS Delivery SDK.

## ResponseType

**Publish type is to sync specific type of contents:**

NAME

DESCRIPTION

CACHE

Specified response is from the cache.

NETWORK

Specified response is from the network.

## ResponseType | iOS Delivery SDK | Contentstack

ResponseType indicates whether SDK content was returned from the cache or the network in the Contentstack iOS Delivery SDK.

## OrderBy

**Publish type is to sync specific type of contents:**

NAME

DESCRIPTION

OrderByAscending

Order by ascending

OrderByDescending

Order by descending

## OrderBy | iOS Delivery SDK | Contentstack

OrderBy lets you sort query results in ascending or descending order in the Contentstack iOS Delivery SDK.

## SyncStack

Represents the result of a sync operation.

Readonly property contains all the Contents

Readonly property to check skip count

Readonly property to check limit

Readonly property to check totalCount

Readonly property for paginating sync

Readonly property to delta sync.

## SyncStack | iOS Delivery SDK | Contentstack

SyncStack represents the result of a sync operation in the Contentstack iOS Delivery SDK.

## Stack

Initialize an instance of ‘Stack’

## contentTypeWithName:

Gets the new instance of ContentType object with specified name.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

ContentType *contentTypeObj = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var contentTypeObj:ContentType = stack.contentTypeWithName("CONTENT_TYPE_UID")
```

Uid of the contentType to perform action.

## setHeader:forKey:

Set a header for Stack.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[stack setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

Set a header for Stack

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[stack addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

Removes a header from this Stack.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[stack removeHeaderForKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.removeHeaderForKey("key")
```

The header key that needs to be removed.

## assetLibrary

Represents a Asset on ‘Stack’ which can be executed to get AssetLibrary object.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary *asset = [stack assetLibrary];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var asset:AssetLibrary = stack.assetLibrary()
```

## asset

Represents an Asset on ‘Stack’ which can be executed to get Asset object.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

Asset *asset = [stack asset];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var asset:Asset = stack.asset()
```

## assetWithUID:

Gets the new instance of Asset object with specified UID.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[[stack sync:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.sync({ ( syncStack:SyncStack, error: NSError) in

})
```

Uid of the Asset object to fetch.

## imageTransformWithUrl:andParams:

Transforms provided image url based on transformation parameters.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:100], @"width", [NSNumber numberWithInt:100], @"height", nil];
NSString *transformedUrl = [stack imageTransformWithUrl:imageURL andParams:params];
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let params:[String : AnyObject?] = [
  "width":100 as AnyObject,
  "height":100 as AnyObject,
];
let transformedUrl:String = stack.imageTransformation(withUrl: imageURL, andParams: params);
```

Url on which transformations to be applied.

Transformation parameters.

## getContentTypes:completion:

Gets all the ContentTypes and its Schema definition.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[stack getContentTypes:params completion:^(NSArray * _Nullable contentTypes, NSError * _Nullable error) {

 }];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.getContentTypes(params, { (contentTypes, error) in

})
```

params is dictionary of additional parameter

completionBlock to be called once operation is done.

## sync:

The Initial Sync request performs a complete sync of your app data. It returns all the published entries and assets of the specified stack in response. The response also contains a sync token, which you need to store, since this token is used to get subsequent delta updates later.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[[stack sync:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.sync({ ( syncStack:SyncStack, error: NSError) in

})
```

completionBlock called synchronization is done.

## syncPaginationToken:completion:

If the result of the initial sync (or subsequent sync) contains more than 100 records, the response would be paginated. It provides pagination token in the response. However, you do not have to use the pagination token manually to get the next batch, the SDK does that automatically until the sync is complete. Pagination token can be used in case you want to fetch only selected batches. It is especially useful if the sync process is interrupted midway (due to network issues, etc.). In such cases, this token can be used to restart the sync process from where it was interrupted.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[stack syncPaginationToken:@"PAGINATION_TOKEN" contentTypeArray completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.syncPaginationToken("PAGINATION_TOKEN", completion: { ( syncStack:SyncStack, error: NSError) in

})
```

Pagination token from where to perform sync

completionBlock called synchronization is done.

## syncToken:completion:

You can use the sync token (that you receive after initial sync) to get the updated content next time. The sync token fetches only the content that was added after your last sync, and the details of the content that was deleted or updated.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

[[stack syncToken:@"SYNC_TOKEN" contentTypeArray completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.syncToken("SYNC_TOKEN", completion: { ( syncStack:SyncStack, error: NSError) in

})
```

Sync token from where to perform sync

completionBlock called synchronization is done.

## syncOnly:completion:

Perform a synchronization operation on specified classes.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];</span>

NSArray *contentTypeArray = @[@“product”, @“multifield”]; 
[[stack syncOnly: contentTypeArray completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let contentTypeArray = [“product”, “multifield”]
stack.syncOnly(contentTypeArray, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

ContentType uids of classes to be expected.

completionBlock called synchronization is done.

## syncFrom:completion:

Perform a synchronization operation on specified date.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

NSDate *date = [NSDate date]; 
[[stack syncFrom:date completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let date = Date.date() 
stack.syncFrom(date, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

Date from where sync data is needed.

completionBlock called synchronization is done.

## syncOnly:from:completion:

Perform a synchronization operation on specified classes, and date.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];</span>

NSArray *contentTypeArray = @[@“product”, @“multifield”]; 
[[stack syncOnly: contentTypeArray from:date completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let contentTypeArray = [“product”, “multifield”]
stack.syncOnly(contentTypeArray, from: date, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

ContentType uids of classes to be expected.

Date from where sync data is needed.

completionBlock called synchronization is done.

## syncPublishType:completion:

Perform a synchronization operation on specified publishType.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];</span>

[[stack syncPublishType:ENTRY_PUBLISHED completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.syncPublishType(ENTRY_PUBLISHED, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

PublishType for which sync is needed.

completionBlock called synchronization is done.

## syncLocale:completion:

Perform a synchronization operation on specified locale.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];</span>

[[stack syncLocale:ENGLISH_UNITED_STATES completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

stack.syncLocale(locale:ENGLISH_UNITED_STATES, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

Locale for which sync is needed.

completionBlock called synchronization is done.

## syncLocale:from:completion:

Perform a synchronization operation on locale, and date.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

NSDate *date = [NSDate date]; 
[[stack syncLocale:ENGLISH_UNITED_STATES from:date completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let date = Date.date() 
stack.syncLocale(ENGLISH_UNITED_STATES, from: date, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

Locale for which sync is needed.

Date from where sync data is needed.

completionBlock called synchronization is done.

## syncOnly:locale:from:completion:

Perform a synchronization operation on specified classes, locale and date.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];</span>
NSArray *contentTypeArray = @[@“product”, @“multifield”]; 
NSDate *date = [NSDate date]; 
[[stack syncOnly: contentTypeArray locale:ENGLISH_UNITED_STATES from:date completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentTypeArray = [“product”, “multifield”]
let date = Date.date() 
stack.syncOnly(contentTypeArray, locale:ENGLISH_UNITED_STATES, from: date, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

ContentType uids of classes to be expected.

Locale for which sync is needed.

Date from where sync data is needed.

completionBlock called synchronization is done.

## syncOnly:locale:from:publishType:completion:

Perform a synchronization operation on specified classes, locale, date and publishType.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
NSArray *contentTypeArray = @[@“product”, @“multifield”]; 
NSDate *date = [NSDate date]; 
[[stack syncOnly: contentTypeArray locale:ENGLISH_UNITED_STATES from:date publishType:ENTRY_PUBLISHED completion:^(SyncStack * Nullable syncStack, NSError * Nullable error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentTypeArray = [“product”, “multifield”]
let date = Date.date() 
stack.syncOnly(contentTypeArray, locale:ENGLISH_UNITED_STATES, from: date, publishType:ENTRY_PUBLISHED, completion: { ( syncStack:SyncStack, error: NSError) in

})
```

ContentType uids of classes to be expected.

Locale for which sync is needed.

Date from where sync data is needed.

PublishType for which sync is needed.

completionBlock called synchronization is done.

Readonly property for Stack API Key

Readonly property for Stack of access token/delivery token specific to environment

Read only property of Stack environment to get content.

Read only property of Stack configuration.

## Stack | iOS Delivery SDK | Contentstack

Stack initializes an instance you use to access content types, entries, and assets in the Contentstack iOS Delivery SDK.

## ContentType

ContentType provides Entry and Query instance.

## setHeader:forKey:

Set a header for Stack.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType * contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
[contentType setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentType = stack.contentTypeWithName("CONTENT_TYPE_UID")
contentType.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

Set a header for Stack ContentType

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType * contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
[stack addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentType = stack.contentTypeWithName("CONTENT_TYPE_UID")
contentType.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

Removes a header from this Stack.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType * contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
[contentType removeHeaderForKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentType = stack.contentTypeWithName("CONTENT_TYPE_UID")
contentType.removeHeaderForKey("key")
```

The header key that needs to be removed.

## entryWithUID:

Gets the new instance of Entry object with specified UID.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType * contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry *entryObj = [contentType entryWithUID:@"ENTRY_UID"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let contentType = stack.contentTypeWithName("CONTENT_TYPE_UID")
let entryObj:Entry = contentType.entryWithUID("ENTRY_UID")
```

Uid of the Entry object to fetch.

## query

Represents a Query on ‘ContentType’ which can be executed to retrieve entries that pass the query condition

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType * contentType = [stack contentTypeWithName:@"<content_type_id>"]
Query *queryObj = [contentTypeObj query];
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let contentType = stack.contentTypeWithName("<content_type_id>")
var queryObj:Query = contentTypeObj.query()
```

## fetch:completion:

Gets ContentType Schema definition.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

ContentType * contentType = [stack contentTypeWithName:@"<content_type_id>"];
[contentType fetch:params completion:^(NSDictionary * _Nullable contentType, NSError * _Nullable error)  

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let contentType = stack.contentTypeWithName("<content_type_id>")
contentType.fetch(params, { (contentType, error) in
})
```

Fetch query parameters

Block to be called once operation is done.

## ContentType | iOS Delivery SDK | Contentstack

ContentType provides Entry and Query instances so you can access content of a content type in the Contentstack iOS Delivery SDK.

## Asset

The Asset class represents a single asset and fetches its metadata from the delivery API.

**Note:** For files **over 4 GB**, fileSize may overflow due to 32-bit type limits and may not represent the actual file size.

## setLocale

The setLocale method sets the locale code used when fetching the asset so the response is in the requested language.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset *asset = [stack assetWithUID:@"ASSET_UID"];
[asset setLocale:@"en-us"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.setLocale("en-us")
```

User-defined locale code for the request (e.g., en-us). Specifies the language of the content returned during the fetch operation.

## configureWithDictionary

The configureWithDictionary method configures the assets’ in-memory metadata (for example, after a fetch or for local use).

*   **Request behavior:** This method does not modify request parameters for fetch.
*   **For request parameters:** Use setLocale:, includeMetadata, or addParamKey:andValue:.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset configureWithDictionary:@{ @"key_name" : @"MyValue" }];Swift
let stack:Stack = Contentstack.stackWithAPIKey( "API_KEY" ,accessToken: "DELIVERY_TOKEN" , environmentName: "ENVIRONMENT" )
var asset:Asset = stack.assetWithUID( "ASSET_UID" )
asset.configureWithDictionary([ "key_name" : "MyValue" ])
```

**Key–value pairs** used to set the asset’s stored metadata (for example, uid, fileName, url). Replaces existing values for the provided keys.

## addParamKey:andValue

The addParamKey:andValue method adds a query parameter key–value pair to the Asset. The SDK sends the parameter with the next fetch request (for example, include\_dimension, locale, or other supported API keys).

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset addParamKey:@"include_dimension" andValue:@"true"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.addParamKey("include_dimension", andValue: "true")
```

User-defined key for the query parameter. Specifies the key sent during the fetch operation.

User-defined value for the query parameter. Specifies the value sent during the fetch operation.

## setHeader:forKey:

The setHeader:forKey sets a header for the Asset.

```
No return value. The header is applied to the next fetch requests (e.g., fetch:).
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset *asset = [stack assetWithUID:@"ASSET_UID"];
[asset setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

The addHeadersWithDictionary method sets a single header on the Asset.

*   **Multiple headers:** Use addHeadersWithDictionary:.
*   **Override behavior:** Headers set on the Asset override the same header from the Stack for that request only.

```
No return value. Headers are applied to subsequent requests (e.g., fetch:).
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset addHeadersWithDictionary:@{ @"My-Custom-Header" :  @"MyValue" }];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.addHeadersWithDictionary(["My-Custom-Header": "MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

The removeHeaderForKey removes a header from this Asset.

```
No return value. The header is no longer sent with subsequent requests.
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset:Asset = stack.assetWithUID( "ASSET_UID" )
asset.removeHeaderForKey( "key")
```

The header key that needs to be removed.

## includeMetadata

The includeMetadata method Includes metadata in the response body.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset* asset = [stack assetWithUID:@"ASSET_UID"];
[asset includeMetadata]; 
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var asset:Asset = stack.assetWithUID("ASSET_UID")
asset.includeMetadata()
```

## includeBranch

The includeBranch retrieves the branch for the published content.

```
No return value. Fallback behavior is applied to the next fetch.
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset includeBranch]; 
Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.includeBranch()
```

## fetch:

The fetch fetches an asset asynchronously (by UID or with a query built on the instance).

```
No return value. Completion block is called with ResponseType (CACHE or NETWORK) and NSError; on success, the Asset instance is populated with properties (fileName, url, etc.).
Obj-C
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.fetch { (responseType, error) -> Void in
    if let error = error {
        // Handle error
    }
}Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.fetch { (responseType, error) -> Void in
    if let error = error {
        // Handle error
    }
}
```

Block to be called once operation is done.

Returns the filename of the asset

Returns the size of the asset file

Returns the file type of the asset

Returns the unique identifier (UID) of the asset

Returns the URL of the asset

Retrieves the list of tags associated with the asset

Returns the date and time when the asset was created

Returns the user who created the asset

Returns the date and time when the asset was last updated

Returns the user who last updated the asset

Returns the date and time when the asset was deleted

Returns the user who deleted the asset

Returns the full asset object from the API response (all keys and values). The properties above are typed accessors for the main fields in this dictionary.

## Asset | iOS Delivery SDK | Contentstack

Asset represents a single media file in the iOS Delivery SDK and fetches its metadata from the Contentstack delivery API.

## AssetLibrary

AssetLibrary class to fetch details of files on Contentstack server.

## setHeader:forKey:

Set a header for AssetLibrary

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
AssetLibrary * asset = [stack assetLibrary];
[asset setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let asset = stack.assetLibrary()
asset.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

Set a header for AssetLibrary

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
AssetLibrary * asset = [stack assetLibrary];
[asset addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let asset = stack.assetLibrary()
asset.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

Removes a header from this AssetLibrary

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
AssetLibrary * asset = [stack assetLibrary];
[asset removeHeaderForKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let asset = stack.assetLibrary()
asset.removeHeaderForKey("key")
```

The header key that needs to be removed.

## sortWithKey:orderBy:

Sorts the assets in the given order on the basis of the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
AssetLibrary* asset = [stack assetLibrary];
[asset sortWithKey:@"updated_at" orderBy:Ascending];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var asset:AssetLibrary = stack.assetLibrary()
asset.sortWithKey("updated_at" orderBy:Ascending)
```

field uid based on which the ordering should be done.

ascending or descending order in which results should come.

## objectsCount

Provides only the number of assets.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset objectsCount];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.objectsCount()
```

## includeCount

This method also includes the total number of assets returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset includeCount];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.includeCount()
```

## includeRelativeUrls

This method includes the relative url of assets.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset includeRelativeUrls];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.includeRelativeUrls()
```

## includeFallback

Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset includeFallback];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.includeFallback()
```

## includeBranch

Retrieve the branch for the published content.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset includeBranch];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.includeBranch()
```

## locale:

This method provides all the assets for the specified language in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset locale:@"en-us"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.locale("en-us")
```

Language enum for all language available.

## fetchAll:

This method provides all the assets.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

AssetLibrary * asset = [stack assetLibrary];
[asset fetchAll:^(ResponseType type, NSArray *result, NSError *error) {

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let asset = stack.assetLibrary()
asset.fetchAll { (responseType, result!, error!) -> Void in

})
```

Block to be called once operation is done.

## where:

The where() method retrieves the assets from the stack using any other field UID of the assets.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
AssetLibrary * asset = [stack assetLibrary];
[asset where:@"fieldName"equalTo:@"Value"];
[asset fetchAll:^(ResponseType type, NSArray *result, NSError *error) {
if (error) { 
   NSLog(@"Error: %@", error.localizedDescription); 
} else {
   NSLog(@"Fetched assets: %@", result); }
}];

Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let asset = stack.assetLibrary()
asset.where("fieldName",equalTo:"Value")
asset.fetchAll { (responseType, result, error) in
if let error = error {
     print("Error: \(error.localizedDescription)") 
  } else { 
     print("Fetched assets: \(result)") 
  } 
}
```

Field UID of the Asset

The value to match for the field.

property to assign cache policy like CACHE\_THEN\_NETWORK, NETWORK\_ELSE\_CACHE, NETWORK\_ONLY, etc.

## AssetLibrary | iOS Delivery SDK | Contentstack

AssetLibrary fetches details of files stored on the Contentstack server through the iOS Delivery SDK, retrieving collections of assets.

## Entry

An initializer is responsible for creating Entry object.

## setHeader:forKey:

Set a header for Entry

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

Set a header for Entry

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

Removes a header from this Entry.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry removeHeaderForKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.removeHeaderForKey("key")
```

The header key that needs to be removed.

## configureWithDictionary:

Configure user properties with built object info.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry configureWithDictionary:@{@"key_name":@"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
var hashKey:Bool = entry.hasKey("key")
entry.configureWithDictionary(["key_name":"MyValue"])
```

The as dictionary which needs to be added to the application.

## hasKey:

Checks whether an entry has a given property.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
BOOL hashKey = [entry hasKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
var hashKey:Bool = entry.hasKey("key")
```

The property to be checked

## assetForKey:

Get the info of the specified key of Asset object and returns instance of Assets.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
Asset *asset = [entry assetForKey:@"asset"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
let asset = entry.assetForKey("asset")
```

Key containing the reference value of Asset

## assetsForKey:

Get the array containing instance of Assets mentioned in key specified.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
NSArray *assetArray = [entry assetsForKey:@"asset"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
let assetArray = entry.assetsForKey("asset")
```

Key containing the colection reference value of Assets.

## groupForKey:

Get the info of the specified key of Group object and returns instance of Group.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
Group *detailsGroup = [entry groupForKey:@"details"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
let detailsGroup = entry.groupForKey("details")
```

Key containing the value of Group

## groupsForKey:

Get the info of the specified key of content type and returns array of Group.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry groupsForKey:@"addresses"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.groupsForKey("addresses")
```

Key containing the value of Group array

## HTMLStringForMarkdownKey:

Converts Markdown to String of HTML String for specified key

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry HTMLStringForMarkdownKey:@"multiple_markdown"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.HTMLStringForMarkdownKey("Multiple_markdown")
```

Key is Multiple Markdown Parameter

## HTMLArrayForMarkdownKey:

Converts Markdown to Array of HTML String for specified key.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry HTMLArrayForMarkdownKey:@"multiple_markdown"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.HTMLArrayForMarkdownKey("Multiple_markdown")
```

Key is Multiple Markdown Parameter

## includeSchema

This method also includes the schema for the entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeSchema];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeSchema()
```

## includeContentType

This method also includes the contenttype for the entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeContentType];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeContentType()
```

## includeFallback

Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeFallback];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeFallback()
```

## includeBranch

Retrieve the branch for the published content.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeBranch];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeBranch()
```

## includeReferenceContentTypeUid

This method also includes the content type UIDs of the referenced entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeReferenceContentTypeUid];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeReferenceContentTypeUid()
```

## includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeEmbeddedItems];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeEmbeddedItems()
```

## includeOnlyFields:

Specifies an array of ‘only’ keys in BASE object that would be included in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeOnlyFields:@["name"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeOnlyFields(["name"])
```

Array of the ‘only’ keys to be included in response.

## includeAllFieldsExcept:

Specifies an array of keys in reference class object that would be ‘excluded’ from the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeAllFieldsExcept:@["name"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeAllFieldsExcept(["name"])
```

Array of keys to be excluded from the response.

## includeRefFieldWithKey:

Include reference objects with given key in response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry includeRefFieldWithKey:@[@"detail"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeRefFieldWithKey(["detail"])
```

Array of reference keys to include in response.

## includeRefFieldWithKey:andOnlyRefValuesWithKeys:

Specifies an array of ‘only’ keys in reference class object that would be included in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack  contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry* entry = [contentType  entryWithUID:@"ENTRY_UID"];
[entry includeRefFieldWithKey:@[@"detail"] andOnlyRefValuesWithKeys:@[@"description"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeRefFieldWithKey(["detail"], andOnlyRefValuesWithKeys:["description"])
```

Key who has reference to some other class object.

Array of the ‘only’ reference keys to be included in response.

## includeRefFieldWithKey:excludingRefValuesWithKeys:

Specifies an array of keys in reference class object that would be ‘excluded’ from the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry* entry = [stack includeRefFieldWithKey:@[@"detail"] excludingRefValuesWithKeys:@[@"description"];
[entry addParamKey:@"key" andValue:@"value"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.includeRefFieldWithKey(["detail"], excludingRefValuesWithKeys:["description"])
```

Key who has reference to some other class object.

Array of the ‘only’ reference keys to be ‘excluded’ from the response.

## addParamKey:andValue:

This method adds key and value to an Entry.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry* entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry addParamKey:@"key" andValue:@"value"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.addParamKey("key", andValue:"value")
```

The key as string which needs to be added to an Entry

The value as string which needs to be added to an Entry

## fetch:

Fetches an entry asynchronously provided entry UID.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];
[entry fetch:^(ResponseType type, NSError *error) 

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")
entry.fetch({ (responseType, error!) ->  in

})
```

Block to be called once operation is done.

## Variants

The variants method retrieves details of a specific entry variant or an array of entry variants based on the applied query.

```
Example 1:
#import <Contentstack/Contentstack.h>;

Stack* stack = [Contentstack stackWithAPIKey:<api_key> accessToken:<delivery_token> environmentName:<env_name>];

ContentType* ct = [stack contentTypeWithName:<ct_uid>];
Entry* entry = [ct entryWithUid:<entry_uid>];
[entry variantUid:<variant_uid/variant-alias>];

[entry fetch:^(ResponseType type, NSError *error) {
  if(error) {
    // catch error
  } else {
    // get response
  }
}];
Example 2:
#import <Contentstack/Contentstack.h>;

Stack* stack = [Contentstack stackWithAPIKey:<api_key> accessToken:<delivery_token> environmentName:<env_name>];

ContentType* ct = [stack contentTypeWithName:<ct_uid>];
Entry* entry = [ct entryWithUid:<entry_uid>];
[entry variantUids/variantAliases:[@"variantUid1/variantAlias1", @"variantUid2/variantAlias2",@"variantUid3/variantAlias3"]];

[entry fetch:^(ResponseType type, NSError *error) {
  if(error) {
    // catch error
  } else {
    // get response
  }
}];
```

Enter the UID of the variant

Readonly property to check value of entry’s uid

Readonly property to check if entry is deleted.

Readonly property to check tags of entry

Readonly property to check ContentType name of entry

Readonly property to check title of entry.

Readonly property to check url of entry.

Readonly property to check Language of entry

Readonly property to check createAt of entry

Readonly property to check createdBy of entry

Readonly property to check updatedAt of entry

Readonly property to check updatedBy of entry

Readonly property to check deletedAt of entry

Readonly property to check deletedBy of entry

The property to assign cache policy like CACHE\_THEN\_NETWORK, NETWORK\_ELSE\_CACHE, NETWORK\_ONLY, etc.

Readonly property to get data of entry.

## Entry | iOS Delivery SDK | Contentstack

Entry creates an object to retrieve a single piece of content created from a content type in the Contentstack iOS Delivery SDK.

## Query

An initializer is responsible for creating Query object.

## setHeader:forKey:

Set a header for Query

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

Set a header for Query

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

Removes a header from this Query.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query removeHeaderForKey:@"key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.removeHeaderForKey("key")
```

The header key that needs to be removed.

## locale:

This method provides all the entries for the specified language in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Query * query = [contentType query];
[query locale:@“en-us”];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.locale(“en-us”)
```

Language enum for all language available.

## tags:

This method provides only the entries that contain tags matching the ones mentioned in the function.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Query * query = [contentType query];
[query tags:@[@"phone", @"laptop"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.tags(["phone", "laptop"])
```

An array of tags that are to be included for the key

## orWithSubqueries:

This method performs the OR operation on the specified query objects and provides only the matching entries.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Query *query1 = [contentType query];
[query1 whereKey:@"total_hits" greaterThanOrEqualTo:@(800)];

Query *query2 = [contentType query];
[query2 whereKey:@"total_hits" lessThanOrEqualTo:@(1200)];

Query * query = [contentType query];
[query orWithSubqueries:@[query1, query2]];
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var query1:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query1.whereKey("total_hits", greaterThanOrEqualTo:800)

var query2:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query2.whereKey("total_hits", equalTo:1200)

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.orWithSubqueries([query1, query2])
```

Array of queries to be taken into consideration.

## andWithSubqueries:

This method performs the AND operation on the specified query objects and provides only the matching entries.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Query *query1 = [contentType query];
[query1 whereKey:@"total_hits" greaterThanOrEqualTo:@(800)];

Query *query2 = [contentType query];
[query2 whereKey:@"total_hits" lessThanOrEqualTo:@(1200)];

Query * query = [contentType query];
[query andWithSubqueries:@[query1, query2]];
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var query1:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query1.whereKey("total_hits", greaterThanOrEqualTo:800)

var query2:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query2.whereKey("total_hits", equalTo:1200)

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.andWithSubqueries([query1, query2])
```

Array of queries to be taken into consideration.

## orderByAscending:

Sorts the provided entries in the ascending order on the basis of the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query orderByAscending:@"updated_at"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.orderByAscending("updated_at")
```

The field uid based on which the ordering should be done.

## orderByDescending:

Sorts the provided entries in the descending order on the basis of the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query orderByDescending:@"updated_at"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.orderByDescending("updated_at")
```

The field uid based on which the ordering should be done.

## objectsCount

Provides only the number of entries with values matching the specified values for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query objectsCount];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.objectsCount()
```

## includeContentType

This method also includes the contenttype for the entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeContentType];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeContentType()
```

## includeFallback

Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeFallback];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeFallback()
```

## includeBranch

Retrieve the branch for the published content.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeBranch];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeBranch()
```

## includeReferenceContentTypeUid

This method also includes the content type UIDs of the referenced entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeReferenceContentTypeUid];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeReferenceContentTypeUid()
```

## includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeEmbeddedItems];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeEmbeddedItems()
```

## includeCount

This method also includes the total number of entries returned in the response.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeCount];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeCount()
```

## limitObjects:

This method limits the response by providing only the specified number of entries.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query limitObjects:@(5)];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.limitObjects(NSNumber(int:5))
```

Number of entries to be returned

## skipObjects:

This method provide response by skipping only the specified number of entries.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query skipObjects:@(5)];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.skipObjects(NSNumber(int:5))
```

Number of entries to be skipped before returned.

## addQueryWithKey:andValue:

Include custom query using a key and a value.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query  addQueryWithKey:@"key_name" andValue:@"MyValue"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.addQueryWithKey("key_name", andValue:"MyValue")
```

The name of the key to be added.

The value for the query key.

## addQueryParams:

A custom dictionary can be provided to a query that can specify the conditions for retrieving objects.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query addQueryParams:@{@"Query_Key":@"Query Value"}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.addQueryParams(["Query_Key":"Query Value"])
```

A dictionary with all the necessary conditions for retrieving objects.

## removeQueryWithKey:

Removes custom query.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query removeQueryWithKey:@"Query_Key"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.removeQueryWithKey("Query_Key")
```

The name of the query.

## whereKey:equalTo:

This method provides only the entries matching the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query  whereKey:@"title" equalTo:@"Welcome"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", equalTo:"Welcome")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:notEqualTo:

This method provides only the entries with values not equal to the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query  whereKey:@"title" notEqualTo:@"Welcome"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", notEqualTo:"Welcome")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:lessThan:

This method provides only the entries with a values less than the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"created_at" lessThan:@"2015-03-12"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("created_at", lessThan:"2015-03-12")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:greaterThan:

This method provides only the entries with values greater than the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"created_at" greaterThan:@"2015-03-12"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("created_at", greaterThan:"2015-03-12")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:lessThanOrEqualTo:

This method provides only the entries with values less than or equal to the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"created_at" lessThanOrEqualTo:@"2015-03-12"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("created_at", lessThanOrEqualTo:"2015-03-12")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:greaterThanOrEqualTo:

This method provides only the entries with values greater than or equal to the specified value for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query  whereKey:@"created_at" greaterThanOrEqualTo:@"2015-03-12"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("created_at", greaterThanOrEqualTo:"2015-03-12")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:containedIn:

This method provides only the entries with values matching the specified values for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"title" containedIn:@["Demo", @"Welcome"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", containedIn:["Demo", "Welcome"])
```

Uid of the field that is to be taken into consideration

An array of values that are to be used to match or compare

## whereKey:notContainedIn:

This method provides only the entries that do not contain values matching the specified values for a field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"title" notContainedIn:@["Demo", @"Welcome"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", notContainedIn:["Demo", "Welcome"])
```

Uid of the field that is to be taken into consideration

An array of values that are to be used to match or compare

## whereKeyExists:

This method provides only the entries that contains the field matching the specified field uid.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKeyExists:@"introduction"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKeyExists("introduction")
```

Uid of the field that is to be taken into consideration

## whereKeyDoesNotExist:

This method provides only the entries that do not contain the field matching the specified field uid.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKeyDoesNotExist:@"introduction"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKeyDoesNotExist("introduction")
```

Uid of the field that is to be taken into consideration

## whereKey:matchesRegex:

This method provides only the entries matching the regular expression for the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"title" matchesRegex:@"^wel"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", matchesRegex:"^wel")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

## whereKey:matchesRegex:modifiers:

This method provides only the entries matching the regular expression for the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query whereKey:@"title" matchesRegex:@"^wel" modifiers:@"i"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.whereKey("title", matchesRegex:"^wel", modifiers:"i")
```

Uid of the field that is to be taken into consideration

The value used to match or compare

Modifiers for regex options. Specify ‘i’ as the option to ignore the case.

## whereKey:in:

This method provides only the entries matching the Query.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];

Query * reference = [contentType query];
[reference whereKey:@"name" equalTo:@"Author"];

[query whereKey:@"author" in:reference];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()

var reference:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
reference.whereKey("name", equalTo:"Author")

query.whereKey("author", in:reference)
```

Reference Uid of the field that is to be taken into consideration.

Query to be taken into consideration

## whereKey:notIn:

This method provides only the entries matching the Query.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];

Query * reference = [contentType query];
[reference whereKey:@"name" equalTo:@"Author"];

[query whereKey:@"author" notIn:reference];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()

var reference:Query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
reference.whereKey("name", equalTo:"Author")

query.whereKey("author", notIn:reference)
```

Reference Uid of the field that is to be taken into consideration.

Query to be taken into consideration

## onlyFields:

This method provides only the entries that match the specified field uids and corresponding values.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query onlyFields:@[@"attachments"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.onlyFields(["attachments"])
```

An array of values that are to be included for the key

## exceptFields:

This method provides all entries except those that match the specified field uids and corresponding values.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query exceptFields:@[@"attachments"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.exceptFields(["attachments"])
```

An array of values that are to be included for the key

## includeReferenceFieldWithKey:

This method provides all entries that also contain data from the referred entry in the specified field.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeReferenceFieldWithKey:@"entry_a"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeReferenceFieldWithKey(@"entry_a")
```

Uid of the reference field that is to be taken into consideration

## includeReferenceFieldWithKey:onlyFields:

This method provides all entries including referred entry containing only specified fields.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeReferenceFieldWithKey:@"entry_a" onlyFields:@[@"attachments"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeReferenceFieldWithKey(@"entry_a", onlyFields:["attachments"])
```

Uid of the reference field that is to be taken into consideration

Uid of the reference field that is to be taken into consideration

## includeReferenceFieldWithKey:excludingFields:

This method provides all entries including referred entry containing all fields except specified fields.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query includeReferenceFieldWithKey:@"entry_a" excludingFields:@[@"attachments"]];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.includeReferenceFieldWithKey(@"entry_a", excludingFields:["attachments"])
```

Uid of the reference field that is to be taken into consideration

Uid of the reference field that is to be taken into consideration

## addParamKey:andValue:

This method provides all the entries from a specified ContentType.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query addParamKey:@"key" andValue:@"value"];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.addParamKey("key", andValue:"value")
```

The key as string which needs to be added to the Query

The value as string which needs to be added to the Query

## find:

This method provides all the entries from a specified ContentType.

**Note:** By default, the limit for response details per request is 100, with the maximum limit set at 250.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query find:^(ResponseType type, Entry *entry, NSError *error){

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.find({(responseType, entry!, error!) ->  in

})
```

Block to be called once operation is done.

## findOne:

This method provides the first entry from a specified ContentType.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];
Query * query = [contentType query];
[query findOne:^(ResponseType type, Entry *entry, NSError *error){

}];Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let query = stack.contentTypeWithName("CONTENT_TYPE_UID").query()
query.findOne({(responseType, entry!, error!) ->  in

})
```

Block to be called once operation is done.

The property to assign cache policy like CACHE\_THEN\_NETWORK, NETWORK\_ELSE\_CACHE, NETWORK\_ONLY, etc.

## Query | iOS Delivery SDK | Contentstack

Query lets you build and run content queries to filter and retrieve entries in the Contentstack iOS Delivery SDK.

## Taxonomy

[Taxonomy](/docs/headless-cms/about-taxonomy) helps you categorize pieces of content within your stack to facilitate easy navigation and retrieval of information.

## initWithStack

The initWithStack method initializes a new instance of the Taxonomy class using the specified Stack.

```
Objective C:
Stack *stack = [Contentstack stackWithAPIKey:@"api_key" 
                             deliveryToken:@"delivery_token" 
                              environment:@"environment"];
Taxonomy *taxonomy = [[Taxonomy alloc] initWithStack:stack];Swift:
let stack = Contentstack.stack(apiKey: "api_key",
                             deliveryToken: "delivery_token",
                             environment: "environment")
let taxonomy = Taxonomy(stack: stack)
```

The stack instance for making API requests

## query

The querymethod generates a new Query instance for the taxonomy.

```
Objective C:
Taxonomy *taxonomy = [[Taxonomy alloc] initWithStack:stack]; 
Query *query = [taxonomy query]; Swift:
let taxonomy = Taxonomy(stack: stack) 
let query = taxonomy.query()
```

## whereKey:equalTo:

The whereKey:equalTo: method adds a condition to filter entries where the specified key matches the provided value.

```
Objective C:
Taxonomy *taxonomy = [[Taxonomy alloc] initWithStack:stack]; 
Query *query = [taxonomy query]; 
[query whereKey:@"title" equalTo:@"Sample Taxonomy"];Swift:
let taxonomy = Taxonomy(stack: stack) 
let query = taxonomy.query() 
query.whereKey("title", equalTo: "Sample Taxonomy")
```

The key of the field to query for the desired data.

The value to match

## fetch:completion:

The whereKey:equalTo: method adds a condition to filter entries where the specified key matches the provided value.

```
Objective C:
NSDictionary *params = @{ @"include_count":@(true), @"include_global_field_schema": @(true) }; 
[taxonomy fetch:params completion:^(NSDictionary *entries, NSError *error) { 
if (error) 
     { NSLog(@"Error: %@", error.localizedDescription); 
 return; 
     }
 NSLog(@"Fetched entries: %@", entries); 
     }];Swift:
let params = [ "include_count": true, "include_global_field_schema": true ] as [String : Any] 
taxonomy.fetch(params) { (entries, error) in 
if let error = error { 
print("Error: \(error.localizedDescription)") 
return } 
if let entries = entries {
print("Fetched entries: \(entries)") 
  } 
}
```

Optional parameters for the request

Completion handler with result or error

## findTaxonomy:

The findTaxonomy: method executes a query to fetch taxonomy entries that match specified query conditions.

```
Objective C:
Query *query = [taxonomy query];
[query whereKey:@"taxonomies.one" equalTo:@"term_one"];
[query findTaxonomy:^(ResponseType type, QueryResult *result, NSError *error) {
if (error) {
   NSLog(@"Error: %@", error.localizedDescription); 
   return; 
 } 
 NSArray *entries = [result getResult];
 NSLog(@"Fetched entries: %@", entries);
}];
Swift:
let query = taxonomy.query()
query.whereKey("taxonomies.one", equalTo: "term_one")
query.findTaxonomy { (type, result, error) in
    if let error = error {
        print("Error: \(error.localizedDescription)")
        return
    }
    if let entries = result?.getResult() {
        print("Fetched entries: \(entries)")
    }
}
```

Returns (ResponseType, QueryResult\*, NSError\*)

## orWithSubqueries:

The orWithSubqueries method combines multiple queries using AND condition.

```
Objective C:
Query *query1 = [taxonomy query]; 
[query1 whereKey:@"taxonomies.one" equalTo:@"term_one"]; 
Query *query2 =[taxonomy query]; 
[query2 whereKey:@"taxonomies.two" equalTo:@"term_two"]; 
Query *mainQuery = [taxonomy query]; 
[mainQuery orWithSubqueries:@[query1, query2]];Swift:
let query1 = taxonomy.query() 
query1.whereKey("taxonomies.one", equalTo: "term_one") 
let query2 = taxonomy.query()
query2.whereKey("taxonomies.two", equalTo: "term_two")
let mainQuery = taxonomy.query()
mainQuery.orWithSubqueries([query1, query2])
```

Array of Query objects to combine with OR

## andWithSubqueries:

The andWithSubqueries: method combines multiple queries using AND condition.

```
Objective C:
Query *query1 = [taxonomy query]; 
[query1 whereKey:@"taxonomies.one" equalTo:@"term_one"]; 
Query *query2 =[taxonomy query]; 
[query2 whereKey:@"taxonomies.two" equalTo:@"term_two"]; 
Query *mainQuery = [taxonomy query]; 
[mainQuery andWithSubqueries:@[query1, query2]];
Swift:
let query1 = taxonomy.query() 
query1.whereKey("taxonomies.one", equalTo: "term_one") 
let query2 = taxonomy.query()
query2.whereKey("taxonomies.two", equalTo: "term_two")
let mainQuery = taxonomy.query()
mainQuery.andWithSubqueries([query1, query2])
```

Array of Query objects to combine with AND

## Taxonomy | iOS Delivery SDK | Contentstack

Taxonomy lets you categorize stack content for easy navigation and retrieval using the Contentstack iOS Delivery SDK.

## Global Fields

A Global field is a reusable field (or group of fields) that you can define once and reuse in any content type within your stack. This eliminates the need (and thereby time and efforts) to create the same set of fields repeatedly in multiple content types.

**Example:**

```
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalfield = [stack globalFieldWithName
:@"Global_field_uid"];
[globalfield fetch:^(ResponseType type, NSError * _Nullable error) {
}];
```

## fetch

The fetch method retrieves the details of the specified global field.

```
Example:

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalfield = [stack globalFieldWithName
:@"Global_field_uid"];
[globalfield fetch:^(ResponseType type, NSError * _Nullable error) {
}];
```

UID of the Global field

## find

The find method retrieves the details of all the global fields in the stack.

```
Example:

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalfield = [stack globalField];
[globalfield fetchAll:^(ResponseType type, NSArray<GlobalField *> * _Nullable result, NSError * _Nullable error){
}];
```

## includeBranch

The includeBranch method includes the branch details for single or multiple global fields.

```
Example:
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
GlobalField *globalfield = [stack globalField];
[globalfield includeBranch];
[globalfield fetchAll:^(ResponseType type, NSArray<GlobalField *> * _Nullable result, NSError * _Nullable error){
}];
Note:Information about Global fields can be retrieved by all users, regardless of their role or access level.
If your Global field contains nested Global fields, they will appear as part of the schema in the API response.
```

## Global Fields | iOS Delivery SDK | Contentstack

Global Fields are reusable fields you define once and reuse across content types in the Contentstack iOS Delivery SDK.