Questions tagged [inout]

90 questions
1
vote
2 answers

Swift: inout with generic functions and constraints

I am making my first steps in Swift and got along the first problem. I am trying to pass an array by reference using inout on an generic function with constraints. First, my application start point: import Foundation let sort =…
shadowhorst
  • 1,433
  • 13
  • 20
1
vote
1 answer

MySQL Store Procedure Parameters

I am currently working on MySQL stored procedures and I am fairly new to these. When do we need to use OUT parameter? With IN alone then having only SELECT statement at the bottom, the results will also be returned without having to call @OUT…
Dave
  • 37
  • 7
1
vote
2 answers

Does a SELECT statement make sense in a MySQL stored PROCEDURE?

My system: MySQL 5.6.12 Since you can't use a storede procedure in a SQL statement like a function, I'm wondering if there is any use for stored procedures which just have a SELECT statement but no OUT/INOUT parameter or do some…
John
  • 399
  • 2
  • 6
  • 18
0
votes
2 answers

Swift - Pass inout parameter to scheduledTimer

Is there a way to pass an inout parameter through a scheduledTimer method? I want a specific value(disable Button until timer has run out). func Timer(Hz:TimeInterval, Activate: inout Bool, time:Double=10){ let info = ProcessInfo.processInfo …
0
votes
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 =…
0
votes
1 answer

Error "Inout argument could be set to a value with a type other than ..." when passing in a protocol type

I am coming from C++ to Swift. I have this situation with respect to protocols and structs (I am working with random numbers): (1) A protocol RandomPr that specifies there are methods such as randFloat() that returns a Float between 0 and 1. (2) A…
0
votes
3 answers

How to accept only characters to text area with Turkish characters?

here is my code for a textareainput to accept only characters not numbers. var harfInput1 = document.getElementById('graduated_university_country'); harfInput1.addEventListener("keyup",function(){ if (harfInput1.value.match(/[^a-zA-Z'…
0
votes
1 answer

Trying to update someone's socket programming code written in Swift 3 to Swift 5.2 (Inout expression creates a temporary pointer...)

The following code originally written in Swift 3, worked without warning in Swift 4.2, gave the warning "Inout expression creates a temporary pointer, but argument #1 should be a pointer that outlives the call to '+'" in Swift 5, now not compiling…
GOs
  • 16
  • 1
  • 5
0
votes
1 answer

Inout and NSMutableDictionary

If i run the following code in XCode 12 playground (Swift 5.3) I get the same result from two listings: import Foundation var dict = NSMutableDictionary() dict["x"] = 42 func stuff(_ d: inout NSMutableDictionary) { d["x"] =…
zaitsman
  • 7,571
  • 4
  • 35
  • 64
0
votes
2 answers

Swift - How to overload += for Int to pass the operator as a parameter in a function call like nextPage(page: pageIndex += 1)?

I would like to know how I can do the following please:- // This is not correct func += (inout lhs: Int, rhs: Int) -> Int { return lhs + rhs } Objective Usage:- scrollTo(pageIndex: pageIndex += 1)
Wael
  • 421
  • 5
  • 14
0
votes
1 answer

Swift inout passed array does not seem to effect original array

I have a simple case where I must not be using inout correctly. import Foundation func test_inout(file_data: inout Array){ let inString = "abc,def,xyz" let file_data = inString.split { $0 == ","}.map(String.init) …
George White
  • 115
  • 5
0
votes
1 answer

error "Value of type 'UIViewController' has no member..." when moving a func inside extension

I need to move a method for adding and removing a logging view inside an Extension, in order to give it to every controller. to do so I added a inout UIVew parameter to original method, where I used a global var for the view. no I have this…
biggreentree
  • 1,395
  • 3
  • 16
  • 29
0
votes
1 answer

Why does my Xcode compiler tell me I use a value type even though I use classes?

I have two classes: Player and Enemy that both conform to the protocol CharacterCharacteristicsProtocol: class Enemy: CharacterCharacteristicsProtocol {... class Player: CharacterCharacteristicsProtocol {... They are both references and not values…
Joakim Sjöstedt
  • 406
  • 1
  • 5
  • 13
0
votes
0 answers

PHP PDO Stored Procedure inout parameter works but cant fetch any results

I have tested my functions for stored procedures they work perfectly for in and out parameters, For inout parameters they work fine for DML queries, For selecting data even though nothing fails the result set is always empty and the data is there in…
user11995521
0
votes
1 answer

Linking (2) bidr ports between (2) modules in VHDL

I have an FPGA which accepts an 8 bit address & data bus (1 bus used for both) from two micro-controllers. Using a 2:1 mux, my FPGA only selects one device inputs at a time (address & data) and selection is based on an external signal to the FPGA. …
g_ski
  • 1