だから私はこのコード行を使用しました
if let image = test[0]["listing_images"] {
let imagereceiver = image
print(image)
}
CondoIndivi2 から listing_image を取得し、イメージ レシーバーに割り当てます。これで、 imagereceiver は次のようになります 。ご覧のとおり、内部に辞書が含まれています。すべての辞書にある file_name を取得して、それらを var imageArray = [String:AnyObject] に格納できるようにしたいと考えています。これが私のコードです
import UIKit
import Alamofire
import SwiftyJSON
import MapKit
import CoreLocation
class DetailsViewController: UIViewController , MKMapViewDelegate , CLLocationManagerDelegate {
@IBOutlet weak var Price: UILabel!
@IBOutlet weak var Floor: UILabel!
@IBOutlet weak var scrollerpage: UIScrollView!
@IBOutlet weak var mapview: MKMapView!
@IBOutlet weak var bath: UILabel!
@IBOutlet weak var bed_number: UILabel!
@IBOutlet var PhotoDetailsView: UIImageView!
@IBOutlet var label1: UILabel!
@IBOutlet var label2: UILabel!
@IBOutlet var label3: UILabel!
@IBOutlet var label4: UILabel!
@IBOutlet var label5: UILabel!
@IBOutlet var label6: UILabel!
@IBOutlet var label7: UILabel!
@IBOutlet var label8: UILabel!
@IBOutlet var label9: UILabel!
@IBOutlet var label10: UILabel!
@IBOutlet var label11: UILabel!
@IBOutlet var label12: UILabel!
@IBOutlet var label13: UILabel!
@IBOutlet var label14: UILabel!
@IBOutlet var label15: UILabel!
@IBOutlet var label16: UILabel!
@IBOutlet var label17: UILabel!
@IBOutlet var descritpionlabel: UILabel!
var CondoIndivi2 = [[String:AnyObject]]()
var imageArray = [[String:AnyObject]]()
var test = [[String :AnyObject]]()
let adress : String = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
scrollerpage.contentSize.height = 15000
test = [
[
"id": 744736,
"pic_count": 6,
"mls_unique_id": 342947084,
"list_price": 1480000,
"property_type": "RE2",
"city": "Miami",
"bedrooms": 3,
"bath": 3,
"status": "A",
"entry_date": "2016-02-11 00:11:52",
"mls_number": "A10032455",
"street_number": 1060,
"street_directional": "",
"street_name": "Brickell",
"city_id": 65,
"zipcode": 33131,
"address": "1060 Brickell # 4505",
"primary_listing_pid": 3039955,
"secondary_listing_pid": "",
"municipal_code": 31,
"township_number": 22,
"section_number": 11,
"subdivision_number": "",
"area": 41,
"parcel_number": 1250,
"year_built": 2009,
"virtual_tour_link": "",
"half_bath": 1,
"living_area": 1933,
"garage_spaces": 1,
"waterfront": "Y",
"total_area": "",
"pool": "",
"maintenance_fee": 1662,
"pets_allowed": "Yes",
"unit_number": 4505,
"lot_area": "",
"listing_broker_code": "ZZON01",
"listing_broker_office": "Zona",
"latitude": 25.764026271539,
"longitude": -80.191569328308,
"original_list_price": 1780000,
"main_photo_url": "http://s3.amazonaws.com/sefpic/large/342947084-1.jpg",
"sale_price": 0,
"days_on_market": 73,
"close_date": "",
"selling_broker_code": "",
"expiration_date": "",
"condo_id": 444,
"complex": "Avenue 1060 Brickell",
"subdivision": "",
"community_name": "",
"lot_dimensions": "",
"hoa_fees": "",
"taxes": 32337,
"tax_year": 2015,
"rental_type": "",
"rental_occupancy": "Tenant Occupied",
"rental_furnished": "U",
"commercial_type": "",
"commercial_lease_sale": "",
"commercial_style": "",
"commercial_building": "",
"commercial_building_alt": "",
"county_id": "DADE",
"selling_public_id": "",
"second_selling_public_id": "",
"agent_name": "Eduardo Diez",
"broker_office_phone": "305-397-8192",
"agent_phone": "305-753-1113",
"second_agent_phone": "",
"second_agent_name": "", "parking_restrictions": "",
"condo_waterfront_view": [
"No Fixed Bridges"
],
"foreclosure": "",
"short_status": "",
"home_design": "",
"home_view": "Ocean View,Water View",
"short_sale": "N",
"reo": "N",
"internet_address_ok": "",
"modified_date": "2016-02-11 00:44:48",
"image_modified_date": "2016-02-11 00:23:16",
"directions": "",
"property_style": "Condo 5+ Stories",
"building_amenities": [
"Elevator",
"Exercise Room"
],
"equipment": [
"Automatic Garage Door Opener",
"Circuit Breaker",
"Dishwasher",
"Dryer",
"ELEVATOR",
"Fire Alarm",
"Microwave",
"Refrigerator",
"Self Cleaning Oven",
"Smoke Detector"
],
"exterior_features": [
"High Impact Doors",
"Open Balcony",
"Other"
],
"interior_features": [
"Closets Cabinetry",
"Cooking Island",
"Handicap Equipped",
"Other Interior Features",
"Split Bedroom",
"Vaulted Ceilings"
],
"construction_type": [
"Concrete Block Construction"
],
"floors": "",
"roof_type": "",
"home_heating": "",
"pet_restriction": "Restrictions Or Possible Restrictions",
"home_cooling": [
"Central Cooling",
"Electric Cooling",
"Other"
],
"home_design_2": "", "bedroom_2_size": "",
"bedroom_3_size": "",
"bedroom_4_size": "",
"bedroom_master_size": "",
"kitchen_size": "",
"living_room_size": "",
"rental_includes": "",
"description": "Unique duplex apartment on brickell avenue. Amazing views. Building with all amenities. Walking distance to restaurants, bars, markets, convenient stores.",
"rooms": "",
"sewer": "",
"water": "",
"subdv": "",
"dinner": "",
"floor_location": "45<sup>th</sup>",
"property_type_db": "RE2",
"pets_icon": "Yes",
"furnished_icon": "",
"price_sqft": 765.64924987067,
"price_sq_meters": 8241.6496218586,
"living_area_meters": 179.5757,
"price_change_days": 23,
"price_change_type": -1,
"price_change_diff": 300000,
"price_change_percent": 20.27,
"price_change_arrow": "down",
"days_on_market_str": "2 months",
"days_on_market_unix": 1455167512,
"listing_images": [
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-1.jpg",
"comments": "",
"photo_id": 1
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-2.jpg",
"comments": "",
"photo_id": 2
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-3.jpg",
"comments": "",
"photo_id": 3
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-4.jpg",
"comments": "",
"photo_id": 4
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-5.jpg",
"comments": "",
"photo_id": 5
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-6.jpg",
"comments": "",
"photo_id": 6
]
],
"permalink_url": "/property-view/1060-brickell---4505/miami/342947084/"
]
]
let longtitude_map = test[0]["longitude"] as! Double
let latitude_map = test[0]["latitude"] as! Double
let adress = test[0]["address"] as! String
if let image = test[0]["listing_images"]{
let imagereceiver = image
print(imagereceiver )
}
let latDelta:CLLocationDegrees = 0.05
let lonDelta:CLLocationDegrees = 0.05
let span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta)
let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude_map, longtitude_map)
let region:MKCoordinateRegion = MKCoordinateRegionMake(location, span)
mapview.setRegion(region, animated: false)
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = adress
mapview.addAnnotation(annotation)
let uilpgr = UILongPressGestureRecognizer(target: self, action: Selector("action:"))
uilpgr.minimumPressDuration = 2
mapview.addGestureRecognizer(uilpgr)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}