This portal information can be used to provide a customized UI experience for the user. For example, you can show a thumbnail next to their username in the header of an application to indicate that they are currently logged in. Additionally, apps such as Collector and Explorer use this functionality to integrate with Portal.
How to use the sample
When launched, this sample displays a list of users in the Runtime Group portal. Notice that along with displaying each user's name and picture, their description is displayed as well.
How it works
Initialize an AGSPortal object.
Retrieve a group from this portal using findGroups(with:completion:), which returns an array of user names.
Obtain all the users in this group by using fetchUsers(completion:).
Create an AGSPortalUser object for each user name using init(portal:username:).
Relevant API
AGSPortal
AGSPortalGroup
AGSPortalUser
About the data
This sample displays users who are a part of the Runtime Group portal.
Tags
account, cloud and portal, description, profile, user, username
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2016 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 UIKit
import ArcGIS
classGroupUserCell: UITableViewCell{
@IBOutletprivatevar thumbnailImageView: UIImageView!
@IBOutletprivatevar titleLabel: UILabel!
@IBOutletprivatevar descriptionLabel: UILabel!
var portalUser: AGSPortalUser! {
didSet {
self.titleLabel.text = portalUser.fullName
self.descriptionLabel.text = portalUser.userDescription
self.thumbnailImageView.layer.cornerRadius =40self.thumbnailImageView.layer.masksToBounds =trueself.thumbnailImageView.image =UIImage(named: "Placeholder")
iflet thumbnail = portalUser.thumbnail {
if thumbnail.image !=nil {
self.thumbnailImageView.image = thumbnail.image
} else {
thumbnail.load { [weakself] (error: Error?) inif error ==nil {
self?.thumbnailImageView.image = thumbnail.image
}
}
}
}
}
}
}