<?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 Leo Wirasanto Laia on Medium]]></title>
        <description><![CDATA[Stories by Leo Wirasanto Laia on Medium]]></description>
        <link>https://medium.com/@leowirasanto?source=rss-d884a6f91f87------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SJwmiNS4VZt1UrWj</url>
            <title>Stories by Leo Wirasanto Laia on Medium</title>
            <link>https://medium.com/@leowirasanto?source=rss-d884a6f91f87------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:58:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@leowirasanto/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[Stop Waiting for the Backend: Mock Network Requests Directly in Your iOS App]]></title>
            <link>https://leowirasanto.medium.com/stop-waiting-for-the-backend-mock-network-requests-directly-in-your-ios-app-da4a472f03d7?source=rss-d884a6f91f87------2</link>
            <guid isPermaLink="false">https://medium.com/p/da4a472f03d7</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Leo Wirasanto Laia]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 19:06:15 GMT</pubDate>
            <atom:updated>2026-06-03T05:44:22.335Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZKar1XoU1R3l64KIkXJIA.png" /></figure><p>You’ve been there. The designs are finalized, the SwiftUI views are ready, and the ViewModel is wired up. But the backend API isn’t deployed yet — or worse, it’s broken in the staging environment. Your sprint is stalled, and you’re either hard-coding fake data in your views (and forgetting to remove it) or sitting in a Zoom call waiting for the backend team to push a fix.</p><p>There has to be a better way.</p><h3>The Options Are All Bad</h3><p>When the backend isn’t ready, iOS developers typically reach for one of these:</p><p>- <strong>Hardcode data in the view: </strong>Fast, ugly, and you *will* forget to remove it before shipping.<br>- <strong>Spin up a local mock server</strong> (json-server, WireMock, etc.): Works, but now everyone on the team needs Node or Java installed, and you’re maintaining a separate config.<br>- <strong>Use a proxy tool like Proxyman: </strong>Powerful, but requires system-level setup and doesn’t work well in CI or on a colleague’s machine without onboarding them.<br>- <strong>Wait</strong>: The classic move. A complete waste of everyone’s time.</p><p>What if you could register mock responses directly inside your iOS app, with zero external tooling, and flip between mock and live with a single line of code?</p><p>That’s exactly what <strong>MocktailKit</strong> does.</p><h3>What Is MocktailKit?</h3><p><em>MocktailKit</em> is a lightweight Swift Package that intercepts outgoing `URLSession` requests at runtime and returns local JSON files you ship with your app bundle without touching your networking code at all.</p><p>It works like Proxyman, but it lives inside your app. No proxy. No certificates. No system settings.</p><ul><li>Register a URL path → JSON file mapping at app startup</li><li>Activate interception with one async call</li><li>Your existing `URLSession` code works exactly as before — but registered paths return your mock data instead of hitting the server</li></ul><p>When you’re ready to test against the real API, deactivate interception. That’s it.</p><h3><strong>How It Works Under the Hood</strong></h3><p>MocktailKit is built on `URLProtocol`, an often-overlooked foundation class in the iOS URL loading system. Every `URLSession` request passes through a stack of registered `URLProtocol` subclasses before it hits the network. MocktailKit inserts itself into that stack.</p><p>When a request comes in, `MockURLProtocol` checks the request’s path against the registered route table:</p><p>- <strong>Path is registered</strong> → loads the corresponding JSON file from the app bundle, constructs an `HTTP 200` response, and returns it — <em>*without making any network call*</em>.</p><p>- <strong>Path is not registered</strong> → forwards the request to the real server via a passthrough session that deliberately excludes `MockURLProtocol` (to avoid infinite recursion).</p><p>The route table lives in a Swift `actor` — `Mocktail.shared` — so reads and writes are always thread-safe under Swift 6’s strict concurrency model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*xmocZqeZGeF-9ADC9aKISg.png" /></figure><h3><strong>Installation</strong></h3><p>Add MocktailKit via Swift Package Manager. In Xcode: <strong>File → Add Package Dependencies</strong>, then enter:</p><pre>https://github.com/leowirasanto2/MocktailKit.git</pre><p>Or add it to your `Package.swift`:</p><pre>dependencies: [<br>    .package(url: &quot;https://github.com/leowirasanto2/MocktailKit.git&quot;, from: &quot;1.0.0&quot;)<br>]</pre><p><strong>Requirements:</strong> iOS 17+, Swift 6+, Xcode 16+</p><p>— -</p><h3><strong>Getting Started</strong></h3><p><strong>1. Add your JSON files to the app bundle</strong></p><p>Drop your mock JSON files into your Xcode target. You can put them anywhere in the bundle — MocktailKit finds them by filename.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*CvLsm2OnpSeDw7PrjcNGyg.png" /></figure><p>Make sure they’re listed under your target’s <strong>Build Phases → Copy Bundle Resources</strong>.</p><p><strong>2. Register routes at app startup</strong></p><pre>import MocktailKit<br><br>@main<br>struct MyApp: App {<br>    init() {<br>        Task {<br>            await Mocktail.shared.configure(mappings: [<br>                &quot;/v1/users&quot;:    &quot;users.json&quot;,<br>                &quot;/v1/products&quot;: &quot;products.json&quot;<br>            ])<br>            await Mocktail.shared.activateInterception()<br>        }<br>    }<br><br>    var body: some Scene {<br>        WindowGroup { ContentView() }<br>    }<br>}</pre><p>That’s the entire setup. Your app is now intercepting those routes.</p><p><strong>Two Usage Modes</strong></p><p><strong>Option A — Transparent URLSession Interception (Recommended)</strong></p><p>This is the zero-friction path. After calling `activateInterception()`, every `URLSession` request your app makes is automatically intercepted. <strong>**No changes to your networking code.**</strong></p><pre>// Your existing repository — untouched<br>func fetchUsers() async throws -&gt; [User] {<br>    let url = URL(string: &quot;https://api.example.com/v1/users&quot;)!<br>    let (data, _) = try await URLSession.shared.data(from: url)<br>    return try JSONDecoder().decode([User].self, from: data)<br>}<br><br>// ↑ When interception is active, this returns users.json from the bundle.<br>//   When interception is off, it hits the real server.</pre><p>This means you can write your real networking code now, today, and it will work against both your mock data and the live API without any conditional logic.</p><p><strong>Option B — Manual `provide()`</strong></p><p>If you want explicit control over which calls are mocked, use `provide()` directly:</p><pre>let users: [User] = try await Mocktail.shared.provide(<br>    from: .main,<br>    &quot;/v1/users&quot;,<br>    as: [User].self<br>)</pre><p>This is useful in unit tests or when you want to mock specific calls without activating global interception.</p><h3><strong>Toggle Mock at Runtime</strong></h3><p>One of the most useful patterns is a live toggle in your debug UI that lets you switch between mock and real data on the fly — without restarting the app.</p><pre>@MainActor<br>class SettingsViewModel: ObservableObject {<br>    @Published var isMockActive = true<br><br>    func toggleMock() {<br>        Task {<br>            if isMockActive {<br>                await Mocktail.shared.deactivateInterception()<br>            } else {<br>                await Mocktail.shared.activateInterception()<br>            }<br>            isMockActive.toggle()<br>        }<br>    }<br>}</pre><p>Wire this up to a `Toggle` or segmented picker in a debug settings screen, and your team can flip between mock and live responses in seconds — perfect for demos, QA handoffs, or quickly verifying that your UI handles real API errors correctly.</p><h3><strong>What MocktailKit Is Not</strong></h3><p>A few things to be clear about:</p><p>- <strong>Not for production.</strong> MocktailKit is a development and debugging tool. Don’t ship it in release builds. Use `#if DEBUG` or a build configuration flag to gate the bootstrap call.</p><p>- <strong>URLSession only.</strong> It intercepts requests made through `URLSession`. Third-party networking libraries that use their own transport (e.g., some Combine or async wrappers) will work as long as they ultimately call `URLSession` underneath — which most do.</p><p>- <strong>Not a record/replay tool</strong> (yet). MocktailKit currently serves static JSON files. Recording live responses and replaying them automatically is on the roadmap.</p><h3><strong>The Bigger Picture</strong></h3><p>MocktailKit is a small tool with a focused job: let you write real, production-quality networking code today and test it against local data until the backend catches up. No proxy setup, no hardcoded fakes to clean up, no blocked sprints.</p><p>The library is open source under the MIT license.</p><p><strong>GitHub </strong><a href="https://github.com/leowirasanto2/MocktailKit">https://github.com/leowirasanto2/MocktailKit</a></p><p>If you find it useful, a ⭐ on GitHub goes a long way. And if you have ideas, better route matching, response delays, recording mode, PRs and issues are very welcome.</p><p><em>*Built with Swift 6, actors, and a lot of frustration at waiting for backends.*</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da4a472f03d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain this, Blockchain that]]></title>
            <link>https://leowirasanto.medium.com/blockchain-this-blockchain-that-e2c16ff39d21?source=rss-d884a6f91f87------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2c16ff39d21</guid>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Leo Wirasanto Laia]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 12:16:06 GMT</pubDate>
            <atom:updated>2024-04-24T12:16:06.829Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intro</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_aifelhC1idjXIKOQVBhQw.jpeg" /><figcaption>Blockchain illustration (generated by Gemini)</figcaption></figure><p>Did you realize that people nowadays are talking about blockchain this and blockchain that and you are wondering what is that thing? How does it work? And what is an example of it?</p><p>Well, you are not alone. To help you understand what is blockchain, I’ll try to explain it easily so hopefully you can understand it easily as well.</p><h3>Definition</h3><p>Referring to <a href="https://www.investopedia.com/terms/b/blockchain.asp">Investopedia</a>, blockchain is a distributed database or ledger shared among a computer network’s nodes. Cryptocurrency system is one of the examples that runs on this technology where cryptocurrency uses blockchain for maintaining a secure and decentralized record of transactions.</p><h3>Illustration</h3><p>For illustration let’s dive into a real-life case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*myGCXtBjtA5DEVCffdSSYQ.png" /></figure><ul><li>Let’s say there’s a group of people consisting of Abe, Ben &amp; Clark who just bought a book for each of them. The price of a book is $1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*BElnuRhmaQFR5oexX-M76g.png" /></figure><ul><li>Because the store has a lot of queues, Abe paid 3 books for each of them which makes Ben and Clark owe Abe $1 each.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*IfZBeJ85R1nWlw9rjzW2xA.png" /></figure><ul><li>Now let’s assume Abe has $4, Ben has $2 &amp; Clark has $3 in their account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*wRIeKTNQLZEEOZ8sjCmN4A.png" /><figcaption>1st transaction by Ben sending $1 to Abe</figcaption></figure><ul><li><strong>For the first transaction</strong>, Ben sends $1 to Abe. <em>This is where the blockchain doing its jam</em>.</li><li>The transaction records were recorded in a new block permanently. The block also holds the information on their account balance. We can see, previously Abe had $4, Ben had $2 &amp; Clark had $3. Now Abe has $5, Ben has $1, and no change from Clark.</li></ul><p><strong>Here you go, we are almost there. Now take a deep breath because we are going to dive deeper. :D</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*7OGIcznyWnu-K_qGNMsuGQ.png" /><figcaption>2nd transaction by Clark sending $1 to Abe</figcaption></figure><ul><li>Now it’s Clark’s turn to send $1 to Abe. When he does the transaction, <strong>a new block is created</strong> and inscribed the transaction alongside the current balance of each account.</li><li>There are two blocks created from those transactions. Those blocks are <strong>linked to each other</strong>. Each of them took the <strong>reference from the previous</strong> one for the number of balances each person (Abe, Ben, Clark) owns.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*Gj-P09dK4slxvHGC9wOG2Q.png" /></figure><ul><li>The chain of records is called a <strong>Ledger</strong>. The ledger is also shared among the person (Abe, Ben, Clark) as a <strong>Public Distributed Ledger</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*s7O6MD8pejR2ibkg9pFIMw.png" /><figcaption>Ledger shared to each person as Public Distributed Ledger</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*CEzscktOr5GAfxJL.jpg" /></figure><p>Perfect! I believe you are 2/10 people left :))).</p><p>Anyway, let’s continue!</p><h3>Benefit of Blockchain</h3><p>From the previous part, we should’ve understood what is blockchain and how it works.</p><p>So, blockchain is about keeping the transaction and account balance record in a block?</p><p>Well, blockchain has other key benefits:</p><ul><li><strong>Security</strong>: stored information on a blockchain is highly resistant to hacking or tampering.</li><li><strong>Transparency</strong>: the information of the blockchain has visibility to everyone.</li><li><strong>Efficiency</strong>: blockchains can streamline processes by eliminating the need for intermediaries.</li></ul><p>I won’t explain all of those key benefits in this post as I want to keep it simple. However, let me explain it in one example:</p><h3>Example</h3><ul><li>From the previous illustration, Abe has $6, Ben has $1 &amp; Clark has $2.</li><li>Let’s say Ben wants to transfer $2 to Abe because he has another split bill where Ben needs to pay Abe $2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*Dg6giV5IufuuVJB1YYb0aA.png" /><figcaption>Each friend flag the transaction as invalid</figcaption></figure><ul><li>Since each of them has the ledger and in that ledger, <em>Ben has only $1 left</em> on his account, Abe &amp; Clark <strong>flag </strong>that transaction as <strong>invalid</strong>.</li></ul><h3>What about Hacker?</h3><p>It’s not that easy, the hacker won’t be able to alter any data in the blockchain because each user has a copy of the ledger.</p><p>All data within the block are encrypted by complex algorithms.</p><p>Unless the hacker can hack all of the ledgers around the world. Well, good luck with that.</p><h3>Conclusion</h3><ul><li>Blockchain is a collection of records.</li><li>Blockchain is linked with each other and shared among users as Public Distributed Ledgers.</li><li>Blockchain has great security defense because its data is protected by complex algorithms.</li></ul><h4>Thank you for reading this long post! Hopefully, this post helps you to understand blockchain.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*kQzQfSOI_KGXN9vw" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2c16ff39d21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create AppRouter by Using Dependency Injection]]></title>
            <link>https://leowirasanto.medium.com/create-approuter-by-using-dependency-injection-fb390db66930?source=rss-d884a6f91f87------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb390db66930</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[viper-architecture]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Leo Wirasanto Laia]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 18:55:31 GMT</pubDate>
            <atom:updated>2024-01-16T18:59:17.494Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CA_y6752jObE_bjxNI4Qiw.png" /></figure><h3>Background</h3><p>Routing is one of the essential thing in iOS App development and other platform for sure. To handle the routing, we usually create a new class for each page that responsible to do the navigation thing. For example we have 2 page (<strong>HomeViewController &amp; HistoryViewController</strong>), so we should have 2 router for each page as well (<strong>HomeRouter &amp; HistoryRouter</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*5_ZcsRvhT3Ik1v6BSxHW6w.png" /><figcaption>example by using VIPER</figcaption></figure><p>This is the most common thing we do to handle the routing.</p><h3>Problem</h3><p>However, in my opinion this way can be improved by using dependency injection so in the feature we don’t have to construct the destination page which take 4 or more LOC.</p><p>For example, we are using <strong>VIPER</strong> as the design pattern which contains (<em>View, Interactor, Presenter, Entity, Router</em>) and you need to construct 4 of them for everytime you create a new method to navigate to the particular page, in this case we are going to set HistoryPage as navigation destination.</p><pre>func navigateToHistoryPage() {<br>    let interactor = HistoryInteractor()<br>    let router = HistoryRouter()<br>    let presenter = HistoryPresenter(interactor: interactor, router: router, parameters: parameters)<br>    let viewController = HistoryViewController(presenter: presenter)<br>    router.viewController = viewController<br>    interactor.presenter = presenter<br>    <br>    navigationController?.pushViewController(viewController, animated: true)<br>}</pre><h3>Solution</h3><h3>Setting Up</h3><ul><li>First step, let’s create 3protocols and 1 enum like the code below.</li></ul><pre>protocol BaseModule: AnyObject {<br>    func displayPage(parameters: [String: Any]?)<br>}<br><br>protocol Module {<br>    var moduleKey: String { get }<br>}<br><br>protocol ProductRouter: AnyObject {<br>    func presentModule(_ module: Module, parameters: [String: Any])<br>}<br><br>enum PageModule: Module {<br>    case home<br>    case history<br>    <br>    var moduleKey: String {<br>        switch self {<br>        case .home:<br>            return &quot;home-page-key&quot;<br>        case .history:<br>            return &quot;history-page-key&quot;<br>        }<br>    }<br>}</pre><p><strong>PageModule</strong> enum is like a list of available modules/pages.</p><p><strong>Module</strong> is the interface for PageModule, it has moduleKey for filtering purpose.</p><p><strong>BaseModule</strong> is the interface for every Modules (<em>HomeModule, HistoryModule, etc</em>).</p><p><strong>ProductRouter</strong> is the main interface that responsible to presenting the registered <strong>Module. </strong>We’ll see who is implementing the <strong>ProductRouter </strong>and why it’s become the main here.</p><ul><li>Second Step, create a protocol <strong>IAppRouter</strong> and implement <strong>ProductRouter</strong> that we’ve created at the first place. After that, create a new class <strong>AppRouter</strong> and implement the <strong>IAppRouter</strong> protocol.</li></ul><pre>protocol IAppRouter: ProductRouter {<br>    var navigationController: UINavigationController? { get set }<br>    <br>    func presentView(_ view: UIViewController?, animated: Bool)<br>    func pushView(_ view: UIViewController?, animated: Bool)<br>    func popVC(animated: Bool)<br>}<br><br>class AppRouter: IAppRouter {<br>    private let productConstructor: (_ appRouter: IAppRouter) -&gt; ProductRouter<br>    private var rootVC: UIViewController?<br>    var navigationController: UINavigationController?<br>    <br>    init(productConstructor: @escaping (_ appRouter: IAppRouter) -&gt; ProductRouter) {<br>        self.productConstructor = productConstructor<br>    }<br>    <br>    // Implementation of IAppRouter - ProductRouter<br>    func presentModule(_ module: Module, parameters: [String : Any]) {<br>        let product = productConstructor(self)<br>        product.presentModule(module, parameters: parameters)<br>    }<br>    <br>    func presentView(_ view: UIViewController?, animated: Bool) {<br>        guard let view = view else { return }<br>        view.modalPresentationStyle = .overFullScreen<br>        navigationController?.present(view, animated: animated)<br>    }<br><br>    func pushView(_ view: UIViewController?, animated: Bool) {<br>        guard let view = view else { return }<br>        navigationController?.pushViewController(view, animated: animated)<br>    }<br>    <br>    func popVC(animated: Bool) {<br>        navigationController?.popViewController(animated: animated)<br>    }<br>}</pre><ul><li>Third Step, create a new class ModuleFactory and implement ProductRouter as well. This class responsible to invoke the <strong>BaseModule</strong> protocol which implemented by each modules (HomeModule &amp; HistoryModule) whenever the <strong>ProductRouter</strong> protocol invoked.</li></ul><pre>class ModuleFactory: ProductRouter {<br>    private var appRouter: IAppRouter<br>    <br>    init(appRouter: IAppRouter) {<br>        self.appRouter = appRouter<br>    }<br>    <br>    // store all modules<br>    var modules: [String: BaseModule] {<br>        var result: [String: BaseModule] = [:]<br><br>        // constructs the module class (this example is using VIPER)<br>        let homeModule = HomeModule(appRouter: self.appRouter)<br>        let historyModule = HistoryModule(appRouter: self.appRouter)<br><br>        result[PageModule.home.moduleKey] = homeModule<br>        result[PageModule.history.moduleKey] = historyModule<br>        return result<br>    }<br>    <br>    // from ProductRouter<br>    func presentModule(_ module: Module, parameters: [String : Any]) {<br>        // filter the registered modules by module key from parameter<br>        if let module = modules[module.moduleKey] {<br>            module.displayPage(parameters: parameters)<br>        }<br>    }<br>    <br>    static func getAssemblies() -&gt; [Assembly] {<br>        var result: [Assembly] = [<br>            LandingPageAssembly(),<br>            HistoryPageAssembly()<br>        ]<br>        <br>        return result<br>    }<br>}</pre><p>For the example of BaseModule implementation, let’s see this HistoryModule class</p><pre>class HistoryModule: BaseModule {<br>  let appRouter: IAppRouter<br><br>  init(appRouter: IAppRouter) {<br>    self.appRouter = appRouter<br>  }<br><br>  // displayPage method is the part of BaseModule implementation.<br>  func displayPage(parameters: [String: Any]) {<br>    let interactor = HistoryInteractor()<br>    let router = HistoryRouter(appRouter: self.appRouter)<br>    let presenter = HistoryPresenter(interactor: interactor, router: router, parameters: parameters)<br>    let viewController = HistoryViewController(presenter: presenter)<br>    router.viewController = viewController<br>    interactor.presenter = presenter<br><br>    // using method from IAppRouter protocol since it stores the parent navigationController<br>    appRouter.pushView(viewController, animated: false)<br>  }<br>}</pre><p>We only construct the page/module here at <strong>Any_Page_Name_Module.swift</strong> class.</p><p>We also inject appRouter to the <strong>HistoryRouter</strong> class.</p><ul><li>Last step, start the injection at SceneDelegate class.</li></ul><pre>class SceneDelegate: UIResponder, UIWindowSceneDelegate {<br>    var window: UIWindow?<br>    var appRouter: IAppRouter?<br>    var navigationController: UINavigationController?<br>    <br>    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {<br>        guard let scene = (scene as? UIWindowScene) else { return }<br>        let window = UIWindow(windowScene: scene)<br><br>        // Creating base page for window&#39;s root<br>        let basePage = UIViewController()<br>        basePage.view.backgroundColor = .white<br>        let navigationController = UINavigationController(rootViewController: basePage)<br><br>        // set the navigationController variable &amp; construct the appRouter<br>        self.navigationController = navigationController<br>        self.appRouter = createAppRouter()<br><br>        window.rootViewController = navigationController<br>        window.makeKeyAndVisible()<br>        self.window = window<br>        <br>        // invoking the function to open selected module.<br>        DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in<br>            self?.open(PageModule.home)<br>        }<br>    }<br>    <br>    func open(_ module: Module) {<br>        // sample of usage: we only need 1 line of code<br>        appRouter?.presentModule(module, parameters: [:])<br>    }<br>    <br>    func createAppRouter() -&gt; IAppRouter? {<br>        let productConstructors: (_ appRouter: IAppRouter) -&gt; ProductRouter = { appRouter in<br>            appRouter.navigationController = self.navigationController<br>            return ModuleFactory(appRouter: appRouter)<br>        }<br>        let assembler = Assembler()<br>        assembler.apply(assemblies: ModuleFactory.getAssemblies())<br>        return AppRouter(assembler: assembler, productConstructor: productConstructors)<br>    }</pre><h3>Implementation</h3><p>I know, it’s a long journey, isn’t it? :)</p><p>Here we are! Now we can show the any registered page by using this 1 line of code.</p><p>In Any router class, let’s navigate to history page.</p><pre>appRouter?.presentModule(PageModule.history, parameters: [:])</pre><h3>Closing Statement</h3><p>This is not a perfect example to use the dependency injection into Routing mechanism, let’s use this for reference only.</p><p>You also can use <strong>Swinject </strong>to make it more effective.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb390db66930" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Create New XCode Project]]></title>
            <link>https://leowirasanto.medium.com/how-to-create-new-xcode-project-b560ad4a869?source=rss-d884a6f91f87------2</link>
            <guid isPermaLink="false">https://medium.com/p/b560ad4a869</guid>
            <category><![CDATA[new-xcode-project]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[xcodetutorial]]></category>
            <category><![CDATA[project-news]]></category>
            <dc:creator><![CDATA[Leo Wirasanto Laia]]></dc:creator>
            <pubDate>Tue, 13 Apr 2021 12:12:10 GMT</pubDate>
            <atom:updated>2021-04-13T12:12:10.859Z</atom:updated>
            <content:encoded><![CDATA[<h4>Creating a new xcode project less than 3 minutes</h4><p>Hi Folks, hazit goin? In my previous <a href="https://leowirasanto.medium.com/how-to-start-ios-development-c4bd03fb8f57">story</a>, I posted the guide to help you if you want to begin develop ios app. If you are really new with iOS development, please kindly read my previous story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DB-0XV2d1kRMUi1-A3JFdg.jpeg" /></figure><p>In this story, I want to share how to start create a new XCode project and I promise I’ll make it simple but easy to understand. Before we start, please make sure you already install the XCode app on your mac, if done let’s lock and load!</p><h4>Let’s Start Here</h4><ul><li>Open your xcode app and if this dialog appear choose <strong><em>Create a New Xcode Project.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZFPaI_BsQrniJpsTsYQmg.png" /></figure><ul><li>Okay, now the option is pretty much. Don’t get confused, let’s stick with the plan “<em>Create a new xcode project for ios app development</em>” :D. Just select <strong>App </strong>and tap <strong>Next</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TiB-hjegCyN5V_4VOw3OGQ.png" /></figure><ul><li>You’ll see the form to give the information of your project such as the <em>product name, team, organization identifier, interface, lifecycle, and language.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YSN7oxlkDixVVSx1dgg6Ug.png" /></figure><p>Now, let’s breakdown each of the form :</p><p>—<strong> Product Name:</strong> <em>just fill it with your project name, for example </em><strong><em>MyFirstProject</em></strong><em>. I recommend to use the camel case with the naming.</em></p><p>— <strong>Team:</strong> <em>for this case you can </em><strong><em>leave it as it is</em></strong><em>. You’ll need it if you want to publish your app. But we don’t need it for now.</em></p><p>—<strong> Organization Identifier:</strong> <em>fill it with your identifier/your unique id like your company name or your personal unique id, for example </em><strong><em>tokopaedi.</em></strong></p><p>—<strong> Bundle identifier:</strong> <em>it will shows the combination of the product name and organization identifier. This is the id of your project.</em></p><p>—<strong> Interface: </strong><em>choose the type of interface you want, there will be two option (StoryBoard/SwiftUI). For this case let’s proceed with </em><strong><em>StoryBoard</em></strong><em>.</em></p><p>—<strong> Life Cycle: </strong><em>leave it as it is because we are using </em><strong><em>UIKit App Delegate</em></strong><em> for starting the this project</em></p><p>—<strong> Language: </strong><em>there are two languages you can choose (Swift/Objective-C), but let’s start with </em><strong><em>Swift</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ngxzh8ohBn9E1jzBlpETZw.png" /></figure><ul><li>After filling all the forms, tap on <strong>next</strong> button, and choose the location of the project you want to save and tap <strong>create.</strong></li><li>Finally! we reach the section of this article, if you already see this view then you are all set.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P0Zv_1z7FzccPHhgbd5OOw.png" /></figure><h4>Closing</h4><p>Since this story is about how to create a new project, so I don’t include the sample run result of the project here yet.</p><p>Let’s continue with start run the project and make a thing in your new project on my next post.</p><blockquote>See you!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/0*RrQcAGciTJRrCvu7.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b560ad4a869" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to start iOS development?]]></title>
            <link>https://leowirasanto.medium.com/how-to-start-ios-development-c4bd03fb8f57?source=rss-d884a6f91f87------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4bd03fb8f57</guid>
            <category><![CDATA[beginner-guide]]></category>
            <category><![CDATA[ios-developer]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Leo Wirasanto Laia]]></dc:creator>
            <pubDate>Thu, 08 Apr 2021 10:34:58 GMT</pubDate>
            <atom:updated>2021-04-08T10:34:58.205Z</atom:updated>
            <content:encoded><![CDATA[<h3>OPENING</h3><p>I understand if you confuse where to start to learn the iOS development, just like me. I don’t say this is easy but I don’t wanna say it’s hard either because I know how it feels to be the beginner programmer.</p><p>Before you continue, please understand that this is just my version of how to start the iOS development and I believe there will some flaws. But if this helps you, why not to try?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Faw3AtfVzhnP2qZn22mBdA.png" /></figure><h3><strong>THE STEPS</strong></h3><p>Without any further do let’s start from the point number one :</p><h4><strong>Prepare your weapons!</strong></h4><p>No, it’s not a war. Weapon means the device you use to develop the iOS program such as <em>Macbook, iPhone device</em> (it’s optional, you can use ios simulator instead) &amp; your <em>willingness</em> hehe.</p><h4><strong>Collect &amp; Read some references related to iOS development</strong></h4><p>Yep, I started to learn iOS development by reading some references from the website like <em>raywenderlich.com, medium.com, udemy, stackoverflow </em>(the most common thing that developers should know :v), etc.</p><p>Here’s the example of what I read when I started learn iOS development → <a href="https://www.raywenderlich.com/6338-swift-tutorial-part-1-expressions-variables-and-constants">https://www.raywenderlich.com/6338-swift-tutorial-part-1-expressions-variables-and-constants</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhZP8OAr7jPkjaj6GaHmuQ.png" /></figure><p>It explains the very basic things in iOS development by using Playground.</p><h4>Start create a simple project</h4><p>Don’t just read, implement it!</p><p>You can start by create a very simple project like showing a Hello World text, and then playing with the text properties in the xib files <em>(change color, background color, text style, etc)</em></p><p>I will create a new story about how to create a simple project for the more specific version soon.</p><h4>Learn the lifecycle of iOS Application</h4><p>It’s very important to know, because the application lifecycle will helps us to understand the app behaviour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xyfPDM-5QH-WDTCQ.jpg" /></figure><p>For example, there is a method named <strong>applicationDidEnterBackground </strong>which is called when the app enters the background state. In that method we can implement something to handle anything we need based on our app requirement.</p><h4>Get to know about navigation in iOS</h4><p>Mostly, all the apps need this thing. Yes! it’s the navigation. It’s the condition if you have more than one page and you need to move from current page to another page.</p><p>In iOS, there are three styles of navigation such <em>hierarchical navigation, flat navigation &amp; content driven navigation. </em>Please refer to this link for more details <a href="https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/navigation/">https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/navigation/</a>. In the implementation you will use <em>present </em>or <em>push </em>code. Please wait for the specific article about this ya.</p><p><strong>Try create a view that show list of data</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x1UB1K3ePUxkanFR.png" /></figure><p>In this step, you will learn to use the <em>UITableView</em> or <em>UICollectionView</em>. Contact list is one of the example of <em>UITableView</em> implementation.</p><p>How about the <em>UICollectionView</em>? Usually it used on the customized view like grid view or the carousel view and for the nearest example is your gallery/photos page.</p><p>The component if this view is <em>cell, </em>if it’s using <em>UITableView </em>then use <em>UITableViewCell </em>and if it’s using <em>UICollectionView </em>then use <em>UICollectionViewCell. </em>Those views usually called the reusable view, because we use the same view for different element of data.</p><p>For more information about this step, I will make the simple tutorial soon. :)</p><h3><strong>CLOSING</strong></h3><p>That’s how I start learn how to understand the iOS development and I hope this article may helps you too.</p><p>There will be another article related to the steps above for more details. Please do not hesitate if you have any concern with this article or just leave a clap if you feel this helpful.</p><blockquote>Thank you!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4bd03fb8f57" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>