Portal

Download Sample Application

This sample shows how to connect to and access featured content from portals such as ArcGIS Online. You can modify the sample to connect to on-premises portals or specific organization subscriptions on ArcGIS Online. You can either log into the portal as a registered user or access the portal anonymously as a guest user (if the portal permits)

//header file
@interface PortalSample : NSViewController <AGSPortalDelegate,AGSPortalItemDelegate,AGSWebMapDelegate>
...
@property (strong) AGSPortal *portal;
@property (strong) NSMutableArray *portalItems;
@end

//implementation file

//init portal and set the delegate
self.portal = [[AGSPortal alloc] initWithURL:[NSURL URLWithString:@"http://arcgis.com"] credential:nil];
self.portal.delegate = self;

//when the portal has loaded find the featured content groups
- (void)portalDidLoad:(AGSPortal *)portal {
    AGSPortalQueryParams *queryPamrams = [AGSPortalQueryParams queryParamsWithQuery:self.portal.portalInfo.featuredItemsGroupQuery];
    [self.portal findGroupsWithQueryParams:queryPamrams];
}

//when the featured content groups are found find the webmaps within the group
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFindGroups:(AGSPortalQueryResultSet *)groupResults {
    //loop through all groups and send a query to find their items (webmaps)
    for (AGSPortalGroup *portalGroup in groupResults.results) {
        //query params
        AGSPortalQueryParams *queryParams = [AGSPortalQueryParams queryParamsForItemsOfType:AGSPortalItemTypeWebMap inGroup:portalGroup.groupId];
        queryParams.sortField = @"title";
        queryParams.sortOrder = AGSPortalQuerySortOrderAscending;
        queryParams.limit = 20;
        //find webmaps in group
        [self.portal findItemsWithQueryParams:queryParams];
    }
}

//when the webmaps have been found then loop through them
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFindItems:(AGSPortalQueryResultSet *)itemResults {
    //loop through the webmaps
    ...
}

Sample Code

//SWIFT SAMPLE CODE
/*
Copyright 2014 Esri

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import Cocoa
import ArcGIS

//portal url
let kPortalURL = "http://arcgis.com"

//default webmap
let kDefaultWebMapItemId = "dc56ef89a9ff44268fb3366184189e15"

class PortalSwiftSample: NSViewController, AGSWebMapDelegate, AGSPortalDelegate, NSTableViewDataSource, NSTableViewDelegate, AGSPortalItemDelegate, NSSplitViewDelegate {
    
    @IBOutlet weak var mapView:AGSMapView!
    @IBOutlet weak var tableView:NSTableView!
    var portal:AGSPortal!
    var webMap:AGSWebMap!
    var portalItems = Array<AGSPortalItem>()
    var awaken = false
    
    //MARK: - awakeFromNib
    
    // -------------------------------------------------------------------------------
    //  awakeFromNib
    // -------------------------------------------------------------------------------
    override func awakeFromNib() {

        if !self.awaken {
        
            //set headercellview
            let tableHeaderView = NSTableHeaderView(frame: NSMakeRect(0,0,self.tableView.frame.size.width,26))
            tableHeaderView.autoresizingMask = .ViewWidthSizable | .ViewHeightSizable
            let titleLabel = NSTextField(frame: NSMakeRect(0,0,tableHeaderView.frame.size.width,26))
            titleLabel.autoresizingMask = .ViewWidthSizable | .ViewHeightSizable
            titleLabel.selectable = false
            titleLabel.font = NSFont.boldSystemFontOfSize(13)
            titleLabel.alignment = NSTextAlignment.CenterTextAlignment
            titleLabel.bordered = true
            titleLabel.bezeled = true
            titleLabel.backgroundColor = NSColor.controlHighlightColor()
            titleLabel.stringValue = "Featured Content"
            tableHeaderView.addSubview(titleLabel)
            self.tableView.headerView = tableHeaderView
            
            //load default webMap
            self.webMap = AGSWebMap(itemId:kDefaultWebMapItemId, credential:nil)
            self.webMap.delegate = self
            self.webMap.zoomToDefaultExtentOnOpen = true
            
            //init portal and set delegate
            self.portal = AGSPortal(URL: NSURL(string: kPortalURL), credential: nil)
            self.portal.delegate = self
            
            self.awaken = true
        }
    }
    
    //MARK: - NSTableView Delegate/Datasource Methods
    
    // -------------------------------------------------------------------------------
    //  numberOfRowsInTableView:tableView
    // -------------------------------------------------------------------------------
    func numberOfRowsInTableView(tableView: NSTableView) -> Int {
        return self.portalItems.count
    }
    
    // -------------------------------------------------------------------------------
    //  tableView:viewForTableColumn:row
    // -------------------------------------------------------------------------------
    func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
    
        if let tblColumn = tableColumn {
            let result = tableView.makeViewWithIdentifier(tblColumn.identifier, owner:self) as NSTableCellView
            
            if self.portalItems.count > 0 {
                let portalItem = self.portalItems[row]
                result.imageView?.image = portalItem.thumbnail
                result.textField?.stringValue = portalItem.title
            }
            return result
        }
        return nil
    }
    
    // -------------------------------------------------------------------------------
    //  tableViewSelectionDidChange:aNotification
    // -------------------------------------------------------------------------------
    func tableViewSelectionDidChange(notification: NSNotification) {
        
        if self.portalItems.count > 0 && self.tableView.selectedRow >= 0 {
            let portalItem = self.portalItems[self.tableView.selectedRow]
            self.webMap = AGSWebMap(portalItem: portalItem)
            self.webMap.delegate = self
            self.webMap.zoomToDefaultExtentOnOpen = true
        }
    }
    
    //MARK: - WebMap Delegate
    
    // -------------------------------------------------------------------------------
    //  webMapDidLoad
    // -------------------------------------------------------------------------------
    func webMapDidLoad(webMap: AGSWebMap!) {
        //open webmap in mapview
        self.webMap.openIntoMapView(self.mapView)
    }
    
    // -------------------------------------------------------------------------------
    //  webMap:didFailToLoadWithError
    // -------------------------------------------------------------------------------
    func webMap(webMap: AGSWebMap!, didFailToLoadWithError error: NSError!) {
        self.showError(error, withMessageText:"Failed to load webmap")
    }
    
    // -------------------------------------------------------------------------------
    //  didOpenWebMap:intoMapView
    // -------------------------------------------------------------------------------
    func didOpenWebMap(webMap: AGSWebMap!, intoMapView mapView: AGSMapView!) {
        println("Webmap opened")
    }
    
    // -------------------------------------------------------------------------------
    //  webMap:didLoadLayer
    // -------------------------------------------------------------------------------
    func webMap(webMap: AGSWebMap!, didLoadLayer layer: AGSLayer!) {
        println("Layer \(layer.name) loaded..")
    }
    
    
    // -------------------------------------------------------------------------------
    //  webMap:didFailToLoadLayer
    // -------------------------------------------------------------------------------
    func webMap(webMap: AGSWebMap!, didFailToLoadLayer layerInfo: AGSWebMapLayerInfo!, baseLayer: Bool, federated: Bool, withError error: NSError!) {
        println("Layer failed to load: \(layerInfo.title), \(layerInfo.URL), \(error)")
        self.webMap.continueOpenAndSkipCurrentLayer()
    }
    
    // -------------------------------------------------------------------------------
    //  bingAppId
    // -------------------------------------------------------------------------------
    func bingAppId() -> String {
        //Return Valid Bing Map Key Here
        return "Valid Bing Map's key"
    }
    
    //MARK: - Portal Delegate
    
    // -------------------------------------------------------------------------------
    //  portalDidLoad:portal
    // -------------------------------------------------------------------------------
    func portalDidLoad(portal: AGSPortal!) {
        
        //we want to load all items of featured content
        //create query params with featuredItemsGroupQuery of portalInfo
        //so we can find group and then query further to find items of that group
        let queryPamrams = AGSPortalQueryParams(query: self.portal.portalInfo.featuredItemsGroupQuery)
        self.portal.findGroupsWithQueryParams(queryPamrams)
    }
    
    // -------------------------------------------------------------------------------
    //  portal:didFailToLoadWithError
    // -------------------------------------------------------------------------------
    func portal(portal: AGSPortal!, didFailToLoadWithError error: NSError!) {
        //show error
        self.showError(error, withMessageText:"Failed to load portal")
    }
    
    // -------------------------------------------------------------------------------
    //  portal:didFindGroups
    // -------------------------------------------------------------------------------
    func portal(portal: AGSPortal!, operation: NSOperation!, didFindGroups resultSet: AGSPortalQueryResultSet!) {
    
        //loop through all groups and send query to find their items
        for portalGroup in resultSet.results as [AGSPortalGroup] {
        
            //query params
            let queryParams = AGSPortalQueryParams(forItemsOfType:.WebMap, inGroup:portalGroup.groupId)
            queryParams.sortField = "title"
            queryParams.sortOrder = .Ascending
            queryParams.limit = 20
            
            //find webmaps in group
            self.portal.findItemsWithQueryParams(queryParams)
        }
    }
    
    // -------------------------------------------------------------------------------
    //  portal:didFailToFindGroupsForQueryParams
    // -------------------------------------------------------------------------------
    func portal(portal: AGSPortal!, operation: NSOperation!, didFailToFindGroupsForQueryParams queryParams: AGSPortalQueryParams!, withError error: NSError!) {
        //show error
        self.showError(error, withMessageText:"Failed to find portal groups")
    }
    
    // -------------------------------------------------------------------------------
    //  portal:didFindItems
    // -------------------------------------------------------------------------------
    func portal(portal: AGSPortal!, operation: NSOperation!, didFindItems resultSet: AGSPortalQueryResultSet!) {
        
        //loop through all items and fetch thumbnail for each item
        //add item to portalItems array
        for portalItem in resultSet.results as [AGSPortalItem] {
        
            //set portal item delegate
            portalItem.delegate = self
            
            //fetch thumbnail
            if portalItem.thumbnailFileName != nil && portalItem.thumbnail == nil {
                portalItem.fetchThumbnail()
            }
            
            //add to portal items array
            self.portalItems.append(portalItem)
        }
        
        //reload tableview
        self.tableView.reloadData()
    }
    
    // -------------------------------------------------------------------------------
    //  portal:didFailToFindItemsForQueryParams
    // -------------------------------------------------------------------------------
    func portal(portal: AGSPortal!, operation: NSOperation!, didFailToFindItemsForQueryParams queryParams: AGSPortalQueryParams!, withError error: NSError!) {
        //show error
        self.showError(error, withMessageText:"Failed to find portal items")
    }
    
    //MARK: - Portal Item Delegate
    
    // -------------------------------------------------------------------------------
    //  portalItem:didFetchThumbnail
    // -------------------------------------------------------------------------------
    func portalItem(portalItem: AGSPortalItem!, operation op: NSOperation!, didFetchThumbnail thumbnail: NSImage!) {
        //refresh row
        if let indx = find(self.portalItems, portalItem) {
            NSIndexSet(
            self.tableView.reloadDataForRowIndexes(NSIndexSet(index: indx), columnIndexes:NSIndexSet(index: 0)))
        }
    }
    
    // -------------------------------------------------------------------------------
    //  portalItem:didFailToFetchThumbnailWithError
    // -------------------------------------------------------------------------------
    func portalItem(portalItem: AGSPortalItem!, operation op: NSOperation!, didFailToFetchThumbnailWithError error: NSError!) {
        //show error
        self.showError(error, withMessageText:"Failed to fetch thumbnail")
    }
    
    //MARK: - Show Error
    
    // -------------------------------------------------------------------------------
    //  showError:withMessageText
    // -------------------------------------------------------------------------------
    func showError(error:NSError, withMessageText messageText:String) {
        if let viewWindow = self.view.window {
            let alert = NSAlert()
            alert.messageText = messageText
            alert.informativeText = error.localizedDescription
            alert.beginSheetModalForWindow(viewWindow, modalDelegate:self, didEndSelector:nil, contextInfo:nil)
        }
    }
    
    //MARK: - NSSplitView delegate
    
    // -------------------------------------------------------------------------------
    //  splitView:constrainMaxCoordinate
    //
    //  this will restrict resize of splitView at specified max value
    // -------------------------------------------------------------------------------
    func splitView(splitView: NSSplitView, constrainMaxCoordinate proposedMaximumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
        return 260
    }
    
    // -------------------------------------------------------------------------------
    //  splitView:constrainMinCoordinate
    //
    //  this will restrict resize of splitView at specified min value
    // -------------------------------------------------------------------------------
    func splitView(splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat {
        return 200
    }
}
//OBJECTIVE C SAMPLE CODE
/*
 Copyright 2013 Esri
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#import "PortalSample.h"

//portal url
#define kPortalURL @"http://arcgis.com"

//default webmap
#define kDefaultWebMapItemId @"dc56ef89a9ff44268fb3366184189e15"

@interface PortalSample () {
    BOOL _awaken;
}

@end

@implementation PortalSample

#pragma mark - awakeFromNib

// -------------------------------------------------------------------------------
//  awakeFromNib
// -------------------------------------------------------------------------------
- (void)awakeFromNib {
    
    if (!_awaken) {
        
        //set headercellview
        NSTableHeaderView *tableHeaderView = [[NSTableHeaderView alloc] initWithFrame:NSMakeRect(0,0,self.tableView.frame.size.width,26)];
        [tableHeaderView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
        NSTextField *titleLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(0,0,tableHeaderView.frame.size.width,26)];
        [titleLabel setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
        titleLabel.selectable = NO;
        titleLabel.font = [NSFont boldSystemFontOfSize:13];
        titleLabel.alignment = NSCenterTextAlignment;
        titleLabel.bordered = YES;
        [titleLabel setBezeled:YES];
        titleLabel.backgroundColor = [NSColor controlHighlightColor];
        titleLabel.stringValue = @"Featured Content";
        [tableHeaderView addSubview:titleLabel];
        [self.tableView setHeaderView:tableHeaderView];
        
        //load default webMap
        self.webMap = [AGSWebMap webMapWithItemId:kDefaultWebMapItemId credential:nil];
        self.webMap.delegate = self;
        self.webMap.zoomToDefaultExtentOnOpen = YES;
        
        //init portal and set delegate
        self.portal = [[AGSPortal alloc] initWithURL:[NSURL URLWithString:kPortalURL] credential:nil];
        self.portal.delegate = self;
        
        //init portal items array
        self.portalItems = [NSMutableArray array];
        
        _awaken = YES;
    }
}

#pragma mark - NSTableView Delegate/Datasource Methods

// -------------------------------------------------------------------------------
//  numberOfRowsInTableView:tableView
// -------------------------------------------------------------------------------
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
    return [self.portalItems count];
}

// -------------------------------------------------------------------------------
//  tableView:viewForTableColumn:row
// -------------------------------------------------------------------------------
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {

    NSTableCellView *result = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
    
    if ([self.portalItems count] > 0) {
        AGSPortalItem *portalItem = [self.portalItems objectAtIndex:row];
        result.imageView.image = portalItem.thumbnail;
        result.textField.stringValue = portalItem.title;
    }

    return result;
}

// -------------------------------------------------------------------------------
//  tableViewSelectionDidChange:aNotification
// -------------------------------------------------------------------------------
- (void)tableViewSelectionDidChange: (NSNotification *)aNotification {
       
    if ([self.portalItems count] > 0 && [self.tableView selectedRow] >= 0) {
        AGSPortalItem *portalItem = [self.portalItems objectAtIndex:[self.tableView selectedRow]];
        self.webMap = [AGSWebMap webMapWithPortalItem:portalItem];
        self.webMap.delegate = self;
        self.webMap.zoomToDefaultExtentOnOpen = YES;
    }
}

#pragma mark - WebMap Delegate

// -------------------------------------------------------------------------------
//  webMapDidLoad
// -------------------------------------------------------------------------------
- (void)webMapDidLoad:(AGSWebMap *)webMap {
	//open webmap in mapview
	[self.webMap openIntoMapView:self.mapView];
}

// -------------------------------------------------------------------------------
//  webMap:didFailToLoadWithError
// -------------------------------------------------------------------------------
- (void)webMap:(AGSWebMap *)webMap didFailToLoadWithError:(NSError *)error {	
    [self showError:error withMessageText:@"Failed to load webmap"];
}

// -------------------------------------------------------------------------------
//  didOpenWebMap:intoMapView
// -------------------------------------------------------------------------------
-(void)didOpenWebMap:(AGSWebMap*)webMap intoMapView:(AGSMapView*)mapView {    
    NSLog(@"Webmap opened");
}

// -------------------------------------------------------------------------------
//  didFailToOpenWebMap:intoMapView
// -------------------------------------------------------------------------------
-(void)didFailToOpenWebMap:(AGSWebMap*)webMap intoMapView:(AGSMapView*)mapView {
    [self showError:nil withMessageText:@"Failed to open webmap"];
}

// -------------------------------------------------------------------------------
//  webMap:didLoadLayer
// -------------------------------------------------------------------------------
- (void)webMap:(AGSWebMap *)webMap didLoadLayer:(AGSLayer *)layer {
    NSLog(@"Layer %@ loaded..",layer.name);
}


// -------------------------------------------------------------------------------
//  webMap:didFailToLoadLayer
// -------------------------------------------------------------------------------
-(void)webMap:(AGSWebMap *)webMap didFailToLoadLayer:(AGSWebMapLayerInfo *)layerInfo baseLayer:(BOOL)baseLayer federated:(BOOL)federated withError:(NSError *)error {
    NSLog(@"Layer failed to load: %@, %@, %@",layerInfo.title, layerInfo.URL, error);
    [self.webMap continueOpenAndSkipCurrentLayer];
}

// -------------------------------------------------------------------------------
//  bingAppId
// -------------------------------------------------------------------------------
- (NSString *)bingAppId {
    //Return Valid Bing Map Key Here
    return @"Valid Bing Map's key";
}

#pragma mark - Portal Delegate

// -------------------------------------------------------------------------------
//  portalDidLoad:portal
// -------------------------------------------------------------------------------
- (void)portalDidLoad:(AGSPortal *)portal {
    
    //we want to load all items of featured content
    //create query params with featuredItemsGroupQuery of portalInfo
    //so we can find group and then query further to find items of that group
    AGSPortalQueryParams *queryPamrams = [AGSPortalQueryParams queryParamsWithQuery:self.portal.portalInfo.featuredItemsGroupQuery];
    [self.portal findGroupsWithQueryParams:queryPamrams];
}

// -------------------------------------------------------------------------------
//  portal:didFailToLoadWithError
// -------------------------------------------------------------------------------
- (void)portal:(AGSPortal *)portal didFailToLoadWithError:(NSError *)error {
    //show error
    [self showError:error withMessageText:@"Failed to load portal"];
}

// -------------------------------------------------------------------------------
//  portal:didFindGroups
// -------------------------------------------------------------------------------
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFindGroups:(AGSPortalQueryResultSet *)groupResults {
    
    //loop through all groups and send query to find their items
    for (AGSPortalGroup *portalGroup in groupResults.results) {
        
        //query params
        AGSPortalQueryParams *queryParams = [AGSPortalQueryParams queryParamsForItemsOfType:AGSPortalItemTypeWebMap inGroup:portalGroup.groupId];
        queryParams.sortField = @"title";
        queryParams.sortOrder = AGSPortalQuerySortOrderAscending;
        queryParams.limit = 20;
            
        //find webmaps in group
        [self.portal findItemsWithQueryParams:queryParams];
    }
}

// -------------------------------------------------------------------------------
//  portal:didFailToFindGroupsForQueryParams
// -------------------------------------------------------------------------------
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFailToFindGroupsForQueryParams:(AGSPortalQueryParams *)queryParams withError:(NSError *)error {
    //show error
    [self showError:error withMessageText:@"Failed to find portal groups"];
}

// -------------------------------------------------------------------------------
//  portal:didFindItems
// -------------------------------------------------------------------------------
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFindItems:(AGSPortalQueryResultSet *)itemResults {
    
    //loop through all items and fetch thumbnail for each item
    //add item to portalItems array
    for (AGSPortalItem *portalItem in itemResults.results) {
        
        //set portal item delegate
        portalItem.delegate = self;
        
        //fetch thumbnail
        if (portalItem.thumbnailFileName && !portalItem.thumbnail) {
            [portalItem fetchThumbnail];
        }
        
        //add to portal items array
        [self.portalItems addObject:portalItem];
    }
    
    //reload tableview
    [self.tableView reloadData];
}

// -------------------------------------------------------------------------------
//  portal:didFailToFindItemsForQueryParams
// -------------------------------------------------------------------------------
- (void)portal:(AGSPortal *)portal operation:(NSOperation *)op didFailToFindItemsForQueryParams:(AGSPortalQueryParams *)queryParams withError:(NSError *)error {
    //show error
    [self showError:error withMessageText:@"Failed to find portal items"];
}

#pragma mark - Portal Item Delegate

// -------------------------------------------------------------------------------
//  portalItem:didFetchThumbnail
// -------------------------------------------------------------------------------
- (void)portalItem:(AGSPortalItem *)portalItem operation:(NSOperation *)op didFetchThumbnail:(AGSImage *)thumbnail {
    //refresh row
    [self.tableView reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:[self.portalItems indexOfObject:portalItem]] columnIndexes:[NSIndexSet indexSetWithIndex:0]];
}

// -------------------------------------------------------------------------------
//  portalItem:didFailToFetchThumbnailWithError
// -------------------------------------------------------------------------------
- (void)portalItem:(AGSPortalItem *)portalItem operation:(NSOperation *)op didFailToFetchThumbnailWithError:(NSError *)error {    
    //show error
    [self showError:error withMessageText:@"Failed to fetch thumbnail"];
}

#pragma mark - Show Error

// -------------------------------------------------------------------------------
//  showError:withMessageText
// -------------------------------------------------------------------------------
- (void)showError:(NSError*)error withMessageText:(NSString*)messageText {
    NSAlert *alert = [[NSAlert alloc] init];
    [alert setMessageText:messageText];
    [alert setInformativeText:[NSString stringWithFormat:@"%@",error]];
    [alert beginSheetModalForWindow:self.view.window modalDelegate:self didEndSelector:nil contextInfo:nil];
}

#pragma mark - NSSplitView delegate

// -------------------------------------------------------------------------------
//  splitView:constrainMaxCoordinate
//
//  this will restrict resize of splitView at specified max value
// -------------------------------------------------------------------------------
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex {
    return 260;
}

// -------------------------------------------------------------------------------
//  splitView:constrainMinCoordinate
//
//  this will restrict resize of splitView at specified min value
// -------------------------------------------------------------------------------
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex {
    return 200;
}

@end
//OBJECTIVE C SAMPLE CODE
/*
 Copyright 2013 Esri
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#import <Cocoa/Cocoa.h>

@interface PortalSample : NSViewController <AGSPortalDelegate,AGSPortalItemDelegate,AGSWebMapDelegate>

@property (strong) IBOutlet AGSMapView *mapView;
@property (strong) IBOutlet NSTableView *tableView;
@property (strong) AGSPortal *portal;
@property (strong) AGSWebMap *webMap;
@property (strong) NSMutableArray *portalItems;

@end
Feedback on this topic?