<?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 Raissa Nucci on Medium]]></title>
        <description><![CDATA[Stories by Raissa Nucci on Medium]]></description>
        <link>https://medium.com/@raissa.nucci_15126?source=rss-cf24b963ae9e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4s3K0zFhddYH6kWVHvBxgg.jpeg</url>
            <title>Stories by Raissa Nucci on Medium</title>
            <link>https://medium.com/@raissa.nucci_15126?source=rss-cf24b963ae9e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 10:01:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raissa.nucci_15126/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[Hack your heart out]]></title>
            <link>https://craft.faire.com/hack-your-heart-out-f4d7dc7eba24?source=rss-cf24b963ae9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4d7dc7eba24</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[hack-week]]></category>
            <category><![CDATA[team-culture]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[faire]]></category>
            <dc:creator><![CDATA[Raissa Nucci]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 16:01:51 GMT</pubDate>
            <atom:updated>2023-06-13T16:01:51.214Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we bring our company together for a week of innovation and team building</h4><figure><img alt="A graphic illustration showing an “H” logo in the center of the image, surrounded by a star and a globe icon, with the text “Hack Week” written at the top. At the bottom of the image, the left hand corner shows the text “Dec 14–21,” the middle shows the Faire logo, and the right hand includes the text “2022.”" src="https://cdn-images-1.medium.com/max/1024/1*jqX8xRLpKVZQ8DB6Yqk86g.jpeg" /></figure><p>From both my personal experience and talking with multiple colleagues, I’ve learned that a passion for solving problems and learning new skills by getting your hands dirty and actually doing the work are common traits of those who choose a career in engineering. We may not be hackers in any official (or unofficial) job title, but there’s something about the hacker spirit that we relate to.</p><p>As people who love this kind of in-the-weeds, hands-on exploration, we’re constantly thinking of new ideas we’d love to prototype, tools we’d love to build to improve the efficiency of tedious tasks, projects we’re passionate about but haven’t had a chance to prioritize, and a growing list of new technologies we’ve seen bubbling up in the industry and are dying to test out. If only there was time…</p><p>That’s essentially the idea behind Faire’s Hack Week — one of my favorite company rituals designed to encourage anyone and everyone to lean into their hacking instincts. Keep reading to learn about Hack Week, how it works, and why so many Fairefolk look forward to it all year long.</p><h3>What is Hack Week?</h3><p>Hack Week, as the name suggests, is a company-wide, multi-day (also known as a week) hackathon that Faire runs near the end of the calendar year. During this time, the entire company — not just engineers — focuses on taking feature ideas, automation, tools, and pet projects from the realm of ideas and bringing them to life. The time reserved for Hack Week is sacred, and is full of rapid prototyping, creativity, and exploration. We set aside our usual work across the company, creating the time and space to work on our hack projects.</p><p>Everyone gets to decide what they want to work on for the week within a few parameters. We’re empowered to choose projects that interest us personally, from long-imagined projects we’ve never had the time to explore to brand-new ideas pitched by others.</p><h4>The ultimate mission of Hack Week is to bring Fairefolk together to drive value to our business through:</h4><ul><li>Working on new innovative and creative projects that bring incremental value to the company</li><li>Fostering cross-team connection and collaboration</li><li>Empowering individuals to grow professionally by offering them new opportunities outside of their daily roles</li><li>Building company culture and morale through a moment of fun and togetherness</li><li>Encouraging learning and building new skills</li></ul><p>Every year, there is a lot of company excitement around the event. Hack Week isn’t only about producing the best “hack” or project. It’s also about group energy, passion, and contagious enthusiasm. It’s about executive leaders joining teams and hacking alongside everyone else. It’s about boosting team spirit. And obviously, it’s also about winning.</p><h3>Why Fairefolk all want to participate: camaraderie and prizes</h3><blockquote>“It’s the most fun week of the year! One week of pure joy and love.”</blockquote><p>I often hear this sentiment when I ask colleagues what they think about Hack Week. Personally, I couldn’t agree more. Each year, the event is elevated and is better than the year before: more fun, more prizes, and more opportunities to build something really cool. It’s also a great way to unwind and have fun as a company.</p><p>More than anything else, getting to know and collaborate with new people is a core reason why many Fairefolk actively participate in Hack Week. Folks are encouraged to form teams encompassing many functional areas and expertise, and people are free to join whatever project that interests them. We’re given the opportunity to work with colleagues we might’ve never worked with in normal circumstances, and such collaboration can be enlightening.</p><p>Of course, winning and prizes are also big motivators for participating! The final voting period and closing ceremony are especially exciting, as the top 5 most voted hacks of the week present their (usually very funny) pitches live, and everyone in the company votes in real-time to choose the big winner. There is a certain thrill to watching hundreds of people vote on a project you put so much effort into and identify with personally. Simply put, for someone like me, it’s exhilarating.</p><p>Winners from all categories are eligible to win a prize — which usually consists of exclusive Hack Week items, like a t-shirt, stickers, water bottles, and other coveted swag. Every time you wear that exclusive swag or drink from that water bottle, it’s a reminder of how great that year’s Hack Week was — and the impactful project you worked on.</p><p>Last but not least, there is always the very real chance that your project will get adopted and go into production to serve Faire’s customers, or help your colleagues on a daily basis, bringing tangible value to the company. At a company full of mission-driven people, a friendly competition like Hack Week can be a great way to surface new ideas and push people to do their best work.</p><figure><img alt="Two mobile phone screens shown side by side, showing the Faire checkout cart experience with checkout for multiple brands at one time." src="https://cdn-images-1.medium.com/max/1024/1*480WXAwU2Ff-2sokyQH4QA.png" /><figcaption><em>Our mobile cart design was influenced by work done during Hack Week.</em></figcaption></figure><h3>Tips for selecting a Hack Week project</h3><p>Okay, this is all really exciting and now you’re hyped and ready to hack for a week. But how do you choose a project? How do you define a good hack, one that’s worth your time and attention for an entire week?</p><p>To help spark inspiration during the project ideation phase, Hack Week organizers define specific categories and themes. One winner is selected from each of the special categories.</p><h4><strong>Some of this year’s top category examples:</strong></h4><ul><li>Cutting-edge ML using GPT-3</li><li>Weather the storm (recession tools for our customers)</li><li>“There’s an app for that!”</li><li>Tools to make developers’ lives easier</li></ul><p>We consider good hacks any project that adds value to Faire and can potentially lead to meaningful business results. That covers everything from prototyping what a consumer experience might look like and building tools that can make your or someone else’s job at Faire easier to refactoring nightmarish code or improving an experience to building missing dashboards.</p><p>Below are some common categories of valuable hacks to draw inspiration from:</p><h4><strong>Refactors &amp; internal tools:</strong></h4><ul><li>Pick an area of the codebase that gives you goosebumps (not the good kind) every time you stumble upon it, and fix the issue.</li><li>Make duplicated code reusable.</li><li>Save someone time by building tools to automate manual tasks.</li></ul><h4><strong>Experiment with cutting-edge technology:</strong></h4><ul><li>Explore how an exciting new technology can be applied to solve an existing business problem.</li><li>Try out new machine learning methods to address business needs.</li><li>Push the envelope by exploring new AR use cases for our customers.</li></ul><h4><strong>Platform-specific features and improvements:</strong></h4><ul><li>Explore platform capabilities and enhance the experience for a subset of our users to give us an edge over our competitors.</li></ul><h4><strong>Customer features/impact:</strong></h4><ul><li>Address user needs that you are passionate about.</li><li>Draw inspiration from customer support tickets to help improve common customer pain points.</li></ul><figure><img alt="An image showing a standard sunglass product photo on the left, with a white background. On the right, a series of four AI-generated photographic-like images show four different people wearing the same pair of sunglasses." src="https://cdn-images-1.medium.com/max/1024/1*69MFyumtn1iC80r-MteyvA.png" /><figcaption><em>An example from a previous year’s Hack Week project, which shows how machine learning could be used to turn a static product image into a variety of photography-like images, helping brands on Faire to generate more engaging product illustration assets without investing in photography.</em></figcaption></figure><h3>What it takes for a successful week: advice from previous Hack Week winners</h3><p>Selecting a cool project and assembling a dream team is just the tip of the iceberg of ensuring your Hack Week experience is a success. Successfully creating a functioning deliverable or well-defined idea by the end of a week requires a lot of hard work and focus (and of course, a lot of fun).</p><p>We asked some of our past event winners, including <a href="https://www.linkedin.com/in/luan-nico/">Luan Nico</a>, <a href="https://www.linkedin.com/in/mpdifranco/">Mark DiFranco</a>, <a href="https://www.linkedin.com/in/everettdale/">Dale Everett</a>, and <a href="https://www.linkedin.com/in/gordon-winch/">Gordon Winch</a>, for their top tips for a successful Hack Week. Here’s some of what they shared.</p><h4><strong>Project and team organization</strong></h4><p>The most important element to running a successful Hack Week is team and project organization. You need to broadly outline the problem you want to solve and the strategy you will use to solve it, but also leave room and flexibility to ensure that your teammates still have a high level of autonomy to explore and bring their own perspectives to the table.</p><h4><strong>Project management</strong></h4><p>Throughout the week, good project management is key. Clearly define the project scope at the start of the week: What is the team aiming to get done? What is actually feasible in a week? What are the tasks that need to be executed to get there? Previous winners reported they usually do quite a bit of research beforehand to ensure the project is technically viable and a good use of the team’s time and resources.</p><ul><li>Define who is doing what. Clear division of labor is fundamental as everyone is moving fast, and we don’t have time for stepping on each other’s toes.</li><li>Once everyone is clear on their role, quickly move into execution mode. Frequent syncs are fundamental to ensuring everyone is on the same page, and an important way to quickly troubleshoot and unblock one another. Also, regular check-ins create good opportunities for human connection, keeping things light and the team’s energy high.</li></ul><figure><img alt="A GIF showing Faire’s boards on a mobile device. When a user clicks “Add to cart” a shower of confetti is animated on the screen." src="https://cdn-images-1.medium.com/max/352/1*BMK0D-l00XfYK6CkFXK5lQ.gif" /><figcaption><em>Faire’s boards, which enable brands to create curated visual collections of products, were originally a Hack Week idea.</em></figcaption></figure><h4><strong>Focused scope</strong></h4><p>Focusing on the most impactful elements of your project is key. Too big of a scope, and you risk not completing your project in time — too narrow, and your team might not feel empowered to explore and try new things. Ensure the team is aligned on a clear and realistic expectation of what you aim to achieve by the end of the week. There is only so much that can be done in a few short days. Great project ideas are important, but they are worth nothing if the team is not able to focus and prioritize the most impactful tasks.</p><h4><strong>Autonomy</strong></h4><p>Hack Week participants thrive on autonomy and truly need it to succeed. Members of a team should be empowered to pursue whatever part of the project that interests them, even if it means it’s beyond their expertise. We foster a supportive culture at Faire and value continuous learning. A successful Hack Week team is one that enables people to explore, learn, and exercise a growth mindset. Passionate people produce great results.</p><h4><strong>Marketing</strong></h4><p>Project demos and voting are a big part of Faire’s Hack Week, so a good marketing strategy can help your team go a long way. A winning team is one that can present the business case for why Faire should adopt their hack and can grab and captivate the audience’s attention. Building a user friendly project page, filming a creative demo video, and infusing some fun into your narrative are all part of the hack. This is the perfect opportunity to develop some marketing and influence skills (it’s also a great change to put on your filmmaking and director hats).</p><h4><strong>Follow the deploy/merging guidelines</strong></h4><p>No one wants a half-done/half-mocked MVP hack launched to customers. All teams need to ensure their hacks are isolated, in a controlled environment, and easy to clean up afterward if needed. Changes should always go behind settings, PR reviews continue to be mandatory before merging to master, and deploys should focus on our staging environment. Mobile and web hacks are usually implemented on feature branches for isolation.</p><h4><strong>Have fun along the way</strong></h4><p>Fun is the name of the game during Hack Week. Keeping things light and having an informal attitude is the real key to success during this fast-paced, all-hands-on-deck, week-long sprint. Make sure to reinforce that teams should enjoy the entire Hack Week journey and that there are many opportunities to infuse some fun — especially during the demo phase! For example, during this year’s Hack Week the AR (augmented reality) project team scanned one of their team members into a 3D model and asked the audience to guess which of the people showing on the screen was real and which was AR.</p><figure><img alt="A GIF showing a scroll through Faire’s year-in-review recap. Text “You discovered 41 new brands” is shown then replaced by text “And reordered form 23 of your favorites” as the viewer scrolls, and photos of various products from Faire are shown in the background, including a candle, a leather purse, a plant, a thank you note, and more." src="https://cdn-images-1.medium.com/max/600/1*cuYWi9S09zjC23KBM-6f7w.gif" /><figcaption><em>Faire’s year-in-review recap for retailers was inspired by a Hack Week project.</em></figcaption></figure><h3>Beyond Hack Week</h3><p>Today, many of the features and products on Faire’s platform started as Hack Week projects. The impact and value of these hacks was so apparent that the company prioritized investing in them beyond Hack Week.</p><p>For example, our retailer mobile app cart design, boards functionality for saving products and visualizing how they’d look together (like a storefront), a Spotify Wrapped-style year in review, bulk invoice download tool for our ops partner, and our newly released brand mobile app are just a handful of examples of Hack Week projects that have become permanent elements of the customer experience.</p><p>Even if the project doesn’t get entirely launched to our customers, it can still live beyond Hack Week. In 2021, the “We Love Faire” team collected localized testimonials from users in different countries as a part of their project — and although we didn’t launch the project to our users, the team learned some valuable insights that were used in later features.</p><p>I encourage you to participate in your company’s next Hack Week, or take a stab at launching one if it doesn’t already exist. When you invest your time, creativity, and energy into exploring, growing and building new things, chances are your hack, your efforts, and your impact will live on well beyond Hack Week. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4d7dc7eba24" width="1" height="1" alt=""><hr><p><a href="https://craft.faire.com/hack-your-heart-out-f4d7dc7eba24">Hack your heart out</a> was originally published in <a href="https://craft.faire.com/">The Craft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI — The Faire way.]]></title>
            <link>https://craft.faire.com/swiftui-the-faire-way-a8c702999195?source=rss-cf24b963ae9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8c702999195</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[Raissa Nucci]]></dc:creator>
            <pubDate>Thu, 04 Mar 2021 00:01:58 GMT</pubDate>
            <atom:updated>2021-08-03T23:16:31.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RLsbq29w_DY44rK-GxaDYw.jpeg" /><figcaption>Faire HQ in San Francisco</figcaption></figure><h3>SwiftUI — the Faire way</h3><h3>The whys and hows on Faire’s adoption</h3><p>If you read my previous <a href="https://medium.com/faire-the-craft/think-twice-before-scaling-your-app-with-interface-builder-90214ebdb12a">post</a>, you’ll remember we came to the conclusion of building UI in code. Code based UI solves a lot of common problems of a scaling team, such as merge conflicts, code reviews, localization, componentization, etc.</p><p>While straight forward view code is a completely valid strategy, we instead made a move some would consider rather bold: we started integrating SwiftUI into our production code.</p><p>Let’s take a look how we came to that decision, how we are adopting the new framework on an existing UIKit based app, and what our plan for the future looks like.</p><h3>How we decided to give SwiftUI a try</h3><p>It was clear to the team that relying on Interface Builder was not scaling well and we needed a code-based solution. The initial thought was to adopt UIKit + Auto-layout view coding combo, and so we did as an immediate solution to avoid new XIBs and with them further complexity on maintainability.</p><p>However, SwiftUI still fresh out of the oven and since the beginning we felt strongly that Apple would be putting most of their efforts and focus on the new framework in the future. We wanted to give it a try and experiment with it, however, we knew the framework was still very young, with little documentation, many rough edges and maybe not yet ready for production on stable apps. We needed to have it tested before taking the chance of adopting it into our core business app.</p><p><strong>The opportunity came with the requirement for new apps to be developed as proof of concept/MVPs.</strong> Those would be much simpler apps, with way less features and product complexity and would be initially used by a restricted number of users. It was the perfect opportunity to test the framework in a real world app (more complex than the single screen calculator of tutorials) but yet in a controlled environment that wouldn’t represent much risk to the company.</p><p>And so we did. We used SwiftUI on those apps, came across its many pitfalls and worked around them, finding solutions that worked for our context and were tested proven to work and handle our specific needs. <strong>Meanwhile, we also ran an analysis on the impact of dropping iOS versions prior to 13 (since SwiftUI is only supported for iOS 13 and above)</strong> to our users and how much that would impact our business, weighting this against the benefits SwiftUI would bring as well as the other improvements iOS 13 brings to iOS development.</p><p>Long story short, those apps were released successfully to users very quickly, we gathered great experience and came up with production ready patterns to integrate and work with SwiftUI. Our analysis showed the wins were worth the risk of making our main app iOS 13+. We realized we only had around 2% of our users running either iOS 11 or 12, while around 80% had already updated to iOS 14. Thus, we created a battle plan to integrate it into our main Retailer app</p><h3>The benefits</h3><p>Among the benefits that weighted in favour of adopting the framework we can highlight</p><ul><li>It is the future. Apple will more and more develop the framework and it will one day become the Apple way of developing not only UI but apps (as seen with the new additions on iOS 14 and the framework that came along with SwiftUI such as Combine and Property Wrappers). We might as well start now</li><li>Live Previews and prototyping! With live previews we can see the changes on code reflected on the UI on canvas in real time, which can save quite a lot of time compared to standard UIKit view coding.</li><li>Declarative paradigm is great for maintainability and readability. It tends to make the code representing the view smaller and it’s hierarchy matches the UI layout’s hierarchy, great help for readability and maintainability.</li><li>Lightweight. SwiftUI views are not concrete representations of the actual pixels on screen but rather &quot;instructions&quot; for what to draw. SwiftUI also automatically reuses its views as much as possible</li><li>It is based on componentization, therefore, made for reusability</li><li>All the benefits of a code-based UI development: easy merge, easy code review. Localization and standardizations are made easy with string files and style palette structs.</li></ul><h3>The pitfalls</h3><ul><li>It is still a very young framework, still with some bugs, missing components and functionalities. It doesn’t have an extensive documentation as it’s not yet been largely adopted in scale. This means we won’t find answers for most of the problems we face as there aren’t many people yet facing them.</li><li>Different development paradigm: declarative, functional and reactive. Can have quite a steep learning curve before developers can feel comfortable working with it.</li><li>Navigation is quite complex. It is wonderful to build view components to be reused, however it can be quite a nightmare once you dive into a more complex app context with navigation, different functionalities on the same screen, communication between different screens.</li><li>Its new paradigms can lead to bad architectural patterns if we are not careful, as SwiftUI can somewhat blur the lines between the view layer and business layer.</li></ul><h3>Faire’s Way on SwiftUI</h3><p>In our perspective, SwiftUI still has a lot to mature before it can be the one way for UI and app development on iOS. Therefore, UIKit is still far from being completely replaced in our apps. At the present state of the art, we see <strong>UIKit and SwiftUI as being complementary to each other</strong>, where there are situations where relying on one makes more sense than the other and vice-versa.</p><p>The Faire Way is thus a hybrid approach, where we still rely on UIKit to handle most of the apps complexity (navigation stack, communication between different features, app lifecycle) and take advantage of the benefits of SwiftUI when building new view components, cells and even new screen UIs.</p><p>This approach allows us to gradually adopt the new framework, relying on it on more controlled scenarios where we know it performs well, having alternatives for functionalities still missing in the framework and also, doesn’t force us to dive into a full migration, where we would rewrite the entire app (who knows how long it would take and the problems we would face) replacing well tested and proven to work code with new still in development framework.</p><h3>What does this hybrid look like?</h3><p>Fortunately for us, Apple has foreseen the need for interoperability between UIKit and SwiftUI and provided us most of the tools needed to make it work.</p><p>This integration can work in both directions: UIKit used within SwiftUI and SwiftUI used within UIKit.</p><p><strong>UIKit to SwiftUI</strong><br>This approach can be used whenever one would like to reuse existing UIKit view components in a new SwiftUI view.</p><p>Using a UIKit view in a SwiftUI layout can be achieved by wrapping it into a UIViewRepresentable bridging instance. <em>UIViewRepresentable</em> is a protocol with 2 basic methods to create a bridging type wrapping UIKit views into SwiftUI-compatibles. These methods are used for creating the view <em>makeUIView</em> and updating it <em>updateUIView</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f55b7a489e1f1b1fe0181753b4ae31b/href">https://medium.com/media/2f55b7a489e1f1b1fe0181753b4ae31b/href</a></iframe><ul><li>We should always create views lazily on <em>makeView</em> because SwiftUI will reuse that view as much as possible even when the wrapper is recreating, meaning we could get to weird state situations by not having some state updated on recreation.</li><li>UI updates for state changes should therefore be handled on <em>updateUIView</em> method</li><li>If we need to have any type of state in the wrapper, it should be controlled by a <em>Coordinator (makeCoordinator)</em> since the wrapper itself can be destroyed at any moment and lose that state. A <em>Coordinator</em> can keep the state even if the wrapper gets destroyed, in a 1:1 relationship.</li></ul><p>Note: There is also a <em>UIViewControllerRepresentable</em> protocol that can be used to present <em>UIViewControllers</em> from a SwiftUI view. The idea is the same as for <em>UIViewRepresentable</em>. We won’t get into details since it doesn’t apply much to our specific context.</p><p><strong>SwiftUI to UIKit</strong><br>This pattern is used for adding newly created SwiftUI components into an already existing UI hierarchy, for example a new cell in a table view. Those are very common scenarios in our context, since we are always expanding our existing features. We defined that all of our new view components (and cells) should be developed in SwiftUI.</p><p>To do so, we wrap our SwiftUI views into <em>UIHostingController&lt;View&gt;</em>, which takes our SwiftUI view as its rootView. It can be used as any View Controller.</p><p>In the context of components, we need to make sure to add the wrapping <em>UIHostingController</em> as child of the underlying View Controller, add its <em>rootView</em> as subview and constrain it using auto layout.</p><p>In order to reduce duplication of that code, we created a wrapper around our most common scenario: table view cells (<a href="https://noahgilmore.com/blog/swiftui-self-sizing-cells/">reference post</a>)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6713b7004b9f5f7d2d4ac197c68330b0/href">https://medium.com/media/6713b7004b9f5f7d2d4ac197c68330b0/href</a></iframe><p>As mentioned before, <em>UIHostingController</em> should be treated the same as any View Controller. We wrap our full screen SwiftUI views in a UIHostingController in order to integrate it with our UIKit code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1bd4f4c9af2c331e537eb7c809707be/href">https://medium.com/media/d1bd4f4c9af2c331e537eb7c809707be/href</a></iframe><ul><li>SwiftUI views have data based content controlled by a single source of truth and react to changes in it.</li><li>That state is usually represented by:</li><li><em>@State</em> private property: view’s internal state, owned by the view and should only be updated by it (ex: is expanded state).</li><li><em>@Binding</em> property: a two-way connection to a state owned by someone else. Can be updated by both and changes to it will trigger updates on both views. State between views, owned by views.</li><li><em>@ObservedObject</em> property: binding to a reference type managed outside the view layer (usually the equivalent of a ViewModel). Objects marked as <em>@ObservedObject</em> need to implement ObservableObject protocol and have properties defined with the @Published property wrapper, indicating which properties trigger observation notifications when changed. <em>@ObservedObject</em> properties can be converted into binding ($).</li><li>Changes on state should be triggered in the MainQueue, as any layout updates on UIKit.</li></ul><h3>What about Architecture?</h3><p>Something important to keep in mind, specially in this progressive migration approach is that <strong>SwiftUI should only affect and lead to changes on the UI layer of your app</strong>. If the general architecture of your app follows the basic principles of Clean Architecture, SOLID and Modularization (more on that in a coming article, stay tuned!), you shouldn’t need to touch your data/repository/infrastructure or business logic/use case layer.</p><p>When it comes to the UI layer, there are other things to be considered before discussing any existing patterns: SwiftUI brings with it its own paradigm, with its declarative way of defining views and the reactiveness with Combine. Given that, it feels a bit strange to try a direct translation between the existing UI design patterns (MCV, MVVM, MVP, etc) to SwiftUI design patterns.</p><p>All that set aside, SwiftUI naturally comes with some sort of MVVM built in, with <em>@State</em> properties taking the role of the ViewModel for very simple views and <em>@ObservableObjects</em>, which can be individual ViewModel implementations, on more complex views. In that sense, it resembles the classic MVVM, therefore, applications already using that pattern tend to have a simpler adaptation when progressively migrating to use SwiftUI.</p><p>As a matter of fact, that was exactly the scenario we faced on our adoption of SwiftUI at Faire. Our app already relied on MVVM as our UI layer pattern, therefore, we’ve all been used to developing under it, moreover, having a pretty natural adaptation to developing on a somewhat similar pattern upon our SwiftUI adoption. As our ViewModels didn’t have any dependency on UIKit (as it should be), it was fairly easy to have the SwiftUI views take those same ViewModels.</p><p>We are, however experimenting with some changes, to allow us a better understanding and compliance to the new paradigms introduced. Of course we had to swap all our delegates and callback to view updates to Published properties. We are also experimenting with Combine to facilitate communication with UIKit, as a replacement for the delegation pattern. We’ve been playing around with action based state changes, by adding Events to our ViewModels to be triggered by the Views, resulting in State changes (Published property). Nevertheless, we are still experimenting, meaning <strong>we haven’t found our sweet spot yet</strong>, the pattern we believe fulfils all our project needs when it comes to SwiftUI and it’s introduced paradigms. No need to worry though, we plan on having an article dissecting it when we get to that spot.</p><h3>Some Faire considerations</h3><ul><li>What we did and what we’d recommend to start introducing SwiftUI to an existing UI project is to start with the new screens and components.</li><li>As a rule of thumb, we would leave most of the complexity, specially regarding the apps navigation stack to UIKit. We are relying on SwiftUI to components (views and cells) and some entire screens, but still keeping everything constrained to UIViewControllers.</li><li>We are using UIKit for features where infinite scrolling is required. This is because we need the scrolling to be performant, therefore relying on DataSourcePrefetching (UITableView, UICollectionView) to seamlessly load each page.</li><li>For the reason above and because LazyH/VGrids are only supported on iOS 14 and considering iPad support, most of our lists will be either created (if new) or migrated to UICollectionViews using compositional layout.</li><li>As of yet, we have not noticed any performance issues related to HostingControllers on our TableView Cells.</li><li>We don’t use @State properties on SwiftUI views used as UITableViewCell (using UITableViewCell with UIHostingController). As the state is kept even when the wrapper is destroyed, UITableView cell reusability doesn’t work well with @State properties, leading to inconsistent states.</li><li>We are building reusable layout components and expanding our UI library. That also includes creating Styles for button and custom ViewModifiers to help us reduce code duplication.</li><li>For SwiftUI to UIKit communication (something on SwiftUI triggering a new view controller push for example) we still have not settled on a defined pattern. But in general, we are trying to keep the communication as unidirectional as possible, with the SwiftUI view communication solely with its ViewModel and the ViewModels transmitting the messages to the UIViewController when needed. We have not yet decided on that last bit happening through a good old delegate pattern or through a more reactive approach with combine.</li></ul><p>If you’d be interested in a follow up article with more details on how we are designing our ViewModels, updates on performance and communication patterns, make sure to leave a clap on this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8c702999195" width="1" height="1" alt=""><hr><p><a href="https://craft.faire.com/swiftui-the-faire-way-a8c702999195">SwiftUI — The Faire way.</a> was originally published in <a href="https://craft.faire.com/">The Craft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Think twice before scaling your app with Interface Builder]]></title>
            <link>https://craft.faire.com/think-twice-before-scaling-your-app-with-interface-builder-90214ebdb12a?source=rss-cf24b963ae9e------2</link>
            <guid isPermaLink="false">https://medium.com/p/90214ebdb12a</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[storyboard]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[interface-builder]]></category>
            <dc:creator><![CDATA[Raissa Nucci]]></dc:creator>
            <pubDate>Wed, 09 Dec 2020 21:57:19 GMT</pubDate>
            <atom:updated>2020-12-09T21:57:19.071Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPXPb7QwZB52U5-BfJ1ZEw.jpeg" /><figcaption>Faire Mobile App</figcaption></figure><p>At Faire, everything we do aims to be the best. The best place for local retailers to go to find amazing products to their stores, organize their purchases and take safe risks. The best place for brands to merchandise their unique products and reach thousands of retailers. And, of course, be a <strong>first class technology company</strong>, with products that delight our customers through <strong>leading technology</strong>.</p><p>It couldn’t be any different for our iOS native app. We wanted to offer our retailers the best shopping experience they could get natively, taking advantage of what the system has to offer to bring clear designs, intuitive experience and top performance. However, as it is the case for any startup trying to hit the market on a timely manner, we had a strong constraint: time. We wanted to get the app out there fast, to prove its traction and the impact it could have on our ecosystem.</p><p>Even with tight deadlines, we made sure to keep a high level of quality. The decisions we made early on were a good balance between moving fast and setting up the app for future team growth. Those range from the right choice of architecture, to modularizing core aspects of the code to be reused, to building a UI framework guaranteeing reusability and consistency. Nevertheless, one decision <strong>did not scale</strong> that well: <strong>building views using Interface Builder (storyboards and XIBs)</strong>.</p><p>There were many reasons that led to relying on Interface Builder at the beginning. It was fundamental to velocity and prototyping, not only due to its intrinsic features, but also due to familiarity. However, as the product and team grew, we started to notice this approach would not scale. It would not fill our needs to keep the quality we wanted on our project. Although we successfully avoided the dreaded “Single Storyboard” pattern, we still got to a point where we had to <strong>make the decision of moving away from Interface Builder</strong> and adopting another approach for UI development.</p><h4>The TLDR;</h4><p>Interface Builder (XIBs and Storyboards) didn’t scale well as our project and team grew for many reasons, most of which would be solved by a code-based UI approach. After some analysis we opted to jump straight into SwiftUI to be our code-based tool for UI development. We are currently in a transition process, meaning we are progressively transitioning to use SwiftUI while still relying on UIKit for many things. More on how we made that progressive transition possible and how to integrate UIKit and SwiftUI in a follow up article.</p><h4>Code Review</h4><p>As the app continued to grow and become a bigger part of Faire’s business, we couldn’t afford any code going to production without a proper careful team review. With more people changing our layouts every day, as new developers joined the team, the chances of unwanted layouts or behaviour being introduced grew exponentially. With <strong>Interface Builder based layouts, it is quite difficult to give a proper code review</strong>. This is because Interface Builder used XML under the hood, which is difficult to review in a PR on GitHub.</p><p>It’s not unusual for developers reviewing PRs containing changes to Storyboard and XIBs to feel the need to checkout to the PR’s branch to make sure things look and behave the way they should, since they can’t be 100% sure just by looking at the raw XML changes. This means a significant amount of extra time spent reviewing and checking every PR with layout changes.</p><p>Meanwhile, <strong>if we were to have those layouts built on code, most of these problems could be avoided</strong>. Code is semantic, it has meaning. Every line of code changes has a clear meaning and purpose, <strong>easily readable and understandable</strong> by a developer reviewing it, which consequently leads to faster, more accurate reviews and easier and safer merges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IV7rweyHK0Ap6muB4wdDlw.png" /><figcaption><em>QuickAddView.xib — Interface Builder XML</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ot4U9S3ZNPkjAWRW9xyKHQ.png" /><figcaption><em>QuickAddView in SwiftUI</em></figcaption></figure><h4>Dynamic Layout</h4><p>In addition to reviews, with new features being added all the time, XIBs started getting really complex. With the same view having to display several different states, constraints started to become messy, with too many dynamic changes, as they depended on information only available in runtime. In this scenario, our <strong>XIBs quickly started to fall apart</strong>. Add to that the need for fairly sophisticated animations and Interface Builder won’t handle it anymore.</p><p>To get those dynamic layouts we would either end up with big complex XIB files, with many hidden views, trying to layout all possible states at once, or a basic one, with most of its features overwritten by code. Either option is not a good solution, when we think in terms of readability and maintainability of the project. The XIB would either be too complex to read and maintain, increasing chances of layout related bugs (once it is harder to understand, it gets easier to mess with something we are not sure of the purpose), or would no longer represent the reality of the displayed UI, and could most definitely lead to confusion and time spent trying to figure out how exactly that layout works.</p><p>In that case, having a <strong>swift file</strong> as the single source of truth for a specific UI and behaviour seems to be the best approach. The code on <strong>that file would always represent the actual state of the interface</strong>, and it can be easily maintained by taking advantage of all the basic software engineering principles for code maintainability. It would make it clear, in one centralized place, how the UI elements interact with dynamic content, making it understandable for anyone needing to apply a change to that piece of UI.</p><h4>Componentization</h4><p>Regardless of what people may think, <strong>componentization is not something trivial to achieve when using Interface Builder</strong>. Yes, it can be done with XIBs, however it can be quite hard. To begin with, for each and every component we need to write a gross initializer responsible for loading the view from the XIB.</p><p>Other than that, <strong>inheritance doesn’t really exist with XIBs</strong>, since we can only inherit its file owner — a.k.a. it’s code implementation. Although it is possible to inherit animations, content and user interactions (defined in code), all the actual layout needs to be re-built on two different XIBs files and all of its IBOutlets need to be individually re-linked.</p><p>The problems persist when changes need to be made. Imagine we would add a new label to one of these XIB files. When creating an IBOutlet Xcode would, by default, create this outlet as required, non-optional. With no warning that label would either need to be added to all the other XIB files inheriting from that File Owner or the outlet made optional. All instances of that one XIB would work just fine, while the <strong>app would crash</strong> on the first attempt of layouting any of its “siblings”. Specially for someone new to the project, these types of crashes can be <strong>quite difficult to identify</strong> and can cause some headache.</p><h4>Localization Effort</h4><p>As expected for a company growing as much as Faire, we want to go international. To do so, we need to make sure our native apps support multiple languages. Localization is something native to iOS since it’s first launches, however <strong>it doesn’t mean it’s easy to implement, especially when relying on Interface Builder</strong>. It can be done, but most of the options have strong downsides:</p><p><strong>1. Multiple Storyboards/XIBs, one for each language</strong></p><p>A nightmare for UI changes since they would need to be replicated for each language</p><p><strong>2. Extracting strings using ibtools</strong></p><p>Not automatic, the process needs to be repeated for each new string added.</p><p><strong>3. Create the new language localization in the Configuration’s pane and automatically Xcode creates a new Main.strings file inside the language folder</strong></p><ul><li>Strings file not updated when something changes on Interface Builder</li><li>Can’t use strings from other string files</li><li>Auto generated ids that have no meaning and make connecting the string to the piece of UI it relates harder</li><li>Spread out translations (one file for strings used on code, one file for strings on Interface Builder)</li></ul><p><strong>4. Overwrite strings set in the xibs in code.</strong></p><ul><li>This requires we make an IBOutlet for each label, which can be cumbersome.</li></ul><p>The best scenario would be to have all the <strong>strings centralized in one place</strong>, reusable throughout every screen, minimizing re-work. None of the above options seem to fulfill those requirements. However, <strong>code-based UI makes this easy</strong>.</p><h4>Standardization</h4><p>Design integrity and consistency is one of Faire’s trade marks. Therefore, keeping all screens cohesive, with a defined colour palette and standard spacings is something our native app should take into consideration.</p><p>While making sure all views use the same set of colours with Interface Builder is quite easy, the same cannot be said about making sure margins are set respecting a defined style. <strong>Margins and spacings need to be individually set for each Interface Builder file</strong>, which can easily lead to inconsistencies.</p><p>Those kinds of standards and centralization are much <strong>better enforced when using code to build layout</strong>, where default structs and constants can be defined with the appropriate values, in a semantic meaningful way, and used for every screen and every component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5UqLO3d573jXH5ArAXQTQ.png" /><figcaption><em>Margins standardization on code</em></figcaption></figure><h3>SwiftUI for scale</h3><p>After considering the above, we realized it was time to take a different approach on UI development. It felt natural to adopt a <strong>code based approach</strong>, where our views would have their layouts defined on their swift files, alongside all manipulations and animations. However, what would be the best way to make such a change?</p><p>Although we could simply start creating our views on code, taking advantage of the auto-layout APIs (available since iOS 6, made better on iOS 10), with Swift UI freshly launched, the team felt strongly against converting our current views to a pattern that would soon need to be changed again with SwiftUI’s broader adoption. We needed to understand the <strong>trade-offs</strong> between jumping straight into <strong>SwiftUI</strong> and taking its risks, as an evolving new framework, or converting everything to view code based layout just to change everything again in a few months.</p><p>We were convinced <strong>SwiftUI would be the best choice</strong>, and therefore, we did some testing and analysis to prove the theory. We analyzed how many of our users would be impacted by the required drop of iOS versions (SwiftUI is only supported as of iOS13), how much value those users were bringing to Faire, the features we had in our future roadmap and how they could be made better by adopting the framework. We also took the chance to test how ready for production SwiftUI was by putting it in use in a new app we developed. That test was of extreme importance as we were able to learn about the framework’s rough edges and ways to overcome them, as well as build some base knowledge that would be essential to ramp up the team later.</p><p>In the end, <strong>the pros overcame the cons</strong> by a great deal and we decided to adopt SwiftUI as the future of UI development on our iOS native app. It basically <strong>brings together all the benefits of view coding</strong>, fixing all the pitfalls we had been struggling with Interface Builder (it centralizes everything in code, making it easy to localize and standardize; componentization comes naturally as it would with any other piece of code; all the dynamic information to change the layout is available in the same place as the layout description itself; reviews and merges are just like reviewing any other file) <strong>with the benefits IB has</strong> (real time layout visualization; prototyping with previews).</p><p>Currently, our team is in the process of adding SwiftUI implemented views to the project, where it makes sense. We are all still learning as the framework evolves, and slowly introducing screens and components to the project written in it. <strong>This progressive adoption was made possible by integrating SwiftUI views into UIKit </strong>wrappers such as UIViewControllers and UITableViewCells. That possibility was fundamental for our decision since we didn’t want a full migration, since the framework is not yet fully mature. This allows us to take advantage of the goodies both frameworks have to offer, such as UIKit’s navigation and SwiftUI’s descriptiveness and states.</p><p>Although right now we are in the middle of a learning curve, meaning we are still taking a bit longer on these new screens/component’s development than what we would’ve with UIKit, <strong>we are sure we made the right decision</strong>. This change will allow us to <strong>overcome all of the XIBs limitations for a fast growing team</strong>, project and company, and will allow us to scale in a much more maintainable and clean manner as we go forward in Faire’s journey. There are, however, still some scenarios where developing views in UIKit still make more sense given our particular context and the current state of SwiftUI’s framework. More on those scenarios and how we are handling the UIKit/SwiftUI integration in a coming up iOS Article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90214ebdb12a" width="1" height="1" alt=""><hr><p><a href="https://craft.faire.com/think-twice-before-scaling-your-app-with-interface-builder-90214ebdb12a">Think twice before scaling your app with Interface Builder</a> was originally published in <a href="https://craft.faire.com/">The Craft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>