user15690: So I'm not actually making a Chess app, but I am trying to hook up an engine that uses a protocol almost exactly the same as UCI. I can get it working quite easily on a macOS app. Now, the hard part is integrating an engine like Stockfish into an iOS app. 
You can't use std input/output nor can you fork a process, so how should one manage the protocol for communicating moves to a UCI interface? I've managed to include the engine C++ library and can communicate via UCI commands in the debug console but I have no idea how to simulate std input into the engine from iOS. Should I look for hooks within the engine to call directly and simulate the game loop in Swift?
I apologize if this is the wrong community for this question, but UCI specific questions go over the head of most SO users so I thought I might try here. There are a plethora of iOS chess apps so I'm genuinely curious how people are integrating their engines into their apps. 

user825: Simple. Inter-thread communication. Specific implementations could be:

Internal UCI queues
Find the UCI loop function then hook it up (e.g. UCI::loop in Stockfish).
Redirect the standard input/output into pipes

Few points:

It's not a good idea to do your works with Swift, because Swift has poor support for C++. I prefer Objective-C as it works with C++ at the source level.
Redirecting is recommended if you're confident. All my iOS apps use that. You just need to send your UCI commands to a redirected pipe, while the engine receives them from the standard inputs (redirected). This is not a place for discussing unix programming, please ask Stackoverflow. It works.


15690: <p>So I'm not actually making a Chess app, but I am trying to hook up an engine that uses a protocol almost exactly the same as UCI. I can get it working quite easily on a macOS app. Now, the hard part is integrating an engine like Stockfish into an iOS app. </p>

<p>You can't use std input/output nor can you fork a process, so how should one manage the protocol for communicating moves to a UCI interface? I've managed to include the engine C++ library and can communicate via UCI commands in the debug console but I have no idea how to simulate std input into the engine from iOS. Should I look for hooks within the engine to call directly and simulate the game loop in Swift?</p>

<p>I apologize if this is the wrong community for this question, but UCI specific questions go over the head of most SO users so I thought I might try here. There are a plethora of iOS chess apps so I'm genuinely curious how people are integrating their engines into their apps. </p>
 825: <p>Simple. Inter-thread communication. Specific implementations could be:</p>

<ul>
<li>Internal UCI queues</li>
<li>Find the UCI loop function then hook it up (e.g. UCI::loop in Stockfish).</li>
<li>Redirect the standard input/output into pipes</li>
</ul>

<p>Few points:</p>

<ul>
<li>It's not a good idea to do your works with Swift, because Swift has poor support for C++. I prefer Objective-C as it works with C++ at the source level.</li>
<li>Redirecting is <strong>recommended</strong> if you're confident. All my iOS apps use that. You just need to send your UCI commands to a redirected pipe, while the engine receives them from the standard inputs (redirected). This is not a place for discussing unix programming, please ask Stackoverflow. It works.</li>
</ul>
