swift3

Receive only one data from filters to struct

余生长醉 提交于 2019-12-12 02:11:47
问题 Short question, I have the following structure, which I store in "Salas" struct SalasMaster { let id: Int let nombre: String let latitud: String let longitud: String let piso: String let observaciones: String let pabellon: String } var Salas = [SalasMaster]() ...receiving data... ...dump(Salas) example -> SalasMaster - id: 307 - nombre: "SALA DE PROYECTOS " - latitud: "-29.96429300" - longitud: "-71.34937300" - piso: "1" - observaciones: "" - pabellon: "X - Escuela de Ingeniería" And finally

Passing data from Marker to other VC

故事扮演 提交于 2019-12-12 02:08:01
问题 At the beggining of this post I would like thank @Nirav D for help :) Ok. So the problem. There is a class i want to pass with prepareForSegue func with google marker. How to do it? 回答1: You are too close to pass simply set the passedMarker with your array object. if let marker = sender as? GMSMarker , //is it correct do declare marker as GMSMarker? let dict = marker.userData as? [String:Int] { let markerIndex = dict["index"]! nextVC.passedMarker = self.markers[markerIndex] } Now simply

Create a loop on UIScrollView

淺唱寂寞╮ 提交于 2019-12-12 01:57:14
问题 I can scroll back and forth on the views but I can't loop the views so it scrolls back when I'm on ViewController3 and forward on ViewController1 to create a loop. How would I do this? The code below is what I've done so far. import UIKit class ViewController: UIViewController { @IBOutlet weak var scrollView: UIScrollView! override func viewDidLoad() { super.viewDidLoad() let vc0 = ViewController0(nibName: "ViewController0", bundle: nil) var frame0 = vc0.view.frame frame0.origin.x = self.view

NSTableview - Drag and Drop split into two classes and controllers

*爱你&永不变心* 提交于 2019-12-12 01:57:09
问题 i found this helpfully tutorial for realize drag an drop with nstabelview: https://drive.google.com/open?id=0B8PBtMQt9GdONzV3emZGQWUtdmM this works fine. but i would like to split both table views into differente view controllers and classes with a split view: one split view controller: item 1: viewcontroller with source nstableview (SourceTableView.class) item 2: viewcontroller with target nstableview (TargetTableView.class) how can i do this with this project? i know how can i create a

how do I change an image by selecting a cell in CollectionView

六眼飞鱼酱① 提交于 2019-12-12 01:57:02
问题 Currently I am working on a project and my product page is like this Here I am using an UIImageView to show the large image and below that I am using a CollectionView to scroll a set of images. I want to change the large image accordingly when I click an image from the CollectionViewCell . As this is the first time I am using this kind of functionality, I am out of clue. Please anybody give me some suggestion. Thank you. 回答1: If every image is in a separate UICollectionViewCell, use override

imageWithSize in Swift3

和自甴很熟 提交于 2019-12-12 01:52:42
问题 I am converting a project from Xcode 7 iOS 9 Swift 2 to Xcode 8 iOS 10 Swift 3. I let Xcode convert to the latest and it produced: let artWork = delegate.musicPlayer.nowPlayingItem?.value(forProperty: MPMediaItemPropertyArtwork) let imageForButton = (artWork as AnyObject).image(at: CGSize(width: 300, height: 300)) This resulting code crashes the app and pops the error: -[_SwiftValue imageWithSize:]: unrecognized selector sent to instance 0x17008cdf0 *** Terminating app due to uncaught

How to create a model in vapor using Mongokitten

有些话、适合烂在心里 提交于 2019-12-12 01:48:31
问题 This is the model and I have to change it to mongo model using mongokitten. This is my friend Model and I have implemented. This but not able to make a nested json like structure for this mode. import Foundation import Vapor import Fluent struct Friend: Model { var exists: Bool = false var id: Node? var name: String var age: Int var email: String var residence: FriendAddress init(name: String, age: Int, email: String ,residence: FriendAddress) { self.name = name self.age = age self.email =

Protocol extension and generics in Swift 3. Is this even possible?

纵然是瞬间 提交于 2019-12-12 01:46:15
问题 I'm reading Head First Design Patterns and I'm trying to replicate the Design Patterns in a Swift Playground. I'm trying to get the Observer pattern working as per the book. My current source is as follows: protocol Subject { func register(observer: Observer) func remove(observer: Observer) func notifyObservers() } protocol Observer { func update(temperature: Double, humidity: Double, pressure: Double) } protocol DisplayElement { func display() } class WeatherData: Subject { var observers:

UITable Won't display. Value type 'FilmsAPITableViewCell' has no member 'movieTitle'

跟風遠走 提交于 2019-12-12 01:43:47
问题 I am getting build errors when trying to display jSON data in Xcode using Swift 3. I am going to copy a portion of my code to this page with hopes you guys can assist me. I have found similar questions on this site however answers don't seem to help. class FilmsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { weak var tableView : UITableView! var FilmArray = [String]() let film_url = "https://www.testing.com/api/resources/films/1" func tableView(_ tableView:

Swift 3 Breaks Cell For Row At Index Path

丶灬走出姿态 提交于 2019-12-12 01:27:08
问题 This code was from a now inactive tutorial that helped me load in data to a table view. Since the tutorial was written in Swift 2.0, I believe that this was changed in Swift 3. I know that the override function itself was changed, which I handled. But now, it brings me a Thread 1: EXC_BAD_INSTRUCTION(code=EXC_1386_INVOP, subcode=0x0) error. Update: I have tried multiple things including creating a custom class for the cell. I still either get the same error I listed above, or a Thread 1: