# CocoaPods के साथ InboxKit सेटअप करें

*iOS SDK [7.0.40](https://github.com/Pushwoosh/pushwoosh-ios-sdk/releases/tag/7.0.40) से उपलब्ध।*

InboxKit, `PushwooshXCFramework` पॉड के एक वैकल्पिक सबस्पेक के रूप में आता है। आपको मुख्य SDK को पहले से इंटीग्रेट करना होगा; यदि आप शुरुआत से शुरू कर रहे हैं, तो पहले [बेसिक इंटीग्रेशन गाइड](/hi/developer/pushwoosh-sdk/ios-sdk/setting-up-pushwoosh-ios-sdk-7-0/basic-integration-guide/) का पालन करें।

## InboxKit पॉड जोड़ें

1. अपनी `Podfile` खोलें और अपने ऐप टारगेट में InboxKit सबस्पेक जोड़ें:

```ruby
target 'MyApp' do
  use_frameworks!

  pod 'PushwooshXCFramework'
  pod 'PushwooshXCFramework/PushwooshInboxKit'
end
```

2. अपनी प्रोजेक्ट डायरेक्टरी से `pod install` चलाएँ:

```bash
pod install
```

3. जेनरेट की गई `.xcworkspace` फ़ाइल खोलें। InboxKit अब मुख्य SDK के साथ लिंक हो गया है।

## इनबॉक्स दिखाएँ

इनबॉक्स कंट्रोलर को किसी भी नेविगेशन फ्लो में जोड़ें। डिफ़ॉल्ट कॉन्फ़िगरेशन तीन मानक सेल प्रकारों के साथ एक काम करने वाला इनबॉक्स प्राप्त करने के लिए पर्याप्त है:

<Tabs syncKey="code-example">
<TabItem label="Swift">
```swift
import PushwooshInboxKit

let inboxVC = PushwooshInboxKitViewController()
navigationController?.pushViewController(inboxVC, animated: true)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
@import PushwooshInboxKit;

PushwooshInboxKitViewController *inboxVC = [PushwooshInboxKitViewController new];
[self.navigationController pushViewController:inboxVC animated:YES];
```
</TabItem>
</Tabs>

## इनबॉक्स को कस्टमाइज़ करें

Swift में, कंट्रोलर को `PushwooshInboxKitAttributes` वैल्यू टाइप के माध्यम से कॉन्फ़िगर करें। Objective-C में, कंट्रोलर पर `@objc`-फ्रेंडली सेटर्स का उपयोग करें — `PushwooshInboxKitAttributes` एक Swift स्ट्रक्ट है और इसे ब्रिज नहीं किया गया है।

<Tabs syncKey="code-example">
<TabItem label="Swift">
```swift
var attributes = PushwooshInboxKitAttributes()
attributes.pullToRefreshEnabled = true
attributes.swipeToDeleteEnabled = true
attributes.pinningEnabled = true
attributes.style.unreadBadgeColor = .systemBlue
attributes.style.titleFont = .systemFont(ofSize: 17, weight: .semibold)

let inboxVC = PushwooshInboxKitViewController(attributes: attributes)
```
</TabItem>

<TabItem label="Objective-C">
```objective-c
PushwooshInboxKitViewController *inboxVC = [PushwooshInboxKitViewController new];
[inboxVC setBackgroundColor:[UIColor systemBackgroundColor]];
[inboxVC setEmptyMessage:@"You have no messages yet"];
```
</TabItem>
</Tabs>

`Style` स्ट्रक्ट डिफ़ॉल्ट सेल द्वारा उपयोग किए जाने वाले सभी रंगों, फ़ॉन्ट, कॉर्नर रेडिआई और डेट फ़ॉर्मेटर को एक्सपोज़ करता है। प्रत्येक मान डिफ़ॉल्ट रूप से एक Apple सिमेंटिक रंग है, इसलिए इनबॉक्स सिस्टम डार्क मोड पर स्वचालित रूप से प्रतिक्रिया करता है।

<img src="/setting-up-pushwoosh-inboxkit-ios-custom.webp" alt="कस्टम-स्टाइल वाला InboxKit फ़ीड जिसमें शीर्षक और अपठित संकेतक पर ब्रांड रंग लागू किए गए हैं" width="280" style="display: block; margin: 0 auto;"/>

<p style="text-align: center; opacity: 0.7; font-size: 0.875rem; margin-top: 0.5rem;">`PushwooshInboxKitAttributes.Style` के माध्यम से लागू एक कस्टम थीम के साथ कैप्शन वाला सेल।</p>

## टैप और रिफ्रेश को हैंडल करें

उपयोगकर्ता की क्रियाओं और रिफ्रेश इवेंट्स पर प्रतिक्रिया करने के लिए `PushwooshInboxKitDelegate` का पालन करें। प्रत्येक मेथड का एक डिफ़ॉल्ट कार्यान्वयन होता है, इसलिए आप केवल वही ओवरराइड करते हैं जिसकी आपको आवश्यकता है:

<Tabs syncKey="code-example">
<TabItem label="Swift">
```swift
final class InboxCoordinator: NSObject, PushwooshInboxKitDelegate {
    func inboxKit(_ vc: PushwooshInboxKitViewController,
                  didSelect message: PWInboxMessageProtocol) -> Bool {
        // Return true to let the SDK open the message URL or richmedia.
        // Return false if you handled the tap entirely (e.g. routed to a custom screen).
        return true
    }

    func inboxKit(_ vc: PushwooshInboxKitViewController,
                  didRefreshWith messages: [PWInboxMessageProtocol],
                  error: Error?) {
        // Show your own empty / error state here if needed.
    }
}

inboxVC.delegate = inboxCoordinator
```
</TabItem>
</Tabs>

SDK कंट्रोलर पर `@objc` मेथड के रूप में बल्क ऑपरेशन भेजता है, ताकि आप उन्हें सीधे `UIBarButtonItem` से जोड़ सकें:

<Tabs syncKey="code-example">
<TabItem label="Swift">
```swift
let markAll = UIBarButtonItem(
    image: UIImage(systemName: "checkmark.circle"),
    style: .plain,
    target: inboxVC,
    action: #selector(PushwooshInboxKitViewController.markAllAsRead)
)
let clearRead = UIBarButtonItem(
    image: UIImage(systemName: "trash"),
    style: .plain,
    target: inboxVC,
    action: #selector(PushwooshInboxKitViewController.clearReadMessages)
)
inboxVC.navigationItem.rightBarButtonItems = [clearRead, markAll]
```
</TabItem>
</Tabs>

<Aside type="note" title="परसिस्टेंस">
मार्क-एज-रीड, मार्क-ऑल-एज-रीड, डिलीट, और क्लियर-रीड सभी नेटवर्क अनुरोध भेजे जाने से पहले स्थानीय Pushwoosh इनबॉक्स स्टोरेज में बने रहते हैं। स्टेट एक प्रोसेस रीस्टार्ट के बाद भी बना रहता है, भले ही बैकएंड ने अभी तक बदलाव को स्वीकार नहीं किया हो।
</Aside>

## अगले कदम

<LinkCard
  title="PushwooshInboxKit API संदर्भ"
  description="प्रत्येक पब्लिक टाइप के लिए जेनरेट किया गया DocC डॉक्यूमेंटेशन।"
  href="https://pushwoosh.github.io/pushwoosh-ios-sdk/PushwooshInboxKit/documentation/pushwooshinboxkit/"
/>