Questions tagged [inout]

98 questions
0
votes
0 answers

Read an Int from NSData in Swift

I'm trying to read data from a large file in Swift -- I don't want the whole file read into a NSData object, which seems to be how Swift wants to do everything. I found the code to open the file with a FileHandle and read chunks of data into NSData…
bsabiston
  • 721
  • 6
  • 22
0
votes
2 answers

Can't use SKShapeNode in inout function

So, like my SKSpriteNodes, I am trying to create a function to make me a default physics body. Here's my DefaultBody.swift I created: import Foundation import SpriteKit enum Type { case rectangle case circle } // Create new default physics…
George
  • 25,988
  • 10
  • 79
  • 133
0
votes
1 answer

app crash when using multiple inout param in function

My application crash when i use below code. var char : Character = "1" var char2 : Character = "1" func changeChar( char1: inout Character,char2: inout Character) { char = "b" char2 = "b" } override func viewDidAppear(_ animated: Bool) { …
Pratik Prajapati
  • 1,137
  • 1
  • 13
  • 26
0
votes
1 answer

Swift: Function with inout-Closure

I have the following struct: struct MyStruct { var myInt: Int var myString: String } This struct should be edited in a function like this: func editMyStruct(action: (inout MyStruct) -> ()) { var mutableMyStruct = MyStruct(myInt: 10,…
Poweranimal
  • 1,622
  • 3
  • 12
  • 16
0
votes
1 answer

Active direction of inout port during simulation using PLI

I am trying to find if an inout port is used as an input port or as an output port during simulation from my PLI based C-code. How can it be done?
Saurabh
  • 295
  • 3
  • 12
0
votes
1 answer

Using inouts with wand

Consider the below code. module TriState ( // Outputs O, // Inouts IO, // Inputs OE, I ); parameter width = 1; input OE; input [width-1:0] I; output [width-1:0] O; inout…
0
votes
1 answer

VHDL: assigning to inout port from testbanch

I have VHDL module with bidirectional port which nested in Top module. In testbanch I try to assign data to signal which connected to bidirectional port of Top. But assigned data don't propogate to nested module bidirectional port, I see assigned…
Alex
  • 43
  • 4
0
votes
1 answer

bidirectional tri-state buffer

I'm working on a project in which I need a bidirectional tri-state buffer. I've developed a VHDL code based on my searches in this community and some other websites. But it doesn't work as it should. Below is the VHDL code. library ieee; use…
0
votes
1 answer

How to add delay to Tri-state Buffer

I'm new to verilog, thus I have very simple question. I want to add delay before data_in assign to pad in following statement assign pad = (enable) ? data_in : 1'bz; something like assign pad = (enable) ? #10 data_in : 1'bz; but it won't work.…
0
votes
1 answer

How to handle bidirectional pin (inout) in a verilog task

I want to use a bidirectional data bus in my controller.Here's the code module controller ( clk, data_out); // Port Declaration input clk; inout [7:0] data_out; reg [7:0] a; reg [7:0] b; wire [7:0] c; // data should write to…
0
votes
2 answers

Cannot pass immutable value of type 'NSObject' as inout argument

This should work, but I've got no clue why it doesn't. The code is self-explanatory. class Themer { class func applyTheme(_ object: inout NSObject) { //do theming } } And I apply theme to the button like so: class ViewController:…
Aswath
  • 1,236
  • 1
  • 14
  • 28
0
votes
1 answer

swift 3 update syntax from swift 2

in swift 2.2 its work: var messages = [JSQMessage]() //... for i in 1...10 { let sender = (i%2 == 0) ? "Server" : self.senderId let messageContent = "Message nr. \(i)" var message = JSQMessage(senderId: sender, displayName: sender, text:…
Denis Windover
  • 445
  • 2
  • 6
  • 20
0
votes
0 answers

Updating an inout param async does not update reference

Using the below playground, when I print in the async I would assume the counts should be the same, but they are not. It seems that swift does not properly use inout asynchronously, but I need to be able to update an inout reference in an…
0
votes
1 answer

Verilog "In, out, or inout does not appear in port list"

I can't understand what this error means. I want to make a simple calculator with memory, however this error jumped out and I cant get what the ** Error: C:\Users\Kainy\Desktop\LOGIC\calculator\cal.v(14): In, out, or inout does not appear in port…
Kainy Yang
  • 25
  • 1
  • 7
0
votes
1 answer

Swift inout parameter for const properties

Is it possible to use a let property with a similar function parameter to inout when I do't want to change the property itself but that property's properties? e.g. let someLine = CAShapeLayer() func setupLine(inout line:CAShapeLayer, startingPath:…
richy
  • 2,716
  • 1
  • 33
  • 42