social.plus SDK provides powerful story target retrieval capabilities that enable real-time observation of story targets, perfect for implementing unseen story indicators, story rings, and targeted content management features in your application.

Single Target Observation

Monitor individual story targets with real-time unseen status updates

Multi-Target Queries

Observe multiple story targets simultaneously for efficient feed management

Unseen Story Detection

Implement story rings and indicators for unviewed content

Live Object Updates

Real-time synchronization of target states and story availability
Story Targets provide metadata about story availability and viewing states for specific targets, enabling you to build engaging story feed interfaces with proper unseen indicators.

Get Single Story Target

The getStoryTarget() function enables real-time observation of a specific story target, returning a Live Object that provides updates about story availability and unseen status.

Parameters

ParameterTypeRequiredDescription
targetTypeEnumYesType of target (currently supports .community)
targetIdStringYesID of the target community

Use Cases

  • Story Ring Indicators: Show visual indicators for targets with unseen stories
  • Feed Organization: Prioritize targets with new content
  • User Experience: Guide users to fresh, unviewed content
  • Analytics: Track story consumption patterns across targets
let token = storyRepository.getStoryTarget(targetType: .community, targetId: "targetId").observe { object, error in
    if let error {
        print(error)
        return
    }
    
    guard let storyTarget = object.snapshot else { return}
    print(storyTarget)
    // Use storyTarget
}

Get Multiple Story Targets

The getStoryTargets() function enables retrieval of multiple story targets simultaneously, returning a Live Collection that observes updates across all specified targets.

Parameters

ParameterTypeRequiredDescription
targetsArrayYesArray of target pairs (max 10 targets)

Implementation Patterns

  • Story Feed Management: Monitor multiple communities for story availability
  • Batch Updates: Efficient UI updates for multiple story indicators
  • Feed Prioritization: Sort targets based on unseen story status
  • Performance Optimization: Reduce network requests with batch queries
// Example of creating StoryTargetSeachInfo from any target id and target type.
let firstTarget = StoryTargetSearchInfo(targetType: .community, targetId: "targetId-1")
let secondTarget = StoryTargetSearchInfo(targetType: .community, targetId: "targetId-2")

token = storyRepository.getStoryTargets(targets: [firstTarget, secondTarget]).observe({ collection, change, error in
    // Handle list of story targets here.
})