Questions tagged [inout]

98 questions
1
vote
3 answers

Declare a pointer to a property and pass it as inout param into func in Swift?

I need to choose one of some properties and pass it by reference to set it inside the func. Approximate code: var someProperty = [SomeClass]() var someProperty2 = [SomeClass]() func someFunc(someObject: inout [SomeClass]) { ... someObject =…
1
vote
5 answers

In Kotlin, how to check if the input is alphabetic only

In kotlin, how to check if the input is alphabetic only. Input could be anything, a String, Int or Double etc. For example val input = readLine() if(check) { doSomeTask } else doSomethingElse
Abhishek
  • 59
  • 2
  • 12
1
vote
0 answers

How to use jdbc call for postgres procedure with INOUT parameter

I am not much into Postgres and has been lately doing a lot of surfing due to some specific requirement. I have this specific procedure p_user_name character varying, p_password character varying, p_ip character varying, INOUT p_return_id…
1
vote
0 answers

How to use SWIG to wrap a C++ function which uses a reference to a vector of structs as input and output to be used in Python?

As the title question suggests, I am trying to use SWIG to wrap a function defined in C++ which has as one of its variables a reference to a vector of structures used as both input and output (common in C++) so that the function can be used in…
mlachut
  • 11
  • 1
1
vote
1 answer

How to edit an array in one struct from another struct in Swift?

I have an array of "Workout Sets" in a struct called WorkoutBuilderView. My issue is that I need to access the contents of that array from a struct that is nested within the WorkoutBuilderView (as seen below). This struct does not need to be nested…
Eli Front
  • 695
  • 1
  • 8
  • 28
1
vote
2 answers

SWIG INOUT types (C++ to Python)

I'm creating a python wrapper for a C++ api, making support for some types was more or less straightfoward using templates but the api needs some variables by reference, one of them is an int and the other is float. If I am not wrong it is done by…
Frank Escobar
  • 368
  • 4
  • 20
1
vote
1 answer

A global function calls a mutating method of a protocol type. How can I get rid of the var tmp object?

this is my working code snippet. But I want to get rid of the var tmp variable in the function slide. protocol Moveable { mutating func move(to point: CGPoint) } class Car : Moveable { var point:CGPoint = CGPoint(x: 23, y: 42) func…
fvdb
  • 25
  • 5
1
vote
1 answer

Grid points within polygon: previous solution does not work for me

For some reason I can't get the solution provided by @RichPauloo to work and do appreciate some help. I have a SpatialPolygonsDataFrame called "spdf" (in the dropbox link below) https://www.dropbox.com/s/ibhp5mqbgfmmntz/spdf.Rda?dl=0 I used the code…
1
vote
2 answers

Inout not working with SubClass object throws Cannot pass immutable value as inout argument

I have two block of codes func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { // BLOCK 1 Which is not working guard let planeAnchor = anchor as? ARPlaneAnchor else { return } var plane = Plane(with:…
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
1
vote
0 answers

multiple array input and array output: SWIG C++ to python

I am trying to access a C++ function from python by using SWIG for wrapping. The function uses two arrays as inputs of length cL and another as output of some smaller length. The SWIG .i file is : %module polcvx %include "typemaps.i" %apply int…
amrut
  • 64
  • 8
1
vote
1 answer

Widespread Swift Protocol for Extensions

Widespread Protocol for Extensions Swift 4.1, Xcode 9.3 I was wondering, what are some of the most overarching protocols in Swift. I want to make an extension that applies to values that can be set. The purpose of this was to make it easier to write…
Noah Wilder
  • 1,656
  • 20
  • 38
1
vote
2 answers

store reference in variable SWIFT 4

I send a parameter from my viewController to customCell. My custom cell has a textField. In my viewController I have a string variable for storing the value in textField, because this value I will send to a rest services. MyCustomCell customCell:…
Joseph
  • 97
  • 3
  • 9
1
vote
4 answers

swift affect value to inout generic variable

I want to simplify this piece of code with a T variable but could not succeed in compiling it. Hope could you give me the way. here is the "duplicate" code I want to rewrite : func getIntegerValue (listValues: [Any], numValueToRead: Int,…
1
vote
2 answers

Initialize instance variables inside instance function

final class TestVC: UIViewController { var usersFooter: Footer! var groupsFooter: Footer! override func viewDidLoad() { super.viewDidLoad() bind(footer: &usersFooter) } func bind(footer: inout Footer) { …
Zaporozhchenko Oleksandr
  • 4,660
  • 3
  • 26
  • 48
1
vote
0 answers

Escaping closures can only capture inout parameters explicitly by value - Assigning inout parameter to local var

Looking to assign inout array parameter to local var but getting error Escaping closures can only capture inout parameters explicitly by value Following is the code func setData( feedsData: inout [FeedStruct]) { …
Ali Jawad
  • 151
  • 1
  • 13