<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bondar Yaroslav on Medium]]></title>
        <description><![CDATA[Stories by Bondar Yaroslav on Medium]]></description>
        <link>https://medium.com/@bonyadmitr?source=rss-1e9df561279d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*V7UHKwNMRfut12jH23c3gg.png</url>
            <title>Stories by Bondar Yaroslav on Medium</title>
            <link>https://medium.com/@bonyadmitr?source=rss-1e9df561279d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:07:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bonyadmitr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Real time development in iOS with Injection (Part 2)]]></title>
            <link>https://medium.com/@bonyadmitr/real-time-development-in-ios-with-injection-part-2-22f707147713?source=rss-1e9df561279d------2</link>
            <guid isPermaLink="false">https://medium.com/p/22f707147713</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Bondar Yaroslav]]></dc:creator>
            <pubDate>Wed, 12 Apr 2017 13:23:38 GMT</pubDate>
            <atom:updated>2017-04-12T13:43:04.279Z</atom:updated>
            <content:encoded><![CDATA[<p>I will show you how to automate Inject Source, use simulator without 64bit architecture and some my features and notes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEQS6_YwqqqKl-vZaCip1Q.gif" /></figure><p>If you didn’t read previous part:</p><p><a href="https://medium.com/@bonyadmitr/real-time-development-in-ios-with-injection-a57454c9060d">Real time development in iOS with Injection part 1</a></p><h3>Patch the project</h3><p>It will give us:</p><ul><li>automatic Inject Source after run project</li><li>support simulator without 64bit architecture like iPhone 4s and 5</li><li>support of AppCode</li></ul><p>It is very simple and powerful, so lets do it. We will need to two steps:</p><p>First. For swift we need to create empty main.m file in our project:</p><p>Menu — File — New — File… — Objective C File</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*24OWGKxvZpC7P0zWFzpIoQ.png" /></figure><p>Second. Open Injection menu — macOS Project — Patch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*GIwDCFvX3qLXZ14ifgSKvA.png" /></figure><p>It will put next code to main.m file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c77af434cc0f18ef02af9e1b8bc91cb0/href">https://medium.com/media/c77af434cc0f18ef02af9e1b8bc91cb0/href</a></iframe><p>So you can just copy and past it.</p><p>Thats all!</p><p>Now run you project, make changes and save file. You have to get auto inject and support of iPhone 4s and 5.</p><h3>Light injections</h3><p>To prevent writing <strong>injected func</strong> in every controller, I created extension of UIViewController:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/189e37d4411df331f0c1bb5852db8644/href">https://medium.com/media/189e37d4411df331f0c1bb5852db8644/href</a></iframe><p>Also we will often need to reload tableView for UITableViewController, so extension was created for it too.</p><p>You can use overriding of this function for specific controllers and their logic as above. Don’t forget to call <strong>super.injected()</strong>.</p><p>If you are using <strong>addSubview</strong> method in <strong>viewDidLoad</strong> or in v<strong>iewWillAppear</strong>, add next code to prevent saving of previous added views in runtime:</p><pre>view.subviews.forEach {<br>    $0.removeFromSuperview()<br>}</pre><h3>Example project from the gif</h3><p>Here it is:</p><p><a href="https://github.com/bonyadmitr/InjectionTest">bonyadmitr/InjectionTest</a></p><p>It is patched and include the extensions.</p><h3>My notes</h3><p>Error like this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*0T-2ly4PExoUCYQf2cOYgA.png" /></figure><p>means that you are trying to run project on simulator without 64bit architecture. Use the patch above.</p><p>File Watcher needs to detect file changes and auto inject. Without it you will need to use Inject Source after every changing. So use File Watcher.</p><p>I tested Injection and founded that automatically Inject Source start only for patched project.</p><p>Real devices is no longer possible due to iOS 10’s sandboxing.</p><p>Storyboards changes not supported too.</p><p>One of my project gets an error during injection. It’s because of swift DI container Dip. So not all projects can be injected for now.</p><p>You will not be able to use the debug console if the injection is installed (with first file changing after running). You will see empty <strong>self</strong> and errors like this one:</p><pre>error: &lt;EXPR&gt;:3:1: error: use of unresolved identifier &#39;self&#39;<br>self<br>^~~~</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UhiE6vw-C-zRAcMlsHcGA.png" /></figure><p>For more information about Injection like:</p><p>How does Injection work?<br>What are the limitations of injection?<br>Why does injection require my administrator password?<br>Can I use injection with AppCode?<br>What else can the Injection application do?<br>and others</p><p>check links:</p><ul><li><a href="https://johnno1962.github.io/InjectionApp/injectionfaq.html">Injection FAQ</a></li><li><a href="http://johnholdsworth.com/injection.html">Injection II, the App</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22f707147713" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real time development in iOS with Injection (Part 1)]]></title>
            <link>https://medium.com/@bonyadmitr/real-time-development-in-ios-with-injection-a57454c9060d?source=rss-1e9df561279d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a57454c9060d</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Bondar Yaroslav]]></dc:creator>
            <pubDate>Tue, 11 Apr 2017 21:03:20 GMT</pubDate>
            <atom:updated>2017-04-20T10:39:11.020Z</atom:updated>
            <content:encoded><![CDATA[<p>I will show you how to develop app without rebuilding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEQS6_YwqqqKl-vZaCip1Q.gif" /></figure><p>We often need to look at small changes like move view by some pixels, change color, change layer property like cornerRadius and many others. For all of this changes we need to rebuild the app, that can takes long time. Injection app solve this problem.</p><p>I will use Xcode 8 and Swift 3 but it can be done for any Apple language.</p><h3>Injection</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/48/1*tnU_TbtCEl13mFrOc8qrVg.png" /></figure><p>First of all you will need to download standalone <strong>Injection</strong> app from the <a href="http://johnholdsworth.com/injection.html">site</a> or use <a href="http://johnholdsworth.com/InjectionII.app.zip">direct link</a>.</p><p>Launch it.</p><p>Why does injection require my administrator password? Check <a href="https://johnno1962.github.io/InjectionApp/injectionfaq.html">this FAQ</a> for full description.</p><p>Turn on <strong>File Watcher</strong> in menu of Injection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*D0MNx_mSV2iVI4gRB-_5Dg.png" /></figure><h3>Project</h3><p>Choose one of your projects or create a new one.<br>You will need this function:</p><pre>func injected() {<br>    print(&quot;I&#39;ve been injected: \(self)&quot;)<br>    viewDidLoad()<br>}</pre><p>Enter it in <strong>UIViewController</strong> that you want to change. For new project it will be <strong>ViewController</strong>. You will have something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a95cccc98a24e99bfc17cd360051f26/href">https://medium.com/media/1a95cccc98a24e99bfc17cd360051f26/href</a></iframe><p>Run project.</p><p><strong>Important</strong>: use simulator with <strong>64bit</strong> architecture like <strong>iPhone 5s</strong> or higher. In the next part I will show how to use others like iPhone 4s and don’t get error like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*0T-2ly4PExoUCYQf2cOYgA.png" /></figure><p>Now use shortcut <strong>CTRL</strong>+<strong>=</strong> or menu of <strong>Injection</strong> app to inject source:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*qwzjrAkDKEjh2l7uASE8dA.png" /></figure><p>In the Xcode console you will have something like this:</p><pre>2017-04-11 22:12:26.163 testInject[47084:1708904] Injection attempting connection to: 127.0.0.1:31452<br>2017-04-11 22:12:26.164 testInject[47084:1708904] Connected to &quot;Injection&quot; plugin, ready to load x86_64 code.<br>Extracting project parameters into /Users/zdaecqzezdaecq/Library/Developer/Xcode/DerivedData/testInject-crjaobaetsgerqefsjlvlpnprvlo/Logs/Build/../iOSInjectionProject/x86_64/identity.txt ...</pre><pre>** File not recently modified. Did you save it? **<br>Compiling /Volumes/Second/XcodeProjects/testInject/testInject/ViewController.swift<br>... First time learning of project, one second ...<br>objc[47084]: Class _TtC10testInject14ViewController is implemented in both /Users/zdaecqzezdaecq/Library/Developer/CoreSimulator/Devices/302B8EAE-68C3-4BED-829E-BB598306DC4A/data/Containers/Bundle/Application/88F773BE-26D4-4191-8838-9D73ED097E6F/testInject.app/testInject (0x102ea5180) and /Users/zdaecqzezdaecq/Library/Developer/Xcode/DerivedData/testInject-crjaobaetsgerqefsjlvlpnprvlo/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle27.bundle/InjectionBundle (0x111b3f300). One of the two will be used. Which one is undefined.<br>1 injections performed so far.<br>2017-04-11 22:12:29.182 testInject[47084:1708728] Ignore any warning, Swizzled testInject.ViewController 0x111b3f300 -&gt; 0x102ea5180<br>I&#39;ve been injected: &lt;testInject.ViewController: 0x7fc36e408ae0&gt;</pre><p>Last strings will contain:</p><pre>Ignore any warning, Swizzled...<br>I’ve been injected:...</pre><p>It means that injection have been setup successfully.</p><p>Now do any code in <strong>veiwDidLoad</strong>. I will change background color:</p><pre>override func viewDidLoad() {<br>    super.viewDidLoad()<br>    view.backgroundColor = UIColor.green<br>}</pre><p>Now save file with menu or with shortcut CMD+S and simulator should change background color automatically without rebuild:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*9WFTMGdOykWcUySrLu4-Ww.png" /></figure><p>Great! Now you can do any changes you what.</p><p>Don’t forget <strong>Inject Source</strong> after start the app.</p><p>Real devices is no longer possible due to iOS 10’s sandboxing.</p><p>In the next part:</p><ul><li>we will setup automatic Inject Source</li><li>will use simulator without 64bit architecture like iPhone 4s</li><li>some my features for lighter injections</li><li>and project from gif example</li></ul><p>Part 2 is ready:</p><p><a href="https://medium.com/@bonyadmitr/real-time-development-in-ios-with-injection-part-2-22f707147713">Real time development in iOS with Injection (Part 2)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a57454c9060d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>