Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #141 from Esri/Swift_update
Browse files Browse the repository at this point in the history
updated swift samples
  • Loading branch information
dg0yal committed Feb 12, 2016
2 parents ef05775 + 0df0f43 commit bd03c98
Show file tree
Hide file tree
Showing 148 changed files with 1,487 additions and 1,253 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ DerivedData

*.xccheckout
*.xcworkspacedata
All Samples.xcworkspace/xcshareddata/All Samples.xcscmblueprint
arcgis-ios-sdk-samples.xcodeproj/project.xcworkspace/xcshareddata/arcgis-ios-sdk-samples.xcscmblueprint
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
C57F6DFE13F5A74000DAE553 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
LastUpgradeCheck = 0720;
};
buildConfigurationList = C57F6E0113F5A74000DAE553 /* Build configuration list for PBXProject "AsynchronousGPSample" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -224,9 +224,9 @@
C57F6E3213F5A74000DAE553 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/SDKs/ArcGIS/iOS/**";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -238,6 +238,7 @@
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = "";
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-ObjC",
"-framework",
Expand All @@ -255,7 +256,6 @@
C57F6E3313F5A74000DAE553 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Sreejith Parthasarathy (N3WX842HCK)";
FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/SDKs/ArcGIS/iOS/**";
Expand Down Expand Up @@ -285,7 +285,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
Expand All @@ -307,6 +306,7 @@
"-l",
"c++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -318,7 +318,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
Expand All @@ -340,6 +339,7 @@
"-l",
"c++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.esri.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -24,6 +24,30 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>arcgis.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>arcgisonline.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>UIMainStoryboardFile</key>
<string>Main_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
Expand All @@ -34,29 +58,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>arcgisonline.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>arcgis.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
97F6691A19E344E7001D1724 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = Esri;
TargetAttributes = {
97F6692119E344E7001D1724 = {
Expand Down Expand Up @@ -223,6 +224,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -296,6 +298,7 @@
"-l",
"c++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "AsynchronousGP/SVProgressHUD/SVProgressHUD-bridging-header.h";
};
Expand All @@ -315,6 +318,7 @@
"-l",
"c++",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.esri.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "AsynchronousGP/SVProgressHUD/SVProgressHUD-bridging-header.h";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class AsyncGPParameters {

func parametersArray() -> [AGSGPParameterValue] {
//create parameters
var paramLoc = AGSGPParameterValue(name: "Incident_Point", type: .FeatureRecordSetLayer, value: self.featureSet!)
var paramDegree = AGSGPParameterValue(name: "Wind_Bearing__direction_blowing_to__0_-_360_", type: .Double, value: self.windDirection.doubleValue)
var paramMaterial = AGSGPParameterValue(name: "Material_Type", type: .String, value: self.materialType)
var paramTime = AGSGPParameterValue(name: "Day_or_Night_incident", type: .String, value: self.dayOrNightIncident)
var paramType = AGSGPParameterValue(name: "Large_or_Small_spill", type: .String, value: self.largeOrSmallSpill)
let paramLoc = AGSGPParameterValue(name: "Incident_Point", type: .FeatureRecordSetLayer, value: self.featureSet!)
let paramDegree = AGSGPParameterValue(name: "Wind_Bearing__direction_blowing_to__0_-_360_", type: .Double, value: self.windDirection.doubleValue)
let paramMaterial = AGSGPParameterValue(name: "Material_Type", type: .String, value: self.materialType)
let paramTime = AGSGPParameterValue(name: "Day_or_Night_incident", type: .String, value: self.dayOrNightIncident)
let paramType = AGSGPParameterValue(name: "Large_or_Small_spill", type: .String, value: self.largeOrSmallSpill)

var params:[AGSGPParameterValue] = [paramLoc, paramDegree, paramTime, paramType, paramMaterial]
let params:[AGSGPParameterValue] = [paramLoc, paramDegree, paramTime, paramType, paramMaterial]

return params
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class AsyncGPSettingsViewController:UIViewController, UIPickerViewDelegate, UIPi

override func viewDidLoad() {
//update view to show selected material
if let index = find(self.materialsArray, self.parameters.materialType) {

if let index = self.materialsArray.indexOf(self.parameters.materialType) {
self.materialPicker.selectRow(index, inComponent: 0, animated: true)
self.materialLabel.text = self.parameters.materialType
}
Expand All @@ -44,7 +45,7 @@ class AsyncGPSettingsViewController:UIViewController, UIPickerViewDelegate, UIPi
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return self.materialsArray.count
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return self.materialsArray[row]
}

Expand Down
50 changes: 25 additions & 25 deletions AsynchronousGPSample/swift/AsynchronousGP/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.esri.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -22,6 +22,30 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>arcgis.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>arcgisonline.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -43,29 +67,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>arcgisonline.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>arcgis.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
24 changes: 12 additions & 12 deletions AsynchronousGPSample/swift/AsynchronousGP/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class ViewController:UIViewController, AGSMapViewTouchDelegate, AGSGeoprocessorD

override func viewDidLoad() {
//Add teh basemap
var mapUrl = NSURL(string: kDefaultMap)
var tiledLayer = AGSTiledMapServiceLayer(URL: mapUrl)
let mapUrl = NSURL(string: kDefaultMap)
let tiledLayer = AGSTiledMapServiceLayer(URL: mapUrl)
self.mapView.addMapLayer(tiledLayer)

//Zooming to an intial envelope with the specified spatial reference of the map
var spatialReference = AGSSpatialReference(WKID: 102100)
var envelope = AGSEnvelope(xmin: -13639984, ymin: 4537387, xmax: -13606734, ymax: 4558866, spatialReference: spatialReference)
let spatialReference = AGSSpatialReference(WKID: 102100)
let envelope = AGSEnvelope(xmin: -13639984, ymin: 4537387, xmax: -13606734, ymax: 4558866, spatialReference: spatialReference)
self.mapView.zoomToEnvelope(envelope, animated: true)

//important step in detecting the touch events on the map
Expand Down Expand Up @@ -71,26 +71,26 @@ class ViewController:UIViewController, AGSMapViewTouchDelegate, AGSGeoprocessorD
self.graphicsLayer?.removeAllGraphics()

//create a symbol to show user tap location on map
var myMarkerSymbol = AGSSimpleMarkerSymbol.simpleMarkerSymbolWithColor(UIColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 0.25)) as! AGSSimpleMarkerSymbol
let myMarkerSymbol = AGSSimpleMarkerSymbol.simpleMarkerSymbolWithColor(UIColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 0.25)) as! AGSSimpleMarkerSymbol
myMarkerSymbol.size = CGSizeMake(10, 10)
myMarkerSymbol.outline = AGSSimpleLineSymbol(color: UIColor.redColor(), width: 1)

//create a graphic
var graphic = AGSGraphic(geometry: mappoint, symbol: myMarkerSymbol, attributes: nil)
let graphic = AGSGraphic(geometry: mappoint, symbol: myMarkerSymbol, attributes: nil)

//add graphic to graphics layer
self.graphicsLayer.addGraphic(graphic)

//create a feature set for the input parameter
var featureSet = AGSFeatureSet()
let featureSet = AGSFeatureSet()
featureSet.features = [graphic]

//assign the new feature set and wind direction values to the parameter object
self.parameters.featureSet = featureSet
self.parameters.windDirection = NSDecimalNumber(float: self.wdDegreeSlider.value)

//get the parameters array from the parameters object
var parametersArray = self.parameters.parametersArray()
let parametersArray = self.parameters.parametersArray()

//submit the gp job
//the interval property of the gptask is not set to a value explicitly, default is 5 sec
Expand All @@ -116,11 +116,11 @@ class ViewController:UIViewController, AGSMapViewTouchDelegate, AGSGeoprocessorD

func geoprocessor(geoprocessor: AGSGeoprocessor!, operation op: NSOperation!, didQueryWithResult result: AGSGPParameterValue!, forJob jobId: String!) {
//get the result
var featureSet = result.value as! AGSFeatureSet
let featureSet = result.value as! AGSFeatureSet
//loop through all the graphics in feature set and add them to the map
for graphic in featureSet.features {
//create and set a symbol to graphic
var fillSymbol = AGSSimpleFillSymbol.simpleFillSymbol() as! AGSSimpleFillSymbol
let fillSymbol = AGSSimpleFillSymbol.simpleFillSymbol() as! AGSSimpleFillSymbol
fillSymbol.color = UIColor.purpleColor().colorWithAlphaComponent(0.25)
(graphic as! AGSGraphic).symbol = fillSymbol

Expand All @@ -129,7 +129,7 @@ class ViewController:UIViewController, AGSMapViewTouchDelegate, AGSGeoprocessorD
}

//zoom to the graphic layer extent
var envelope = self.graphicsLayer.fullEnvelope.mutableCopy() as! AGSMutableEnvelope
let envelope = self.graphicsLayer.fullEnvelope.mutableCopy() as! AGSMutableEnvelope
envelope.expandByFactor(1.2)
self.mapView.zoomToEnvelope(envelope, animated: true)

Expand All @@ -155,7 +155,7 @@ class ViewController:UIViewController, AGSMapViewTouchDelegate, AGSGeoprocessorD
func geoprocessor(geoprocessor: AGSGeoprocessor!, operation op: NSOperation!, jobDidFail jobInfo: AGSGPJobInfo!) {
self.dismissHUD()
for message in jobInfo.messages {
println("\((message as! AGSGPMessage).description)")
print("\((message as! AGSGPMessage).description)")
}

//Update status
Expand Down
Loading

0 comments on commit bd03c98

Please sign in to comment.