<?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 Natasha Hartanti Winata on Medium]]></title>
        <description><![CDATA[Stories by Natasha Hartanti Winata on Medium]]></description>
        <link>https://medium.com/@felicianhw?source=rss-88b48152ff7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*yv9HbclMyg4wprb_</url>
            <title>Stories by Natasha Hartanti Winata on Medium</title>
            <link>https://medium.com/@felicianhw?source=rss-88b48152ff7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:26:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@felicianhw/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[Feel Unsafe? Stay Calm and Let BeSafe Lead the Way]]></title>
            <link>https://medium.com/@felicianhw/feel-unsafe-stay-calm-and-let-besafe-lead-the-way-0559f6aefc34?source=rss-88b48152ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/0559f6aefc34</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[application-development]]></category>
            <category><![CDATA[emergency]]></category>
            <category><![CDATA[sexual-harassment]]></category>
            <category><![CDATA[stalking]]></category>
            <dc:creator><![CDATA[Natasha Hartanti Winata]]></dc:creator>
            <pubDate>Sun, 01 Sep 2024 15:24:36 GMT</pubDate>
            <atom:updated>2024-09-01T15:24:36.429Z</atom:updated>
            <content:encoded><![CDATA[<p>In an increasingly complex and risky world, feeling safe while traveling or being in public spaces is a fundamental need for many. Unfortunately, situations that make us feel unsafe can arise at any time and in any place. Whether it’s walking alone at night on a deserted street, being in an unfamiliar area, or simply waiting for public transportation, these moments often come with a sense of unease — especially when we realize that someone might be watching us or even following us.</p><p>I personally experienced this fear one evening while walking home from the supermarket. At first, the person who appeared to be harmless started following me. The next few moments were filled with anxiety and uncertainty — should I run? Should I find a crowded place? Or maybe call someone? However, in a state of fear, it’s difficult to think clearly and make the right decision. The only thing I knew for sure was that I needed to find a safe place, and I needed to find it quickly.</p><p>Turns out I’m not alone in this, data shows that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rt7RU4LINCuqjFjm4wmqug.png" /><figcaption><a href="https://www.endviolenceagainstwomen.org.uk/new-data-women-feel-unsafe-at-night/">https://www.endviolenceagainstwomen.org.uk/new-data-women-feel-unsafe-at-night/</a></figcaption></figure><p>This isn’t just a personal fear — it’s a widespread problem that many people face every day.</p><p>When I talked to friends, many of them expressed confusion about what to do in such scary situations. They shared the same uncertainty and fear of the unknown. Some of them mentioned trying to run, hoping to find a safe place, but often had no idea where to go. Others talked about calling a friend or sharing their location, but are these really the best moves, especially when you’re scared, confused, and don’t know where to go?</p><p>These methods, while somewhat helpful, have their downsides.</p><ul><li>Running blindly leaves you vulnerable.</li><li>Calling a friend might be comforting, but it doesn’t actually help you find safety.</li><li>Sharing your live location is a partial solution that doesn’t address the immediate need for help.</li></ul><p>All of this highlights the need for a better solution — a real game-changer that cuts through the confusion and fear, providing clear guidance on what to do and where to go. We need something that doesn’t just tell us to run but actually guides us to a safe place in real-time.</p><p>And that’s where BeSafe comes in. BeSafe is an innovative app designed to help users feel safer and receive quick assistance when facing emergency situations, such as feeling followed by a stranger. BeSafe was born out of a deep understanding of the concerns and challenges individuals face in high-risk situations, offering a comprehensive solution to meet these needs, ensuring that in critical moments, you’re not alone, and you know exactly where to go to get help.</p><h3>How BeSafe Addresses These Challenges</h3><p>BeSafe was developed with one clear mission: to provide peace of mind and safety in situations where it’s needed the most. Here’s how BeSafe helps users:</p><ul><li><strong>Real-Time Navigation to Safety:</strong> With just one tap, BeSafe springs into action, guiding you to the nearest safe location, whether it’s a 24-hour convenience store, a gas station, or even a police station. This feature ensures that you don’t have to second-guess your decisions when time is of the essence.</li><li><strong>Automatic Location Sharing:</strong> The moment you activate the navigation to safety, BeSafe automatically shares your live location with your emergency contacts. This gives both you and your loved ones peace of mind, knowing that they are informed of your movements in real-time.</li><li><strong>Fake Phone Call Feature:</strong> If you’re far from a safe place and feel isolated, BeSafe offers a Fake Phone Call feature. With a single tap, you can initiate a convincing phone call scenario that can buy you critical time to move toward safety.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*UTdH8qLTgQwI0jAsnlaLgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*HL5_yHel-pSrMuS0-0g74g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*e1dhzvvNvvv07UWCgAXh_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVOlsdmUxod0NMHRKdQSZw.png" /></figure><p>These features are designed to provide comprehensive assistance in the most stressful situations, ensuring that users have a clear path to safety without any extra steps or confusion.</p><h3>My Role in Bringing BeSafe to Life</h3><p>As the <strong>Researcher, Project Manager, and iOS Developer </strong>for BeSafe, my responsibilities were multifaceted:</p><ul><li><strong>As a Researcher</strong>, I conducted extensive interviews and surveys to understand the fears and needs of potential users. This research was crucial in shaping the features and functionality of BeSafe, ensuring it truly addresses the concerns of those who feel unsafe in public spaces.</li><li><strong>As a Project Manager</strong>, I coordinated the development process, ensuring that our team stayed on track and that the project progressed smoothly. I managed timelines, communicated with stakeholders, and made sure that the team’s efforts were aligned with our goals.</li><li><strong>As an iOS Developer</strong>, I was directly involved in the coding and technical development of the app. I implemented key features like real-time navigation and live location sharing, ensuring that they function seamlessly in emergency situations.</li></ul><h3>Building BeSafe with Clean Code Architecture</h3><p>In developing BeSafe, we adhered to clean code architecture principles, ensuring that the app is not only functional but also maintainable and scalable. We implemented the following:</p><ul><li><strong>MVVM (Model-View-ViewModel) Architecture:</strong> This helped us separate the concerns of the user interface from the business logic, making the app more modular and easier to manage.</li><li><strong>SOLID Principles:</strong> We applied these principles to ensure that our codebase remains clean, understandable, and flexible for future enhancements. This approach minimizes the risk of bugs and makes the app easier to extend with new features.</li></ul><p>By following these best practices, we’ve built an app that not only meets the immediate needs of users but also stands the test of time in terms of reliability and ease of maintenance.</p><p>We also leverage a variety of powerful frameworks to ensure a seamless and responsive user experience. Each framework plays a crucial role in delivering the app’s essential features, from real-time location tracking to intuitive user interfaces. Here’s a closer look at the key technologies that drive BeSafe:</p><ul><li><strong>SwiftUI</strong>: This framework allows us to create dynamic, responsive user interfaces with a declarative syntax. It simplifies the development of UI elements that adapt to various screen sizes, enhancing the overall user experience.</li><li><strong>SwiftData</strong>: We use SwiftData for efficient data management and storage. It handles critical information such as emergency contacts and custom safe places, ensuring that data is quickly and securely accessible when needed.</li><li><strong>CoreLocation and MapKit</strong>: CoreLocation provides real-time location tracking, while MapKit displays the user’s location on a map. Together, these tools help users navigate to the nearest safe place and enable automatic alerts based on their location.</li><li><strong>Watch Connectivity</strong>: This framework integrates our iPhone and Apple Watch applications, particularly for real-time navigation directions to safe places, enhancing the usability of BeSafe on both devices.</li><li><strong>UIKit</strong>: For standard industry-compliant UI development, we utilize UIKit. This ensures that all user interface elements are accessible and user-friendly.</li><li><strong>Combine</strong>: Manage reactive data flows with Combine, which efficiently handles changing data such as location updates and user status, providing a smooth and responsive app experience.</li><li><strong>CoreHaptics</strong>: To enhance user interaction, CoreHaptics delivers tactile feedback through responsive touch sensations, making the app more intuitive and engaging.</li><li><strong>Contacts and ContactsUI</strong>: These frameworks simplify the process of managing and accessing user contacts, allowing for the easy addition of emergency contacts.</li><li><strong>XCTest</strong>: We use XCTest for unit testing to ensure the app’s logic, such as the sorting and selection of safe locations, functions as intended.</li><li><strong>WidgetKit</strong>: For watchOS, WidgetKit enables us to create complications that display essential information, such as quick access to safe places or the status of emergency contacts.</li></ul><p>Each of these frameworks contributes to making BeSafe a robust and user-centric application, designed to provide peace of mind through advanced technology and seamless functionality.</p><h3>My Implementation</h3><p>In developing our location-based safety app, we place a strong emphasis on clean code architecture to ensure the app remains maintainable, readable, and scalable. Below, you’ll find some code snippets that demonstrate the core logic and mechanisms I’ve designed and implemented. These examples illustrate the core aspects of our codebase and how they contribute to the app’s functionality.</p><h4><strong>Sorting Safe Places</strong></h4><pre>import Foundation<br>import MapKit<br>import CoreLocation<br><br>class SafePlaceUtils {<br>    static private let priorityOrder: [String: Int] = [<br>        &quot;police&quot;: 1,<br>        &quot;fire_station&quot;: 2,<br>        // ...<br>    ]<br>    <br>    static func sortSafePlaces(_ places: [PlaceModel], from userLocation: CLLocation) -&gt; [PlaceModel] {<br>        let openPlaces = places.filter { $0.currentOpeningHours?.openNow == true }<br>        var combinedPlaces = openPlaces<br><br>        print(&quot;Combined Places Count: \(combinedPlaces.count)&quot;)<br>        <br>        return combinedPlaces.sorted { (place1, place2) -&gt; Bool in<br>            let distance1 = calculateDistance(from: userLocation, to: place1)<br>            let distance2 = calculateDistance(from: userLocation, to: place2)<br>            let distanceTolerance: Double = 10.0<br>            <br>            if abs(distance1 - distance2) &lt;= distanceTolerance {<br>                let priority1 = priorityOrder[place1.primaryType] ?? Int.max<br>                let priority2 = priorityOrder[place2.primaryType] ?? Int.max<br>                return priority1 &lt; priority2 || (priority1 == priority2 &amp;&amp; place1.id &lt; place2.id)<br>            } else {<br>                return distance1 &lt; distance2<br>            }<br>        }<br>    }<br>    <br>    static func calculateDistance(from userLocation: CLLocation, to place: PlaceModel) -&gt; Double {<br>        guard let location = place.location else { return Double.greatestFiniteMagnitude }<br>        return userLocation.distance(from: CLLocation(latitude: location.latitude!, longitude: location.longitude!))<br>    }<br>}</pre><p><strong>Explanation:</strong></p><ul><li>Priority Order: We define a priority order for various types of safe places (e.g., police stations, hospitals, etc) to ensure that the most critical locations are prioritized.</li><li>Sorting Logic: The sortSafePlaces function filters the places to include only those that are currently open, and then sorts them based on proximity to the user and predefined priority. This ensures that users are guided to the safest and most accessible places.</li></ul><h4>Emergency Contacts Management</h4><pre>import SwiftUI<br><br>struct EmergencyContactsView: View {<br>    @StateObject private var viewModel = EmergencyContactsViewModel()<br>    @State private var hasContactAccess = false<br>    @State private var activeAlert: ActiveAlert? = nil<br>    <br>    var body: some View {<br>        VStack {<br>            // UI components and logic<br>        }<br>        .onAppear {<br>            viewModel.requestContactAccess { granted in<br>                hasContactAccess = granted<br>                if granted {<br>                    viewModel.fetchSavedContacts()<br>                }<br>            }<br>        }<br>        .alert(item: $activeAlert) { alert in<br>            switch alert {<br>            case .deleteConfirmation:<br>                return Alert(<br>                    title: Text(&quot;Are you sure you want to delete this emergency contact?&quot;),<br>                    primaryButton: .destructive(Text(&quot;Delete&quot;)) {<br>                        viewModel.deleteContact(contact: contactToDelete!)<br>                    },<br>                    secondaryButton: .cancel()<br>                )<br>            case .contactAccess:<br>                return Alert(<br>                    title: Text(&quot;Contact Access Denied&quot;),<br>                    message: Text(&quot;Please allow contact access in Settings to add an emergency contact.&quot;),<br>                    primaryButton: .default(Text(&quot;Open Settings&quot;)) {<br>                        UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)<br>                    },<br>                    secondaryButton: .cancel()<br>                )<br>            }<br>        }<br>    }<br>}</pre><p><strong>Explanation:</strong><br>This view allows users to manage their emergency contacts. It includes logic to handle permissions, contact access, and alerting the user in case of issues like denied contact access. This ensures that users can quickly add or remove emergency contacts as needed.</p><h4>Searching for Nearby Places</h4><pre>import SwiftUI<br>import CoreLocation<br>import MapKit<br><br>class SearchNearby: NSObject, ObservableObject, CLLocationManagerDelegate {<br>    @Published var nearbyPlaces: [NearbyPlace] = []<br>    @Published var userLocation: CLLocation?<br>    <br>    private var locationManager: CLLocationManager?<br>    <br>    override init() {<br>        super.init()<br>        locationManager = CLLocationManager()<br>        locationManager?.delegate = self<br>        locationManager?.desiredAccuracy = kCLLocationAccuracyBest<br>    }<br>    <br>    func requestLocationPermission() {<br>        locationManager?.requestWhenInUseAuthorization()<br>        locationManager?.startUpdatingLocation()<br>    }<br>    <br>    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {<br>        if let location = locations.first {<br>            userLocation = location<br>            searchNearbyPlaces(at: location.coordinate)<br>            locationManager?.stopUpdatingLocation()<br>        }<br>    }<br>    <br>    func searchNearbyPlaces(at coordinate: CLLocationCoordinate2D) {<br>        nearbyPlaces.removeAll()<br>        searchPOIPlaces(at: coordinate) {<br>            self.searchFallbackPlaces(at: coordinate)<br>        }<br>    }<br>    <br>    private func searchPOIPlaces(at coordinate: CLLocationCoordinate2D, completion: @escaping () -&gt; Void) {<br>        let request = MKLocalPointsOfInterestRequest(center: coordinate, radius: 1000)<br>        request.pointOfInterestFilter = MKPointOfInterestFilter(including: [<br>            .hospital, .gasStation, .hotel, .police, .university<br>        ])<br>        <br>        let search = MKLocalSearch(request: request)<br>        search.start { [weak self] response, error in<br>            guard let response = response else {<br>                print(&quot;POI Search error: \(error?.localizedDescription ?? &quot;Unknown error&quot;)&quot;)<br>                completion()<br>                return<br>            }<br>            <br>            let places = response.mapItems.compactMap { item -&gt; NearbyPlace? in<br>                guard let name = item.name,<br>                      let address = item.placemark.title,<br>                      let coordinate = item.placemark.location?.coordinate else {<br>                    return nil<br>                }<br>                <br>                let distance = CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude).distance(from: CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)) / 1000<br>                <br>                return NearbyPlace(name: name, address: address, distance: distance, coordinate: coordinate)<br>            }<br>            <br>            DispatchQueue.main.async {<br>                self?.nearbyPlaces.append(contentsOf: places)<br>                completion()<br>            }<br>        }<br>    }<br>    <br>    private func searchFallbackPlaces(at coordinate: CLLocationCoordinate2D) {<br>        let request = MKLocalSearch.Request()<br>        request.naturalLanguageQuery = &quot;Mall, Mosque, Church, Vihara, Pura&quot;<br>        request.region = MKCoordinateRegion(center: coordinate, latitudinalMeters: 1000, longitudinalMeters: 1000)<br>        <br>        let search = MKLocalSearch(request: request)<br>        search.start { [weak self] response, error in<br>            guard let response = response else {<br>                print(&quot;Fallback search error: \(error?.localizedDescription ?? &quot;Unknown error&quot;)&quot;)<br>                return<br>            }<br>            <br>            let places = response.mapItems.compactMap { item -&gt; NearbyPlace? in<br>                guard let name = item.name,<br>                      let address = item.placemark.title,<br>                      let coordinate = item.placemark.location?.coordinate else {<br>                    return nil<br>                }<br>                <br>                let distance = CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude).distance(from: CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)) / 1000<br>                <br>                return NearbyPlace(name: name, address: address, distance: distance, coordinate: coordinate)<br>            }<br>            <br>            DispatchQueue.main.async {<br>                self?.nearbyPlaces.append(contentsOf: places)<br>            }<br>        }<br>    }<br>}</pre><p><strong>Explanation:</strong><br>This class handles the user’s location and searches for nearby places of interest.</p><h4>Swift Data Service</h4><p>The SwiftDataService class demonstrates a typical approach to managing data in an app using a data management library, like SwiftData. Its primary purpose is to handle core data operations efficiently, ensuring that data interactions are streamlined and organized. This approach aligns with the MVVM (Model-View-ViewModel) design pattern, which separates data management from the user interface, promoting cleaner and more maintainable code.</p><pre>import Foundation<br>import SwiftData<br><br>class SwiftDataService {<br>   private let container: ModelContainer<br>    let context: ModelContext<br>   <br>   @MainActor<br>   static let shared = SwiftDataService()<br>   <br>   @MainActor<br>   init() {<br>      do{<br>         self.container = try ModelContainer(for: MapPoint.self, configurations: ModelConfiguration(isStoredInMemoryOnly: false))<br>         self.context = container.mainContext<br>      }catch{<br>         fatalError(error.localizedDescription)<br>      }<br>   }<br>   <br>   func fetchMapPoints() -&gt; [MapPoint]{<br>      do{<br>         return try context.fetch(FetchDescriptor&lt;MapPoint&gt;())<br>      }catch{<br>         fatalError(error.localizedDescription)<br>      }<br>   }<br>   <br>   func addMapPoint(point: MapPoint){<br>         self.context.insert(point)<br>         do{<br>            try self.context.save()<br>         }catch{<br>            fatalError(error.localizedDescription)<br>         }<br>   }<br>   <br>   func updateMapPoint(point: MapPoint, name: String, lat: Double, long: Double, index: Int){<br>      do{<br>         point.name = name<br>         point.latitude = lat<br>         point.longitude = long<br>         point.markerIndex = index<br>         <br>         try context.save()<br>      }catch{<br>         fatalError(error.localizedDescription)<br>      }<br>   }<br>   <br>   func deleteMapPoint(point: MapPoint){<br>      context.delete(point)<br>      do{<br>         try context.save()<br>      }catch{<br>         fatalError(error.localizedDescription)<br>      }<br>   }<br>}</pre><h4>Key Concepts</h4><ol><li><strong>Singleton Pattern</strong>:<br>- <strong>Purpose</strong>: Ensures that there is only one instance of the data service throughout the app. This centralizes data management and avoids inconsistencies.<br>- <strong>Benefit</strong>: Provides a single point of access to the data, simplifying data operations and management.</li><li><strong>Initialization</strong>:<br>- <strong>Purpose</strong>: Sets up the data context and container to manage entities. This configuration persists data beyond the app’s lifecycle.<br>- <strong>Benefit</strong>: Ensures that the data is correctly initialized and available for the entire app.</li><li><strong>Data Operations</strong>:<br>- <strong>Fetching Data</strong>: Retrieves existing data from the database.<br>- <strong>Adding Data</strong>: Inserts new entities into the database.<br>- <strong>Updating Data</strong>: Modifies existing entities.<br>- <strong>Deleting Data</strong>: Removes entities from the database.<br>- <strong>Benefit</strong>: Provides essential CRUD (Create, Read, Update, Delete) operations that are commonly needed for managing app data.</li><li><strong>Error Handling</strong>:<br>- <strong>Purpose</strong>: Ensures that any issues encountered during data operations are handled appropriately, usually by terminating the app if a critical error occurs.<br>- <strong>Benefit</strong>: Helps in quickly identifying and fixing issues, maintaining data integrity.</li><li><strong>Concurrency</strong>:<br>- <strong>Purpose</strong>: Ensures that data operations are performed on the main thread, which is crucial for thread safety when updating the user interface.<br>- <strong>Benefit</strong>: Maintains a smooth and responsive user experience by preventing data operations from blocking the UI.</li><li><strong>Reusability and Maintainability</strong>:<br>- <strong>Purpose</strong>: Implements common data operations in one place, making it easy to reuse and maintain the code.<br>- <strong>Benefit</strong>: Reduces code duplication and simplifies updates to data management logic.</li></ol><p>The SwiftDataService class is an example of a centralized approach to data management. It illustrates how to use a data management library to handle various data operations in a clean, maintainable way, supporting the MVVM architecture. This approach keeps your view code focused on presenting data rather than managing it, enhancing the overall structure and organization of the app.</p><h4>Unit Test</h4><p>This is just one example of a unit test that might be conducted. In practice, unit tests should be comprehensive and cover various scenarios, including different locations and conditions, to ensure that the sortSafePlaces function behaves correctly in all cases. This specific test is designed to check how the system handles places of equal distance but different priorities.</p><pre>import XCTest<br>import CoreLocation<br>@testable import besafe <br><br>class SafePlaceUtilsTests: XCTestCase {<br>    <br>    func testSortSafePlaces_withEqualDistanceDifferentPriority() {<br>        // Arrange<br>        let userLocation = CLLocation(latitude: 0.0, longitude: 0.0)<br>        let dummyPlaces = [<br>            PlaceModel(id: &quot;1&quot;, location: Location(latitude: 0.0, longitude: 0.0), currentOpeningHours: CurrentOpeningHours(openNow: true), primaryType: &quot;police&quot;, displayName: DisplayName(text: &quot;Police Station&quot;, languageCode: &quot;en&quot;), shortFormattedAddress: &quot;Jakarta&quot;),<br>            PlaceModel(id: &quot;2&quot;, location: Location(latitude: 0.0, longitude: 0.0), currentOpeningHours: CurrentOpeningHours(openNow: true), primaryType: &quot;fire_station&quot;, displayName: DisplayName(text: &quot;Fire Station&quot;, languageCode: &quot;en&quot;), shortFormattedAddress: &quot;Jakarta&quot;),<br>        ]<br>        <br>        let dummyCustomPlaces = [<br>            MapPoint(name: &quot;Custom Place 1&quot;, coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.02), markerIndex: 0)<br>        ]<br>        <br>        // Act<br>        let sortedPlaces = SafePlaceUtils.sortSafePlaces(dummyPlaces, customPlaces: dummyCustomPlaces, from: userLocation)<br>        <br>        // Assert<br>        XCTAssertEqual(sortedPlaces.first?.displayName?.text, &quot;Police Station&quot;, &quot;Police stations should have a higher priority than fire stations.&quot;)<br>    }<br>}</pre><p>This test is designed to verify the behavior of the sortSafePlaces function from the SafePlaceUtils utility. Here&#39;s a breakdown of what each part of the test does:</p><p><strong>Test Function: </strong><strong>testSortSafePlaces_withEqualDistanceDifferentPriority</strong></p><ul><li><strong>Objective</strong>: The goal of this test is to ensure that when multiple safe places are equidistant from the user, the system correctly prioritizes places based on their type. Specifically, it verifies that police stations are given higher priority than fire stations.</li><li><strong>Setup (</strong><strong>Arrange)</strong>: <br>- A userLocation is defined using specific latitude and longitude coordinates.<br>- dummyPlaces are created, including two places (a police station and a fire station) that are at the same location and have their opening hours set to open.<br>- A dummyCustomPlaces array includes one custom place located at slightly different coordinates from the user.</li><li><strong>Execution (</strong><strong>Act)</strong>: The sortSafePlaces function is called with the dummyPlaces, dummyCustomPlaces, and userLocation. This function is expected to sort these places based on proximity to the user and their type.</li><li><strong>Validation (</strong><strong>Assert)</strong>: The test asserts that the first place in the sorted list should be the “Police Station” because police stations are supposed to have a higher priority than fire stations.</li></ul><p>BeSafe is more than just an app — it’s a lifeline for those moments when safety feels uncertain. Through thoughtful design, robust features, and a commitment to clean, sustainable code, we’ve created a solution that empowers users to take control of their safety with confidence. I’m proud of the work our team has done, and I’m excited to see how BeSafe can help others feel secure in their everyday lives.</p><h3>Thank You</h3><p>© 2024 Natasha Hartanti Winata. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0559f6aefc34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maximize Productivity: The All-in-One Notes and Habit Tracker]]></title>
            <link>https://medium.com/@felicianhw/maximize-productivity-the-all-in-one-notes-and-habit-tracker-9752528c5da7?source=rss-88b48152ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9752528c5da7</guid>
            <category><![CDATA[local-notifications]]></category>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[dark-mode]]></category>
            <category><![CDATA[note-taking-app]]></category>
            <dc:creator><![CDATA[Natasha Hartanti Winata]]></dc:creator>
            <pubDate>Fri, 26 Jul 2024 07:51:37 GMT</pubDate>
            <atom:updated>2024-07-26T07:51:37.243Z</atom:updated>
            <content:encoded><![CDATA[<p>Many users face challenges while using various notes and habit-tracking apps. Each app has its own set of features, but they often find themselves switching between multiple apps to access specific functions, leading to frequent loss of focus and forgetting to update their progress. Over time, notes pile up, and managing them becomes overwhelming. Moreover, most note-taking apps lack integrated habit-building features, which are essential for productivity.</p><p>Our User Persona experiences these exact problems. They want to use the Apple Notes app but find that it doesn’t fully address their needs, especially in tracking habits. To solve these pain points, my group developed <strong>Noted</strong>, a re-imagined note app that integrates habit-building features seamlessly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o8iIlKzNWgsa9-7DtgJqHw.png" /><figcaption>UI of Noted Apps</figcaption></figure><p>Here’s how Noted addresses these issues:</p><p>1. <strong>Unified Functionality</strong>: Noted combines note-taking and habit-tracking into one app, eliminating the need to switch between multiple apps for different functions. This integration helps maintain focus and ensures all related activities are in one place.</p><p>2. <strong>Focus and Reminders</strong>: With Noted, users receive regular reminders to update their progress, helping to maintain consistency. The app’s design minimizes distractions, aiding users in staying focused on their tasks.</p><p>3. <strong>Efficient Note Management</strong>: Noted offers features that streamline note organization, making it easy to manage and access notes without feeling overwhelmed. Users can categorize notes, use tags, and employ search functions to find what they need quickly.</p><p>4. <strong>Built-in Habit Features</strong>: Noted includes robust habit-building tools, such as visual progress tracking, quick notes for easy documentation, and habit reminders. These features support users in maintaining and building new habits, all within the same app.</p><p>With <strong>Noted</strong>, you no longer need to juggle between different apps for notes and habit tracking. It’s designed to enhance your productivity and help you build lasting habits with ease. Here’s a closer look at how Noted achieves this through its thoughtful Information Architecture:</p><h4>Information Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_P03P_s7CGQn-44U_aXuA.png" /><figcaption>Information Architecture</figcaption></figure><p>The information architecture of Noted is designed to facilitate easy navigation and seamless integration of note-taking and habit-tracking functionalities.</p><ol><li><strong>Landing Page:</strong> Users start their journey on the landing page, which serves as the main entry point to the app.</li><li><strong>Shortcuts:</strong> This section includes various shortcuts such as Scheduled, All Notes, Pinned, and Habit Entries.<br>- <strong>Scheduled:</strong> Displays a list of habits sorted by day and reminder time, allowing users to add new notes to selected habits.<br>- <strong>All Notes:</strong> Shows all notes within folders and habits, enabling users to view the content of selected notes.<br>- <strong>Pinned:</strong> Lists pinned notes within folders and habits, providing quick access to important notes.<br>- <strong>Habit Entries:</strong> Displays all notes related to habits, allowing users to view the content of notes within habits.</li><li><strong>Folder &amp; Habits Sections:</strong> This section is divided into Folders and Habits.<br>- <strong>Folders:</strong> Lists all folders, organizing notes into different categories. Users can view the content of notes within selected folders.<br>- <strong>Habits:</strong> Lists all habits, organizing them for easy management. Users can view the content of notes related to selected habits.</li><li><strong>Search Bar:</strong> Facilitates quick searching of notes and habits. The search results display all notes within folders and habits, allowing users to view the content of the selected notes.</li><li><strong>Add New Folder:</strong> Allows users to create new folders. The context menu provides options to add a new folder or habit. The detail page for adding a new folder ensures that newly created habits are added to the habit list.</li><li><strong>Add New Note:</strong> Enables users to create new notes. These notes can be added to the default directory or moved to selected habits, offering flexibility in note and habit management.</li></ol><p>This comprehensive structure ensures that users can efficiently manage their notes and habits in a unified and organized manner, enhancing their overall productivity.</p><h4>Frameworks Used</h4><p>To build Noted, I utilized the following frameworks:</p><ul><li><strong>SwiftUI</strong>: For creating the user interface with declarative syntax.</li><li><strong>SwiftData</strong>: For handling data persistence and management.</li><li><strong>Foundation</strong>: For basic functionalities and structures.</li><li><strong>UserNotifications</strong>: For managing local notifications to remind users about their habits.</li></ul><p>I focused on using native components provided by Apple to streamline development and ensure smooth integration. However, I did not find a native calendar component in SwiftUI; it is available in UIKit under the name CalendarKit. Since I only needed a simple date header slider, I created it in SwiftUI.</p><h3>Implementation Highlights</h3><p>The implementation of Noted showcases the power of native Apple components and frameworks, allowing for a cohesive and efficient app development process. By leveraging SwiftUI, SwiftData, and other frameworks, Noted delivers a seamless and productive user experience.</p><h4><strong>Local Notification for Reminders</strong></h4><p>To help users stay on track with their habits and notes, Noted includes a local notification feature. This feature sends timely reminders to users, ensuring they update their progress and maintain consistency in their habit-building efforts. Notifications are scheduled based on the reminder time set by the user and repeat on the specified days. For example, if a user sets a reminder for 8 AM on Mondays, Wednesdays, and Fridays, they will receive notifications at that time on those days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGjZ82LSvkWo6jP6H_jMRw.jpeg" /><figcaption>Schedule Notification Example</figcaption></figure><p>Here’s an overview of how to implement local notifications:</p><p><strong>Request Notification Permissions</strong></p><p>The requestNotificationPermissions function is used to request permission from the user to show notifications. It prompts the user to allow the app to display alerts, update the app badge, and play sounds. The function handles the user’s response, printing messages based on whether permission was granted, denied, or if there was an error.</p><pre>import UserNotifications<br><br>func requestNotificationPermissions() {<br>    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in<br>        if let error = error {<br>            print(&quot;Error requesting notification permissions: \(error)&quot;)<br>        } else if granted {<br>            print(&quot;Notification permissions granted.&quot;)<br>        } else {<br>            print(&quot;Notification permissions denied.&quot;)<br>        }<br>    }<br>}</pre><p><strong>Schedule Notifications</strong></p><p>The scheduleHabitNotifications function is used to schedule local notifications for a specific habit. It sets up reminders based on the habit&#39;s schedule. For each day the habit should be performed, it creates a notification with the specified reminder time. If the user has enabled reminders, it generates notification content, determines the notification trigger time, and adds the notifications to the notification center. Any existing notifications for the habit are removed before scheduling new ones.</p><pre>func scheduleHabitNotifications(for habit: HabitModel) {<br>    let notificationCenter = UNUserNotificationCenter.current()<br>    <br>    // Remove any existing notifications for this habit<br>    notificationCenter.removePendingNotificationRequests(withIdentifiers: [habit.id.uuidString])<br>    <br>    guard habit.isReminder, let reminderTime = habit.time else { return }<br>    <br>    let content = UNMutableNotificationContent()<br>    content.title = &quot;Habit Reminder&quot;<br>    content.body = &quot;Time to work on your habit: \(habit.title)&quot;<br>    content.sound = .default<br>    <br>    let calendar = Calendar.current<br>    <br>    for day in habit.days {<br>        var dateComponents = DateComponents()<br>        dateComponents.hour = calendar.component(.hour, from: reminderTime)<br>        dateComponents.minute = calendar.component(.minute, from: reminderTime)<br>        dateComponents.weekday = day + 1  // weekday is 1-indexed: 1 for Sunday, 2 for Monday, etc.<br>        <br>        let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)<br>        <br>        let request = UNNotificationRequest(identifier: &quot;\(habit.id.uuidString)-\(day)&quot;, content: content, trigger: trigger)<br>        notificationCenter.add(request) { error in<br>            if let error = error {<br>                print(&quot;Error scheduling notification: \(error)&quot;)<br>            }<br>        }<br>    }<br>}</pre><h4>Localization for Multiple Languages (English and Indonesian)</h4><p>Noted supports multiple languages to cater to a diverse user base. Implementing localization ensures that users can access the app in their preferred language. Here’s a brief guide on how to set up localization:</p><p><strong>1. Add language localizations</strong></p><ul><li>Open your Xcode project.</li><li>Select your project in the Project Navigator.</li><li>Go to the Info tab.</li><li>Under Localizations, click the + button to add a new localization (e.g., in this case, I add the Indonesian language).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*815wvLq4e1GQeMwULbl8ug.jpeg" /><figcaption>Language Localizations</figcaption></figure><p><strong>2. Create New File &gt; String Catalog</strong></p><ul><li>Go to File &gt; New &gt; File.</li><li>Select String Catalog and click Next.</li><li>Name the file (e.g., Localizable.strings) and save it.</li></ul><p><strong>3. Input Indonesian Text</strong></p><ul><li>Open the Localizable.strings file.</li><li>Add the translated text for Indonesian in the appropriate section.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AvP5F2OqyKCI96hZRwlVuA.jpeg" /><figcaption>Localizable.strings</figcaption></figure><p>4. <strong>Handle Undetected Text: </strong>If any text is not automatically detected in the Localizable.strings file, use LocalizedStringKey(&quot;Text&quot;) in your code to ensure it is picked up.</p><pre>Text(LocalizedStringKey(&quot;Your text here&quot;))</pre><p><strong>5. Rebuild the Project:</strong></p><ul><li>After adding new text, rebuild your project (CMD + B) to ensure all localizations are updated and applied.</li></ul><p>By following these steps, you can effectively implement localization in Noted, providing a seamless experience for users in both English and Indonesian.</p><h4><strong>Clone Calendar App (Date Slider Feature)</strong></h4><p>To enhance the user experience, Noted includes a date slider feature similar to the one in calendar apps. This feature allows users to select and navigate dates easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Zt8TmZmRrQla5E3wQj6QQ.gif" /></figure><p>Here’s an overview of implementing a custom date slider:</p><pre>import SwiftData<br>import SwiftUI<br><br>struct CalendarView: View {<br>    @State private var selectedDate = Date()<br>    @State private var currentWeekOffset = 0<br>    @State private var showDatePicker = false<br>    @Environment(\.colorScheme) var colorScheme<br><br>    @State var isAddHabit = false<br>    let calendar = Calendar.current<br>    let dateFormatter: DateFormatter = {<br>        let formatter = DateFormatter()<br>        formatter.dateFormat = &quot;EEEE dd MMMM yyyy&quot;<br>        return formatter<br>    }()<br>    <br>    @EnvironmentObject private var habitViewModel: HabitViewModel<br>    <br>    var body: some View {<br>        ZStack {<br>            VStack(spacing: 10) {<br>                weekView<br>                <br>                Text(dateFormatter.string(from: selectedDate))<br>                    .font(.system(size: 18))<br>                    .padding(.bottom, 6)<br>                <br>                let dayGoals = goalsForSelectedDate().filter { $0.deleteAt == nil }<br>                <br>                if !dayGoals.isEmpty {<br>                    List {<br>                        let completedHabit = dayGoals.filter {<br>                            if let lastLog = $0.lastLog {<br>                                return Calendar.current.isDate(selectedDate, inSameDayAs: lastLog)<br>                            } else {<br>                                return false<br>                            }<br>                        }<br>                        <br>                        let incompleteHabit = dayGoals.filter {<br>                            if let lastLog = $0.lastLog {<br>                                return !Calendar.current.isDate(selectedDate, inSameDayAs: lastLog)<br>                            } else {<br>                                return true<br>                            }<br>                        }<br>                        <br>                        ForEach(incompleteHabit) { habit in<br>                            Section {<br>                                ScheduledHabitListItem(habit: habit, isComplete: false)<br>                            }<br>                            .listSectionSpacing(8)<br>                        }<br>                        <br>                        Section(header: Text(&quot;Completed&quot;)) {<br>                            ForEach(completedHabit) { habit in<br>                                Section {<br>                                    ScheduledHabitListItem(habit: habit, isComplete: true)<br>                                }<br>                                .listSectionSpacing(8)<br>                            }<br>                        }<br>                        .headerProminence(.increased)<br>                        <br>                    }<br>                } else {<br>                    Divider()<br>                        .padding(.bottom, 6)<br>                    <br>                    Spacer()<br>                    <br>                    Text(&quot;No habits scheduled for this date&quot;)<br>                        .foregroundColor(.gray)<br>                        .padding()<br>                    <br>                    Spacer()<br>                }<br>            }<br>            .background(Color(.systemBackground))<br>            <br>            if showDatePicker {<br>                Color.black.opacity(0.4)<br>                    .edgesIgnoringSafeArea(.all)<br>                    .onTapGesture {<br>                        showDatePicker = false<br>                    }<br>                <br>                DatePickerView(selectedDate: $selectedDate) { newDate in<br>                    selectedDate = newDate<br>                    showDatePicker = false<br>                }<br>                .frame(width: 350, height: 310)<br>                .background(colorScheme == .dark ? .grayCalendar : .white)<br>                .cornerRadius(10)<br>                .shadow(radius: 10)<br>                .offset(y: -160)<br>            }<br>        }<br>        .sheet(isPresented: $isAddHabit, content: {<br>            AddHabitView()<br>        })<br>        .accentColor(.primaryRed)<br>        .navigationTitle(&quot;Scheduled&quot;)<br>        .navigationBarItems(trailing: Button(action: {<br>            showDatePicker = true<br>        }) {<br>            Image(systemName: &quot;calendar&quot;)<br>                .foregroundColor(.primaryRed)<br>        })<br>        .toolbar {<br>            ToolbarItem(placement: .bottomBar) {<br>                HStack {<br>                    Button(action: {<br>                        isAddHabit = true<br>                    }) {<br>                        Image(systemName: &quot;folder.badge.plus&quot;)<br>                    }<br>                    <br>                    Spacer()<br>                }<br>            }<br>        }<br>    }<br>    <br>    var weekView: some View {<br>        HStack(spacing: 20) {<br>            ForEach(0 ..&lt; 7) { index in<br>                VStack {<br>                    Text(shortWeekdayString(from: index))<br>                        .font(.subheadline)<br>                        .foregroundColor(.gray)<br>                    <br>                    Circle()<br>                        .fill(isDateSelected(index: index) ? Color.primaryRed : Color.clear)<br>                        .frame(width: 30, height: 30)<br>                        .overlay(<br>                            ({<br>                                if (isDateSelected(index: index)) {<br>                                    return Text(dayString(from: index))<br>                                        .foregroundColor(.white)<br>                                } else {<br>                                    return Text(dayString(from: index))<br>                                }<br>                                <br>                            })()<br>                            <br>                        )<br>                        .onTapGesture {<br>                            selectDate(index: index)<br>                        }<br>                    <br>                }<br>            }<br>        }<br>        .gesture(<br>            DragGesture()<br>                .onEnded { value in<br>                    if value.translation.width &lt; 0 {<br>                        currentWeekOffset += 1<br>                    } else if value.translation.width &gt; 0 {<br>                        currentWeekOffset -= 1<br>                    }<br>                }<br>        )<br>    }<br>    <br>    func shortWeekdayString(from index: Int) -&gt; String {<br>        let date = dateForIndex(index)<br>        let dateFormatter = DateFormatter()<br>        dateFormatter.dateFormat = &quot;E&quot;<br>        return dateFormatter.string(from: date)<br>    }<br>    <br>    func dayString(from index: Int) -&gt; String {<br>        let date = dateForIndex(index)<br>        let dateFormatter = DateFormatter()<br>        dateFormatter.dateFormat = &quot;d&quot;<br>        return dateFormatter.string(from: date)<br>    }<br>    <br>    func isDateSelected(index: Int) -&gt; Bool {<br>        let date = dateForIndex(index)<br>        return calendar.isDate(date, inSameDayAs: selectedDate)<br>    }<br>    <br>    func selectDate(index: Int) {<br>        let date = dateForIndex(index)<br>        selectedDate = date<br>        currentWeekOffset = 0<br>    }<br>    <br>    func dateForIndex(_ index: Int) -&gt; Date {<br>        let startOfWeek = calendar.date(byAdding: .day, value: currentWeekOffset * 7, to: getStartOfWeek(for: selectedDate))!<br>        return calendar.date(byAdding: .day, value: index, to: startOfWeek)!<br>    }<br>    <br>    func getStartOfWeek(for date: Date) -&gt; Date {<br>        var startOfWeek = Date()<br>        var interval: TimeInterval = 0<br>        if calendar.dateInterval(of: .weekOfYear, start: &amp;startOfWeek, interval: &amp;interval, for: date) {<br>            return startOfWeek<br>        } else {<br>            return date<br>        }<br>    }<br>    <br>    func updateWeekForSelectedDate() {<br>        let startOfWeek = getStartOfWeek(for: selectedDate)<br>        let daysBetween = calendar.dateComponents([.day], from: startOfWeek, to: selectedDate).day ?? 0<br>        currentWeekOffset = daysBetween / 7<br>    }<br>    <br>    func goalsForSelectedDate() -&gt; [HabitModel] {<br>        let weekDayIndex = Calendar.current.component(.weekday, from: selectedDate) - 1<br>        let habits = habitViewModel.habits.filter { $0.days.contains(weekDayIndex) &amp;&amp; $0.startDate &lt;= selectedDate }<br>        return habits<br>    }<br>}</pre><p>The provided CalendarView code is a SwiftUI view designed for a habit-tracking app. It includes features for displaying and interacting with a weekly calendar, showing scheduled habits, and managing habits through notifications and a date picker. Key components of this view include:</p><ol><li><strong>Weekly Calendar Display</strong>: A horizontal view shows the days of the current week, allowing users to select a date to view or update their scheduled habits.</li><li><strong>Selected Date Header</strong>: Displays the selected date in a formatted string, providing context for the habits listed below.</li><li><strong>Habit List</strong>: Displays a list of scheduled habits for the selected date, distinguishing between completed and incomplete habits. Users can tap on habits to mark them as completed or see additional details.</li><li><strong>Date Picker Overlay</strong>: A date picker overlay allows users to select a specific date, which updates the selected date and displayed habits.</li><li><strong>Add Habit Button</strong>: Provides a button to add new habits, presented via a sheet.</li><li><strong>Gesture Handling</strong>: Supports swiping gestures to navigate between weeks, enhancing the user experience by allowing smooth transitions.</li></ol><p>Overall, the CalendarView integrates date selection, habit tracking, and reminder notifications into a cohesive user interface, enabling users to manage their habits efficiently within a single view.</p><h4><strong>Dark Mode Support</strong></h4><p>Noted supports dark mode, providing a comfortable viewing experience in low-light environments. Implementing dark mode involves using color sets and configuring the app to switch between light and dark themes. Here’s a guide on how to set it up:</p><ol><li>First, in the Assets folder, click the + button and select Color Set.</li><li>Then, click the color block.</li><li>If the color block only has one color and does not include a dark color, you need to change the Appearances setting from None to Any, Dark or Any, Dark, Light in the Attributes Inspector.</li><li>After that, set the color for Any Appearance and also set the color for Dark Appearance. This configuration ensures that the app will automatically switch colors when the user changes between light mode and dark mode.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvDcyHlQjocwb3RPEP1bBg.jpeg" /><figcaption>Set Dark Mode</figcaption></figure><p>With these features, <strong>Noted</strong> aims to provide a comprehensive, user-friendly experience for note-taking and habit-building, ensuring users can stay organized and consistent in their personal development journey.</p><h3>Thank You</h3><p>© 2024 Natasha Hartanti Winata. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9752528c5da7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Share Your Perfect Workspace: Cooworka’s Engaging Review System — Part 2]]></title>
            <link>https://medium.com/@felicianhw/share-your-perfect-workspace-cooworkas-engaging-review-system-part-2-79a0fb0f93fe?source=rss-88b48152ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/79a0fb0f93fe</guid>
            <category><![CDATA[ui-ux-design]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[gamification]]></category>
            <category><![CDATA[mobile-application]]></category>
            <category><![CDATA[mapkit]]></category>
            <dc:creator><![CDATA[Natasha Hartanti Winata]]></dc:creator>
            <pubDate>Fri, 05 Jul 2024 09:45:43 GMT</pubDate>
            <atom:updated>2024-07-05T09:45:43.844Z</atom:updated>
            <content:encoded><![CDATA[<h3>Share Your Perfect Workspace: Cooworka’s Engaging Review System — Part 2</h3><h3>User Usability Testing</h3><p>Exciting Phase! The User Testing Phase.<br>We create a user testing sheet that includes scenarios, success factors, and an observation checklist.</p><blockquote>Our scenario is: “Write a review and submit to see what happens!”</blockquote><p>Our success criteria are :</p><p>1. Writing and submitting a review should increase the user’s level. Users understand this because when a review is submitted, the XP points on the progress bar increase.</p><p>2. Writing and submitting a review should help users level up faster. Users understand this because the more comprehensive the review, the more XP points they earn.</p><p>3. Writing five reviews on the same topic should earn users a badge. Users understand this because after writing five reviews on the same topic, the badge unlocks on their profile.</p><p>After that, we meet with our target users and show them our prototype, observing whether the scenarios unfold as expected. All the scenarios do occur. Based on the feedback, most of the comments were about minor issues such as design consistency, copywriting, and the efficiency of the displayed information.</p><h3>What’s Changed?</h3><p>Not only from user testing, but we also sought the expertise of our design mentors to further refine the user flow and enhance the overall user experience. Their feedback was invaluable, providing a fresh perspective and professional guidance that helped us make informed decisions. Here are the key highlights of the significant changes we have implemented:</p><p><strong>Less Tab Bar<br></strong>We merged the review and explore pages into a single interface to eliminate redundant functionalities. Now, the explore page greets users every time they open the app, allowing them to check in at nearby cafes or search for specific cafes in one convenient location. We also recognized that not all of our ideas could be implemented in this phase, so we decided to develop the leaderboard feature in the next phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VIW3_tzJaG3yMwL6" /><figcaption>Before &amp; After — Tab Bar</figcaption></figure><p><strong>Engaging User To Review<br></strong>Instead of giving users a direct reward, we introduced a mysterious chest! This decision aims to increase users’ curiosity and encourage them to reopen our app after checking in, as well as motivate them to write reviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_PuWykMrm65scH5n" /><figcaption>Before &amp; After — Engagement for Reviewing</figcaption></figure><p><strong>Dress Your Avatar<br></strong>To make our app more engaging as a gamification platform, we introduced a virtual pet feature. Users can dress their avatars with collected items, which they earn through writing reviews. This addition aims to encourage users to write more reviews and unlock additional items, enhancing their overall experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E9AWWAJlZLycwb6g" /><figcaption>Before &amp; After — Profile</figcaption></figure><h3>Final User Interface</h3><p>And here you go, a glimpse of our final app design!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*orS1qFkOyDNUETXs" /><figcaption>Final UI of Cooworka App</figcaption></figure><h3>Highlight Features</h3><p><strong>Minimize Fake Reviews<br></strong>To minimize fake reviews, our app uses Core Location to ensure authenticity. Users are required to visit the cafe before they can write a review. The GPS will confirm their location, allowing them to write a review only after a visit. This process ensures that the reviews are genuine and trustworthy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6T0mhD5nAOhbma_UWvsSA.png" /><figcaption>Minimize Fake Reviews</figcaption></figure><p><strong>Offer Reward<br></strong>As part of our gamification strategy, we use a reward system to encourage users to write reviews. Users receive a mysterious reward inside a chest, which can only be unlocked by writing a review. For those who prefer to write a review later, the app provides a reminder notification about the locked chest, encouraging them to complete the review to claim their reward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNaSTCYFi8eADzpy4bjKgA.png" /><figcaption>Offer Reward</figcaption></figure><p><strong>Engaging Review Form<br></strong>Understanding that some users might find writing reviews tedious or challenging, we designed an engaging and easy-to-fill review form. This form covers essential information about the cafe, such as wifi connection, power outlets, comfortable furniture, and other facilities. Additionally, users earn XPs for completing each section of the form, motivating them to provide comprehensive reviews to gain maximum XPs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ppNQoWJ1BxdHZM3Oxlc7g.png" /><figcaption>Engaging Review Form</figcaption></figure><p><strong>Dress Your Avatar<br></strong>To further incentivize reviews, we introduced a feature where users can dress up their avatars with items earned through reviews. Users can collect a variety of accessories, encouraging them to write more reviews to unlock these items one by one. By collecting XPs to level up, users can unlock cool accessories, turning their avatars into a reflection of their review activity. It’s like having a digital wardrobe that expands with each review you write.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqzNPaMHGuSzrCiVf0HFFw.png" /><figcaption>Dress Your Avatar</figcaption></figure><h3>Technical Coding Process</h3><h4><strong>ERD &amp; Class Diagram</strong></h4><p>We also developed a detailed class diagram and ERD documentation to clearly define the components of our system: the entities (similar to objects), their attributes (specific details about each entity), and their relationships. The class diagram visually represented each entity and its attributes. Meanwhile, the ERD demonstrated how these entities interact, emphasizing connections and utilizing foreign keys to establish links across our data. These documents enhanced our understanding of the system, facilitated discussions with others, and provided a blueprint for structuring data within CloudKit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/0*hxUtYPwQShhA2kQf" /><figcaption>Class Diagram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*eQtxbQOtHupmzXWI" /><figcaption>ERD</figcaption></figure><h4><strong>Technical Frameworks in Cooworka</strong></h4><p>On the technical side, Cooworka leverages several powerful frameworks to create a seamless and engaging user experience. Let’s dive into the details:</p><p><strong>1. AuthenticationServices</strong><br>We use AuthenticationServices to allow users to sign in with Apple. This not only provides a secure and convenient way for users to access the app but also integrates smoothly with other Apple services. By simplifying the sign-in process, we ensure that users can quickly get started with exploring and reviewing cafes without any hassle. Sign In with Apple is particularly crucial for Cooworka because it provides a User ID that serves as a unique identifier within our database. This unique User ID is then utilized in CloudKit to synchronize and manage user-posted reviews effectively. By leveraging this feature, we can maintain the integrity and accuracy of user data across the app.</p><p><strong>2. MapKit</strong><br>MapKit is employed to fetch location data and display cafe addresses. With MapKit, users can easily find cafes nearby or explore new ones on the map. This integration makes it simple for users to navigate and discover the best spots for working from cafes (WFC). MapKit allows us to fetch detailed cafe data, including the cafe’s name, address, coordinates, and distance from the user’s location. This information is used to display nearby cafes, enhancing the user’s ability to find suitable workspaces quickly.</p><ul><li><strong>Displaying Nearby Cafes:</strong> When users open the app, MapKit retrieves the location data and displays a list of nearby cafes based on their current location. This helps users quickly find cafes in their vicinity without having to search manually.</li><li><strong>Search Bar Integration:</strong> The search bar leverages MapKit to fetch and display cafes that match the user’s query. As users type, the search results dynamically update to show the most relevant cafes, making it easy to find specific locations or discover new options.</li><li><strong>Explore Page:</strong> On the Explore page, users can select a location, and MapKit updates the list to show cafes around the chosen area. This feature is particularly useful for users planning to visit a different part of town or exploring cafes in a new city.</li><li><strong>Apple Maps Data:</strong> By integrating with Apple Maps, MapKit provides accurate and up-to-date information about cafes. This ensures that users have reliable data, including the latest addresses and coordinates, enhancing their overall experience.</li></ul><p>MapKit’s robust features and seamless integration with Apple Maps enable Cooworka to provide detailed and reliable cafe information, making it easy for users to find and explore the best cafes for working.</p><p><strong>3. CoreLocation<br></strong>CoreLocation plays a crucial role in verifying user locations. To minimize fake reviews, we use CoreLocation to confirm that users are physically present at a cafe before they can leave a review. This ensures the authenticity of reviews and enhances trust within the community.</p><ul><li><strong>Location Verification:</strong> Before a user can submit a review, CoreLocation checks their current GPS coordinates. If the user is within the predefined radius of the cafe’s coordinates, they are allowed to write and submit their review. This step ensures that reviews are genuine and based on actual visits. In Cooworka, we set a tolerance of 50 meters between the user’s location and the cafe coordinates. This allows users to seamlessly check-in and claim rewards like mystery chests.</li><li><strong>Location-Based Features:</strong> CoreLocation also powers several other location-based features within the app. For example, when users open the app, it automatically detects their location and suggests nearby cafes. This personalized experience makes it easier for users to discover new places to work from.</li><li><strong>Privacy and Permissions:</strong> We prioritize user privacy by requesting location permissions only when necessary. Users are prompted to grant location access when they first attempt to leave a review or when they want to discover nearby cafes.</li><li><strong>Enhanced User Experience:</strong> By verifying user locations and providing accurate suggestions based on their proximity, CoreLocation significantly enhances the overall user experience. Users can trust that the reviews they read are genuine and can easily find cafes that are conveniently located.</li></ul><p>CoreLocation is integral to maintaining the authenticity of reviews on Cooworka, providing users with a trustworthy and seamless experience. By leveraging precise location data, we ensure that every review is credible and valuable to the community.</p><p><strong>4. CloudKit<br></strong>CloudKit is used to synchronize user-posted reviews across devices. This cloud-based solution allows users to access their reviews anytime, anywhere. It also ensures that all reviews are up-to-date and available to the entire community, fostering a rich and reliable resource of cafe information.</p><ul><li><strong>Real-Time Updates:</strong> CloudKit supports real-time data updates. When a user posts a new review or updates an existing one, the changes are instantly reflected across all devices and visible to the entire community. This real-time capability ensures that the latest information is always available to users, enhancing the app’s reliability and user engagement.</li><li><strong>User Authentication and Security:</strong> CloudKit works seamlessly with AuthenticationServices, particularly Sign In with Apple. This integration ensures that each user’s data is secure and tied to their unique User ID. Only authenticated users can access their data, providing a high level of security and privacy.</li><li><strong>Data Organization:</strong> Reviews and other user-generated content are organized efficiently within CloudKit. Each review is linked to the user’s unique ID, making it easy to manage and retrieve data. This organization also supports advanced querying capabilities, allowing users to search and filter reviews based on various criteria such as location, rating, and date.</li><li><strong>Collaboration Features:</strong> CloudKit also supports collaborative features. Users can rate each other’s reviews as helpful, fostering a community-driven environment. These interactions are also synchronized in real-time, enhancing community engagement and making the app more interactive.</li></ul><p>By leveraging CloudKit, Cooworka ensures that user-generated content is reliably stored, synchronized, and accessible, providing a robust foundation for the app’s review-based features. This cloud-based solution is crucial for maintaining data integrity, security, and scalability, ensuring a smooth and engaging user experience.</p><p><strong>5. PhotosUI<br></strong>We incorporate PhotosUI for photo picking from the gallery. Users can easily add photos to their reviews, providing visual context and making the reviews more informative and engaging. PhotosUI simplifies the process of selecting and uploading images, enhancing the overall user experience.</p><p><strong>6. Combine<br></strong>Combine is used for handling asynchronous events and data streams. This powerful framework allows us to manage real-time updates and interactions smoothly, ensuring that the app remains responsive and performs well under various conditions. Whether it’s fetching the latest reviews or updating user data, Combine helps keep everything running efficiently.</p><ul><li><strong>@Published Properties:</strong> Combine allows us to use @Published properties in our view models, which automatically notify SwiftUI views of any changes. This ensures that the UI is always up-to-date with the latest data, providing a responsive user experience.</li><li><strong>Data Binding:</strong> With Combine, we can bind our data streams to UI components, ensuring that any changes in data are immediately reflected in the UI. This is crucial for features like displaying search results and updating user reviews in real-time.</li><li><strong>Subscription Management:</strong> Combine helps manage subscription lifecycles with AnyCancellable, ensuring that resources are allocated efficiently and preventing memory leaks. This is particularly important for handling multiple asynchronous tasks without compromising performance.</li><li><strong>Asynchronous Operations:</strong> Combine excels at managing asynchronous operations, such as network requests or data fetching. In the context of Cooworka, Combine is used to fetch and update cafe information, synchronize user reviews, and handle location updates seamlessly.</li></ul><p>By leveraging Combine, Cooworka maintains a smooth and efficient user experience, handling real-time data updates and asynchronous tasks effectively.</p><p><strong>7. SwiftUI<br></strong>SwiftUI is the backbone of our user interface. With SwiftUI, we create dynamic, visually appealing, and user-friendly interfaces. Its declarative syntax and seamless integration with other Apple frameworks enable us to build a cohesive and intuitive app experience. SwiftUI also allows for rapid development and easy updates, keeping Cooworka fresh and engaging.</p><p><strong>8. Foundation<br></strong>Foundation is the core framework that provides essential data types, collections, and operating-system services. It’s the fundamental layer that supports the app’s functionalities. From managing data to handling network requests, Foundation ensures that all the underlying processes work smoothly and efficiently.</p><p>By leveraging these frameworks, we create an app that’s not only feature-rich but also reliable and user-friendly. Cooworka aims to provide a seamless experience for users to explore, review, and share their favorite cafes for working. With robust technical foundations and a focus on user engagement, we’re committed to making Cooworka the go-to app for WFC enthusiasts.</p><h4><strong>Code Explanation: MapKit &amp; CoreLocation for Searching Nearby Cafes</strong></h4><p>In our app, we use MapKit and CoreLocation to fetch and display nearby cafes based on the user’s current location. This integration provides users with a seamless experience when searching for and navigating to cafes suitable for working from cafes (WFC). Here’s how the code is structured and how each part contributes to the functionality:</p><p><strong>Initial Setup and Location Management</strong></p><pre>import Foundation<br>import Combine<br>import CoreLocation<br>import MapKit<br><br>class SearchViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {<br>    @Published var currentLocation: CLLocationCoordinate2D?<br>    @Published var searchCafeResults: [SearchCafe] = []<br>    @Published var nearbyCafeLocations: [SearchCafe] = []<br>    <br>    private var locationManager: CLLocationManager<br>    private var cancellable: AnyCancellable?<br>    <br>    override init() {<br>        self.locationManager = CLLocationManager()<br>        super.init()<br>        self.locationManager.delegate = self<br>        self.locationManager.desiredAccuracy = kCLLocationAccuracyBest<br>        self.locationManager.requestWhenInUseAuthorization()<br>        self.locationManager.startUpdatingLocation()<br>    }<br>}</pre><p>In this section, we import the necessary libraries and set up the SearchViewModel class. We declare published properties to hold the user’s current location, search results, and nearby cafe locations. The CLLocationManager is initialized to manage location updates, and its delegate is set to self.</p><p><strong>Requesting Current Location</strong></p><pre>func requestCurrentLocation() {<br>    self.locationManager.startUpdatingLocation()<br>}<br><br>func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {<br>    guard let location = locations.first else { return }<br>    self.currentLocation = location.coordinate<br>    self.locationManager.stopUpdatingLocation()<br>    self.fetchNearbyLocations(location: location)<br>}</pre><p>Here, we define a function to start updating the user’s location. When the location is updated, the didUpdateLocations delegate method is called, where we capture the first location, set it as the current location, and stop further updates. Then, we fetch nearby cafe locations based on this updated location.</p><p><strong>Searching Cafe Locations Based on User Query</strong></p><pre>func searchLocations(query: String) {<br>    let request = MKLocalSearch.Request()<br>    request.naturalLanguageQuery = query<br>    <br>    let search = MKLocalSearch(request: request)<br>    search.start { [weak self] response, error in<br>        guard let response = response else { return }<br>        self?.searchCafeResults = response.mapItems.compactMap {<br>            guard let name = $0.name,<br>                  let address = $0.placemark.title else {<br>                return nil<br>            }<br>            <br>            let rating = $0.pointOfInterestCategory == .cafe ? 4.5 : 4.0 // Dummy rating<br>            let totalRatings = Int.random(in: 1...10) // Dummy total ratings<br>            let openHours = &quot;09:00 - 22:00&quot; // Dummy open hours<br>            let distance = self?.calculateDistance(from: $0.placemark.coordinate) ?? 0.0<br>            let wifi = &quot;Wifi Kuat&quot;<br>            let powerOutlet = 2<br>            return SearchCafe(name: name,<br>                              coordinate: $0.placemark.coordinate,<br>                              address: address,<br>                              rating: rating,<br>                              totalRatings: totalRatings,<br>                              openHours: openHours,<br>                              distance: distance,<br>                              wifi: wifi,<br>                              powerOutlet: powerOutlet)<br>        }<br>    }<br>}</pre><p>This function handles the search functionality. It takes a user query, creates a search request, and performs the search using MKLocalSearch. The results are processed to extract relevant cafe information, such as name, address, rating, distance, WiFi quality, and power outlets, which are then stored in searchCafeResults.</p><p><strong>Fetching Nearby Cafe Locations</strong></p><pre>func fetchNearbyLocations(location: CLLocation) {<br>    let request = MKLocalPointsOfInterestRequest(center: location.coordinate, radius: 1000)<br>    request.pointOfInterestFilter = MKPointOfInterestFilter(including: [.restaurant, .cafe, .bakery])<br>    <br>    let search = MKLocalSearch(request: request)<br>    search.start { [weak self] response, error in<br>        guard let response = response else { return }<br>        self?.nearbyCafeLocations = response.mapItems.compactMap {<br>            guard let name = $0.name,<br>                  let address = $0.placemark.title else {<br>                return nil<br>            }<br>            <br>            let rating = $0.pointOfInterestCategory == .cafe ? 4.5 : 4.0<br>            let totalRatings = 0<br>            let openHours = &quot;09:00 - 22:00&quot; // Dummy open hours<br>            let distance = location.distance(from: CLLocation(latitude: $0.placemark.coordinate.latitude, longitude: $0.placemark.coordinate.longitude)) / 1000<br>            let wifi = &quot;Wifi Kuat&quot;<br>            let powerOutlet = 2<br>            return SearchCafe(name: name,<br>                              coordinate: $0.placemark.coordinate,<br>                              address: address,<br>                              rating: rating,<br>                              totalRatings: totalRatings,<br>                              openHours: openHours,<br>                              distance: distance,<br>                              wifi: wifi,<br>                              powerOutlet: powerOutlet)<br>        }<br>    }<br>}</pre><p>In this function, we fetch cafes near the user’s current location. We create a request with a specified radius and filter it to include restaurants, cafes, and bakeries. The search results are processed similarly to the search function, extracting relevant cafe details and storing them in nearbyCafeLocations.</p><p><strong>Calculating Distance</strong></p><pre>private func calculateDistance(from coordinate: CLLocationCoordinate2D) -&gt; Double {<br>    guard let currentLocation = currentLocation else {<br>        return 0.0<br>    }<br>    let currentCLLocation = CLLocation(latitude: currentLocation.latitude, longitude: currentLocation.longitude)<br>    let targetCLLocation = CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)<br>    return currentCLLocation.distance(from: targetCLLocation) / 1000 // Distance in km<br>}</pre><p>This utility function calculates the distance between the user’s current location and a given coordinate. The distance is calculated in kilometers and used to provide users with proximity information for nearby cafes.</p><p>This code integrates MapKit and CoreLocation to provide a comprehensive solution for searching and displaying nearby cafes. The SearchViewModel manages the user’s location, performs searches based on user queries, fetches nearby cafes, and calculates distances, all of which enhance the user experience by providing detailed and relevant cafe information for WFC activities.</p><h4><strong>Code Explanation: MapKit &amp; CoreLocation for Searching Locations</strong></h4><p>In this example, we use MapKit and CoreLocation to fetch and display locations based on the user’s current position. This integration allows users to search for specific locations and fetch nearby places, providing a seamless and engaging user experience. Here’s how the code is structured and what each part does:</p><p><strong>Initial Setup and Location Management<br></strong>The initial setup and location management code are the same as in the previous example for searching nearby cafes. We initialize the LocationViewModel class, declare published properties to hold the user’s current location, search results, and nearby locations, and set up the CLLocationManager to manage location updates.</p><p><strong>Requesting Current Location<br></strong>The code for requesting the current location and updating it is also the same as in the previous example. This part of the code starts updating the user’s location and stops once the location is fetched. It then calls the function to fetch nearby locations based on the current location.</p><p><strong>Search Locations</strong></p><pre>func searchLocations(query: String) {<br>    let request = MKLocalSearch.Request()<br>    request.naturalLanguageQuery = query<br>    <br>    let search = MKLocalSearch(request: request)<br>    search.start { [weak self] response, error in<br>        guard let response = response else { return }<br>        self?.searchResults = response.mapItems.compactMap {<br>            Location(name: $0.name ?? &quot;Unknown&quot;, coordinate: $0.placemark.coordinate)<br>        }<br>    }<br>}</pre><p><strong>Search Locations:</strong> The searchLocations function allows users to search for specific places based on a query. It uses MKLocalSearch to perform the search and then processes the results to extract names and coordinates.</p><p><strong>Fetching Nearby Locations</strong></p><pre>func fetchNearbyLocations(location: CLLocation) {<br>    CLGeocoder().reverseGeocodeLocation(location) { [weak self] placemarks, error in<br>        guard let placemark = placemarks?.first else { return }<br>        var nearbyLocations: [Location] = []<br>        <br>        if let areasOfInterest = placemark.areasOfInterest {<br>            for area in areasOfInterest {<br>                nearbyLocations.append(Location(name: area, coordinate: placemark.location!.coordinate))<br>            }<br>        }<br>        <br>        if let locality = placemark.locality {<br>            nearbyLocations.append(Location(name: locality, coordinate: placemark.location!.coordinate))<br>        }<br>        <br>        if let subLocality = placemark.subLocality {<br>            nearbyLocations.append(Location(name: subLocality, coordinate: placemark.location!.coordinate))<br>        }<br>        <br>        self?.nearbyLocations = nearbyLocations<br>    }<br>}</pre><p><strong>Fetch Nearby Locations:</strong> The fetchNearbyLocations function uses reverse geocoding to fetch nearby areas of interest, such as districts, cities, and other local points of interest. It processes the placemark results to extract relevant location names and coordinates.</p><p>By using both MKLocalSearch for querying specific locations and CLGeocoder for reverse geocoding nearby points of interest, we provide a comprehensive solution for finding and displaying locations based on the user’s current position.</p><h4>Code Explanation: Animation</h4><p><strong>Animation for treasure chest &amp; mystery reward<br></strong>For the animation when opening the treasure chest, I used a rotation effect to create a shaking motion when the user taps on it. Once the shaking stops, the mystery reward appears and animates from the chest to the top. This animation is achieved by adjusting the offset of the reward element.</p><p>Here’s the code for the animation:</p><pre>if isChestOpen{<br>                    HStack {<br>                        ZStack{<br>                            Text(&quot;+\(totalPoint) XP&quot;)<br>                                .font(.subheadline)<br>                                .zIndex(1)<br>                                .foregroundColor(.buttonClaimChest)<br>                                .offset(y: 15)<br>                            <br>                            Image(&quot;RewardPointKuning&quot;)<br>                                .resizable()<br>                                .frame(width: 125, height: 75)<br>                        }<br>                        .scaleEffect(scale)<br>                        .offset(x: offsetX, y: offsetY)<br>                        .opacity(opacity)<br>                        <br>                        ZStack{<br>                            Text(&quot;Kacamata&quot;)<br>                                .font(.subheadline)<br>                                .zIndex(1)<br>                                .foregroundColor(.buttonClaimChest)<br>                                .offset(y: 15)<br>                            <br>                            Image(&quot;Kacamata&quot;)<br>                                .resizable()<br>                                .frame(width: 125, height: 65)<br>                                .padding(.top, 10)<br>                        }<br>                        .scaleEffect(scale)<br>                        .offset(x: -offsetX, y: offsetY)<br>                        .opacity(opacity)<br>                    }<br>                    .onAppear {<br>                        withAnimation(.spring(response: 1.5, dampingFraction: 1.5, blendDuration: 0.5)) {<br>                            scale = 1<br>                            offsetY = -170<br>                            offsetX = -3<br>                            opacity = 1<br>                        }<br>                    }<br>                }</pre><p><strong>Animation for Level Character<br></strong>As for the animation for Level Character, this animation works by updating the current level number when the next or previous button is clicked. This changes the displayed level name and character name to match the current level. Additionally, the character element appears larger when presented at the current level. These changes create the effect of a horizontal scroll without actually scrolling, as scrolling is disabled. Instead, the transition is triggered by pressing the next or previous button.</p><pre>ScrollViewReader { proxy in<br>                                    ScrollView(.horizontal){<br>                                        VStack (alignment: .leading){<br>                                            HStack(spacing: 75) {<br>                                                ForEach(levels, id: \.noLevel) { level in<br>                                                    Image(level.imageName)<br>                                                        .resizable()<br>                                                        .aspectRatio(contentMode: .fit)<br>                                                        .frame(width: 175)<br>                                                        .scaleEffect(currentLevel == level.noLevel ? 1.1 : 0.9)<br>                                                    <br>                                                }<br>                                            }<br>                                            .padding(.leading, 110)<br>                                            .padding(.bottom, 20)<br>                                            .padding(.top, 20)<br>                                            <br>                                            <br>                                            <br>                                            <br>                                            ZStack (alignment: .leading){<br>                                                RoundedRectangle(cornerRadius: 25)<br>                                                    .frame(width: CGFloat(userProgress.xp) / 1000 * 258, height: 10)<br>                                                    .padding()<br>                                                    .zIndex(0.5)<br>                                                    <br>                                                    .overlay(<br>                                                        LinearGradient(gradient: Gradient(colors: [.lightYellow, .darkYellow]), startPoint: .leading, endPoint: .trailing))<br>                                                    .mask(RoundedRectangle(cornerRadius: 25)<br>                                                        .frame(width: CGFloat(userProgress.xp) / 1000 * 258, height: 10))<br>    <br>                                                RoundedRectangle(cornerRadius: 25)<br>                                                    .frame(width: 2070, height: 14)<br>                                                    .padding(.horizontal, 15)<br>                                                    .foregroundColor(.white)<br>                                                <br>                                                <br>                                                HStack(spacing: 205){<br>                                                    ForEach(levels, id: \.noLevel){ level in<br>                                                        ZStack {<br>                                                            Image(&quot;PointBorder&quot;)<br>                                                                .resizable()<br>                                                                .frame(width: 46, height: 46)<br>                                                            <br>                                                            <br>                                                            Text(&quot;\(level.pointsToUnlock) XP&quot;)<br>                                                                .multilineTextAlignment(.center)<br>                                                                .frame(width: 40)<br>                                                                .font(.system(size: 7, weight: .regular))<br>                                                                .offset(y: 2)<br>                                                        }<br>                                                        <br>                                                    }<br>                                                    <br>                                                }<br>                                                .padding(.leading, 178)<br>                                                .padding(.trailing, 178)<br>                                                .zIndex(1)<br>                                            }<br>                                        }<br>                                    }<br>                                    .disabled(true)<br>                                    .onChange(of: currentLevel) { newValue in<br>                                        withAnimation {<br>                                            proxy.scrollTo(newValue, anchor: .center)<br>                                        }<br>                                    }<br>                                }</pre><p><strong>Animation for pop-up page shrinking<br></strong>For the pop-up that shrinks towards the activity icon, I used the offset property to create the animation. The offset is carefully adjusted to align with the position of the activity icon, ensuring a smooth and precise animation effect.</p><pre>Button(action: { <br>                                withAnimation(.spring(response: 0.5, dampingFraction: 2, blendDuration: 0.6)) {<br>                                    scale = 0.1<br>                                    offsetY = 390<br>                                    offsetX = 0<br>                                    backgroundOpacity = 0<br>                                    opacity = 0<br>                                }<br>                                DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {<br>                                    <br>                                    isActive = false<br>                                    <br>                                }<br>                            }) {<br>                                Text(&quot;Nanti aja&quot;)<br>                                    .font(.system(size: 14, weight: .regular))<br>                                    .foregroundColor(.blue)<br>                            }<br>                            .padding(.top, 2)</pre><p><strong>Animation for rating, price range, and yes/no button<br></strong>For the animations for rating and WiFi, we use a ForEach loop to configure the components. For the <strong>rating</strong>, if button number 3 is selected, the first three stars become filled. This is achieved using the filled parameter in the StarRatingComponent, which determines whether the star is filled. The filled parameter is set by comparing the current index of the loop to the selected rating. If the index is less than or equal to the rating, the filled parameter is set to true.</p><p>Here’s the code for the rating component:</p><pre>HStack {<br>                ForEach(1..&lt;6) { index in<br>                    StarRatingComponent(filled: index &lt;= rating, label: labels[index-1])<br>                        .onTapGesture {<br>                            if rating == 0{<br>                                onRatingChange()<br>                            }<br>                            rating = index<br><br>                        }<br>                }<br>            }</pre><p>For the <strong>price range</strong> rating, when a rating button is selected, it changes color and the background becomes a blue rectangle. This effect is achieved using the HargaElement component, which includes an isSelected parameter. The isSelectedparameter is set to true when the selectedLabel matches the label. Here’s the code:</p><pre>var body: some View {<br>        VStack{<br>            HStack{<br>                Text(&quot;Harga&quot;)<br>                    .font(.subheadline)<br>                    .fontWeight(.regular)<br>                    .padding(.bottom, 5)<br>                <br>                Spacer()<br>            }<br>            HStack(spacing: 2) {<br>                ForEach(labels, id: \.self) { label in<br>                    HargaElement(label: label, isSelected: selectedLabel == label){<br>                        handleSelection(label)<br>                    }<br>                }<br>            }<br>            <br>        }<br>    }<br>    <br>    private func handleSelection(_ label: String) {<br>        if selectedLabel != label {<br>            selectedLabel = label<br>            print(&quot;Selected label: \(label)&quot;)<br>            <br>            if !hasChanged {<br>                onFirstTap()<br>                hasChanged = true<br>            }<br>        }<br>    }</pre><p>For the <strong>yes/no button</strong> component, the logic of the button selected is also the same as before. However, we use the onChange modifier to ensure that the button can only be selected one at the same time.</p><pre>HStack{<br>                YesOrNoRating(label: &quot;Ada&quot;, isSelected: $ada)<br>                <br>                YesOrNoRating(label: &quot;Gak Ada&quot;, isSelected: $gakAda)<br>            }<br>            .onChange(of: ada) { newValue in<br>                if newValue {<br>                    gakAda = false<br>                    if !hasChanged {<br>                        onRatingChange()<br>                        hasChanged = true<br>                    }<br>                }<br>            }<br>            .onChange(of: gakAda) { newValue in<br>                if newValue {<br>                    ada = false<br>                    if !hasChanged {<br>                        onRatingChange()<br>                        hasChanged = true<br>                    }<br>                }<br>            }</pre><h4>Struggle in Using CloudKit</h4><p>In the Cooworka app, we utilize CloudKit to save and fetch data from iCloud, ensuring that every user can access the same data in real-time. Working with CloudKit presented significant challenges, as it was a new technology for us. Although we successfully managed to save and fetch data from the cloud, we encountered several errors when searching the data. Due to time constraints, we had to implement a temporary solution by filtering the data after fetching it. While this was not ideal, it allowed us to maintain a functioning app as we worked on a more efficient solution. Here is the code we used for saving and fetching data in our app:</p><pre> func save(record: T, recordType: String, completion: @escaping (Result&lt;T, Error&gt;) -&gt; Void) {<br>        let ckRecord = record.toCKRecord(recordType: recordType)<br>        <br>        database.save(ckRecord) { savedRecord, error in<br>            if let error = error {<br>                completion(.failure(error))<br>            } else if let savedRecord = savedRecord {<br>                let savedModel = T(record: savedRecord)<br>                completion(.success(savedModel))<br>            }<br>        }<br>    }<br>    <br>    func fetch(recordType: String, completion: @escaping (Result&lt;[T], Error&gt;) -&gt; Void) {<br>        let query = CKQuery(recordType: recordType, predicate: NSPredicate(value: true))<br>        <br>        database.perform(query, inZoneWith: nil) { records, error in<br>            if let error = error {<br>                completion(.failure(error))<br>            } else if let records = records {<br>                let models = records.map { T(record: $0) }<br>                completion(.success(models))<br>            }<br>        }<br>    }</pre><h3><strong>Our Learnings from Developing Cooworka</strong></h3><p><strong>1. Narrowing Focus for Better Results<br></strong>In the early stages, we cast a wide net, exploring all of Indonesia. However, we quickly realized from our interviews that our participants did not travel routinely across the country and had varied characteristics. This broad target audience made it difficult to address specific needs and provide relevant solutions. From this, we learned the importance of narrowing our focus to better understand and meet user needs. We discovered a recurring pattern among some of our interviewees: many expressed frustration when searching for suitable cafes as places to work from. They struggled to find reliable information about essential factors such as power outlets, wifi quality, and the comfort of chairs and tables. Users often resorted to zooming in on Google images to spot power outlets and reading multiple reviews across different sites for any mention of wifi quality, typically with disappointing results.</p><p>These common pain points highlighted a significant gap in the market and inspired us to develop Cooworka. By narrowing our focus and targeting specific user needs, we learned that we could deliver a more effective and valuable product. This approach allowed us to address specific pain points more accurately and create a tailored solution that met our users’ needs, ultimately achieving better results.</p><p><strong>2. Power of Gamification<br></strong>During development, we realized how powerful gamification could be in enhancing user engagement. We discovered that incorporating gamified elements goes beyond adding game-like features; it involves creating a system that drives user interaction and fosters habitual use. By integrating a gamified experience into Cooworka, we encouraged users to actively share their reviews and explore new cafes, transforming mundane tasks into enjoyable activities. This approach made the app more engaging and interactive, demonstrating that a well-designed gamified system can significantly boost user participation and satisfaction.</p><p><strong>3. Enhancing User Flow<br></strong>Optimizing the user flow to simplify the review-writing process and keep users engaged was another significant challenge. Initially, some pages had redundant components, making the process cumbersome. To address this, we conducted multiple brainstorming sessions and employed the Crazy Eight technique. Additionally, we integrated micro-interactions to enhance the user experience, making the app more intuitive and enjoyable to use. These efforts highlighted the importance of detailed attention to user flow and interface design in creating a seamless and engaging user experience.</p><p><strong>4. Learning New Technical Frameworks<br></strong>Developing Cooworka provided us with the opportunity to learn and leverage several new technical frameworks. We utilized AuthenticationServices for Apple sign-in, MapKit for location data and cafe addresses, CoreLocation for user locations, CloudKit for synchronizing user-posted reviews, and PhotosUI for selecting photos from the gallery. Additionally, we employed Combine and SwiftUI for overall app development. Each of these frameworks played a significant role in the functionality and user experience of Cooworka. This process enhanced our technical skills and provided us with valuable insights into effective application development.</p><p><strong>5. Effective Version Control<br></strong>We also encountered frequent conflicts with Git, which initially posed a significant challenge. However, by adhering to a strict protocol of pull, commit, push, and then pull request, we learned to minimize these conflicts. This disciplined approach improved our workflow and ensured smoother collaboration among team members. Our experience with Git taught us the value of effective version control practices and the importance of establishing clear protocols to minimize conflicts and improve team collaboration.</p><p><strong>6. Dedication and Iteration<br></strong>Despite numerous struggles, our dedication and iterative approach were key to our success. We learned the importance of perseverance, continuous improvement, and user-centric design. Our commitment to these principles enabled us to develop Cooworka, a platform that effectively addresses the common issues faced by WFC users and enhances their experience through a thoughtfully designed, gamified system. This journey taught us the value of listening to user feedback, being adaptable, and constantly refining our product to meet user needs, reinforcing that a user-focused, iterative development process is essential for creating a successful and impactful product.</p><h3>What’s Next?</h3><p>For further development, we aimed to add more gamification features to engage more new users and keep the current users being active. One exciting feature we’re planning is a dynamic leaderboard. This leaderboard will rank users based on the helpfulness of their reviews, as determined by the number of people who find their insights valuable. The more helpful reviews you write, the higher you’ll ascend, with the ultimate goal of claiming the top spot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-g5JqmvW33KMAc_1" /></figure><p>In addition, we’re introducing a variety of badges to reward users who consistently review specific topics. For example, if you frequently assess the wifi quality at different cafes, you’ll earn the prestigious “Wifi Hunter” badge. These badges not only recognize your expertise but also encourage you to provide more detailed and valuable reviews, enhancing the overall experience for everyone.</p><h3><a href="https://medium.com/@felicianhw/share-your-perfect-workspace-cooworkas-engaging-review-system-part-1-76d8d8275404">Click here to read Part 1!! Thank You</a></h3><p>© 2024 Aileen Chalina Wijaya, Lucinda Artahni, Natasha Hartanti Winata, Shazkia Aulia Shafira Dewi, Sherly Phangestu. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79a0fb0f93fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Share Your Perfect Workspace: Cooworka’s Engaging Review System — Part 1]]></title>
            <link>https://medium.com/@felicianhw/share-your-perfect-workspace-cooworkas-engaging-review-system-part-1-76d8d8275404?source=rss-88b48152ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/76d8d8275404</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mobile-application]]></category>
            <category><![CDATA[gamification]]></category>
            <category><![CDATA[ui-ux-design]]></category>
            <category><![CDATA[mapkit]]></category>
            <dc:creator><![CDATA[Natasha Hartanti Winata]]></dc:creator>
            <pubDate>Fri, 05 Jul 2024 09:43:41 GMT</pubDate>
            <atom:updated>2024-07-05T09:46:12.331Z</atom:updated>
            <content:encoded><![CDATA[<h3>Share Your Perfect Workspace: Cooworka’s Engaging Review System — Part 1</h3><h3><strong>Cooworka Overview</strong></h3><p>Cooworka is an application that encourages people to share their experiences of working from cafes by writing reviews through an engaging gamified app experience.</p><h3>Role</h3><p><a href="http://www.linkedin.com/in/lucinda-artahni">Lucinda Artahni— IOS Developer</a><br><a href="https://www.linkedin.com/in/natasha-hartanti-winata/">Natasha Hartanti Winata — IOS Developer</a><br><a href="https://www.linkedin.com/in/sherly-phangestu/">Sherly Phangestu— IOS Developer</a><br><a href="http://www.linkedin.com/in/aileenchalinawijaya/">Aileen Chalina Wijaya— UI/UX Designer, Illustrator</a><br><a href="https://www.linkedin.com/in/shazkiaaulia/">Shazkia Aulia Shafira Dewi— UI/UX Designer</a></p><h3>My role &amp; responsibility</h3><p>Hey there, I’m <strong>Natasha</strong>! <br>In this project, I worked as an IOS Developer and UX Researcher, some of my responsibilities:</p><ul><li>Conduct user research and validate problems with the users.</li><li>Prioritize features for the first iteration of the application.</li><li>Develop the front end of the iOS application.</li><li>Create system logic to fetch and display data for nearby cafes and cafes matching user queries.</li><li>Create system logic to fetch and display location data for regions and cities.</li><li>Implement Sign-In with Apple and securely store user data.</li><li>Lead team progress check-ins and ensure milestones are met.</li></ul><p>It’s impossible to create an app without doing research, right? Before developing a mobile app, we conduct research to enhance our ability to solve problems, understand the target audience, and provide a better user experience.</p><h3>Identifying Problem</h3><p>We begin with the brainstorming ideas. We looked for some interesting topics, and we considered several options such as finances, daily work, and travel. We agree that travel has the potential to incorporate gamified concepts. So, the important question is: How do we enhance enthusiasm for traveling through a gamified app? After exploring the possibilities, we initially decided to make an app for exploring Indonesia. But our research doesn’t end there. Due to several considerations during this process, we revised our goals multiple times.</p><p>In the next steps, we created guiding questions to deepen our understanding of the topic. This was followed by desk research and interviews to identify the problems people face when exploring tourism in Indonesia. After conducting several interviews, we found that there are no significant pain points for exploring tourism in Indonesia. Some people are not interested in traveling due to external factors, such as the condition of tourist attractions, and internal factors, such as money and time. Therefore, we concluded that this topic cannot be used for a gamified application.</p><p>After doing some research, we found that many people face difficulties when searching for suitable cafes to work from due to a lack of detailed information about essential facilities. Key aspects such as the availability of power sockets, the quality of the wifi, and the comfort of chairs and tables are crucial for remote workers but are often not readily available. Without this information, finding a work-friendly cafe can be frustrating.</p><p>To understand where this information could come from, we looked into common sources and discovered that most individuals rely on online reviews to get an idea about a cafe’s amenities and overall environment. Reviews often contain valuable insights from other patrons, making them a potential goldmine for the specific details needed by those working remotely. Realizing this opportunity, we saw that leveraging these reviews could provide remote workers with the detailed information they need. However, we also identified a significant barrier: many people are reluctant to write reviews due to the lack of rewards or incentives, the long process of review, and a general feeling of unappreciation. Therefore, our problem statement is this:</p><blockquote>We aim to create <strong>an app that encourages people to share their experiences of working from cafes by writing reviews through an engaging gamified experience.</strong></blockquote><p>By seamlessly integrating exploration and review processes, our app not only makes it easier for users to find the best cafes but also motivates them to contribute valuable insights in a fun and rewarding way.</p><p>To overcome these challenges, we explored the concept of gamification as a means to motivate people to contribute reviews. Gamification involves adding game-like elements such as points, badges, and leaderboards to non-game contexts, which can make the process more engaging and rewarding. By incorporating these elements, we aim to encourage more users to share their experiences. Additionally, we designed a review form that is straightforward and easy to complete, ensuring it captures all the essential information needed for working from cafes without being overly time-consuming.</p><blockquote>Our solution is an <strong>app that motivates people to share their work-from-cafe experiences by writing a review in a gamified app, simplifying the review process and creating a community-driven resource to help remote workers find the best cafes for their needs.</strong></blockquote><h3>Our Process</h3><h4>User Persona</h4><p>We’ve developed a user persona for our potential users, Max, A remote worker who enjoys helping others, easily gets bored, prefers working outside the home, and likes exploring new places. He has pain points such as crowded cafes, unreliable Wi-Fi, limited power outlets, incomplete information on cafe facilities for working, low motivation to leave reviews, time-consuming cafe research, and complicated review processes. On the other hand, he also has a gain points such as looking for comfortable and productive work environments, reliable cafe information, an easy method to find suitable places to work, discovering inspiring locations, sharing their experiences, and providing feedback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XOgU1Hl2aJDnhg_qZgd42Q.jpeg" /><figcaption>User Persona</figcaption></figure><h4>Customer Journey Map</h4><p>After defining our persona, we moved on to creating a <strong>Customer Journey Map</strong>. The customer journey map is divided into two parts: <strong>the current state</strong>, which shows the user’s journey with the current solutions, highlighting the pain points in each phase, and <strong>the ideal state</strong>, which illustrates the user’s journey when using our app, Cooworka.</p><p><strong>Current State</strong><br>The current state consists of four phases: researching cafes, activities at the destination, writing reviews, and retention. The existing solutions for the phases of researching cafes and activities at the destination involve using social media and search engines. However, the pain points for users lie in the phases of writing reviews and retention, with the existing solution being Google Maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GGL06lodbO2_e2xw" /><figcaption>Customer Journey Map — Current State</figcaption></figure><p><strong>Writing Reviews Phase:</strong><br>Users face several lengthy actions:</p><ul><li>After finding the cafe name, they must scroll down to find the text box for writing a review.</li><li>They need to rate overall experience, food, atmosphere, and provide detailed experience, photos, and food details.</li></ul><p>Despite the lengthy questions, there are no questions related to WFC (Working From Cafe), such as WiFi quality, the number of power outlets, and seating comfort. Additionally, users do not receive tangible rewards, leading to disappointment and a feeling that writing reviews is not beneficial. This extends into the retention phase, where users feel demotivated to write reviews due to a lack of personal benefits.</p><p><strong>Ideal State<br></strong>This issue can be addressed through gamification to motivate users to complete reviews, especially those related to WFC aspects like WiFi quality, the number of power outlets, and seating comfort. In the ideal state, we focus on motivating users during the review-writing and retention phases using Cooworka.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KRUHJByXsGrjEClV" /><figcaption>Customer Journey Map — Ideal State</figcaption></figure><p><strong>Addressing the Core Issues<br></strong>Upon deeper analysis, we realized that exploration and reviews are inseparable. The act of exploring cafes and writing reviews is a continuous cycle where each phase influences the other. Solving the core issue starts from the research cafe phase and extends to the activities at the destination.</p><p>Initially at the research cafe phase, users look for recommendations and read detailed information about cafes to decide where to work. They seek specific details that support WFC (Working From Cafe) activities, such as:</p><ul><li><strong>WiFi Quality:</strong> Users need reliable and fast internet to work efficiently.</li><li><strong>Number of Power Outlets:</strong> Availability of power outlets is crucial for charging devices and ensuring uninterrupted work sessions.</li><li><strong>Seating Comfort:</strong> Comfortable seating is important for long working hours.</li><li><strong>Other Facilities:</strong> Additional facilities like quiet ambiance, and available refreshments also play a significant role.</li></ul><p>Currently, finding this detailed information can be cumbersome and scattered across different platforms, making it difficult for users to get a comprehensive view of the best cafes for WFC.</p><p><strong>Gamification Process<br></strong>The gamification process starts at the activities at the destination phase, making the user journey more engaging and rewarding.</p><p><strong>1. Seamless Check-In:<br></strong>When users arrive at the cafe, our app makes the check-in process engaging by allowing them to seamlessly check in by claiming a mystery chest upon arrival, which remains locked initially. Users then choose a seat near a power outlet and begin their WFC activities. The excitement of unlocking the chest by writing a review adds an element of fun and motivation.</p><p><strong>2. Writing Reviews:<br></strong>To unlock the mystery chest, users must write a review. While writing reviews with our app, users receive notifications to leave a review. The review form is easy to fill out and focuses on WFC details like WiFi quality, number of power outlets, seating comfort, and other supportive WFC information. The more detailed the review, the more XP the user earns!</p><p><strong>3. Rewards and Retention:<br></strong>Users not only earn XP, they also collect cute accessories and collectible items that can be used to customize their avatars. This leads to increased motivation to write reviews and collect rewards, enhancing user retention.</p><p>By integrating gamification, we aim to solve the pain points in the review-writing and retention phases, transforming the user experience into an engaging and rewarding journey. This experience motivates them to write reviews, which in turn helps others in the research phase, creating a virtuous cycle.</p><h4>Competitor Analysis</h4><p>Beside conducting interviews, we undertook a comprehensive investigation to identify our competitors that offer similar features to those in our app. We analyzed these competitor apps to determine what specific attributes and functionalities make them popular and widely used by people seeking cafes. This involved comparing several leading applications commonly used by people when searching for a cafe to visit.</p><p>Furthermore, our analysis extended beyond identifying strengths; we also focused on uncovering the pain points and drawbacks users experience with these competing apps. By pinpointing areas where these apps fall short, we aimed to gain critical insights that would allow us to address and improve these issues in our own app. Our goal was to not only match but exceed the user experience provided by our competitors, ensuring our app stands out as the superior choice for cafe enthusiasts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9lwkCXTs5YqF6yw6" /><figcaption>Competitor Analysis</figcaption></figure><h4>Determine Gamification Elements Using Octalysis</h4><p>Octalysis, developed by Yu-kai Chou, is a comprehensive framework for understanding and designing engaging user experiences through gamification. It breaks down the concept of gamification into eight core drives: Epic Meaning &amp; Calling, Development &amp; Accomplishment, Empowerment of Creativity &amp; Feedback, Ownership &amp; Possession, Social Influence &amp; Relatedness, Scarcity &amp; Impatience, Unpredictability &amp; Curiosity, and Loss &amp; Avoidance. Each drive addresses a different aspect of human motivation, providing a balanced approach to designing activities that are not only enjoyable but also intrinsically motivating.</p><p>We brainstormed a variety of gamification elements that we believed would enhance the user experience in our app. The first element we focused on is Development &amp; Accomplishment. To bring this to life, we decided to implement a level system where users can earn experience points (XPs) through their activities. As users accumulate XPs, they can level up, providing a clear and rewarding sense of progression and achievement. Additionally, we planned to introduce a competitive edge by incorporating a leaderboard. This feature will allow users to compete with one another for the top rank, fostering a healthy competitive spirit and encouraging ongoing engagement.</p><p>The second element we explored is Ownership &amp; Possession, which we plan to execute by offering a collection of virtual items that users can acquire. These items will be obtained through a mysterious process, where users won’t know in advance which item they will receive. This element of surprise not only taps into the Ownership &amp; Possession drive but also integrates the Unpredictability &amp; Curiosity aspect of gamification. By keeping the item acquisition process unpredictable, we aim to maintain a high level of excitement and anticipation among users, motivating them to continue using the app and discovering new items.</p><h4>Gamification Analysis</h4><p>Based on the research and gamification elements we have defined, we have compiled our findings and detailed them in this gamification design template. This template helps us clearly outline our objectives, user persona, desired actions, feedback mechanisms, and the rewards provided through our gamification strategy. By creating this template, we aim to seamlessly integrate our research findings, ensuring that we can more precisely define the gamification aspects of our solution. Additionally, it allows us to better articulate the rewards system, making the gamification elements clearer and more impactful for our users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*42iH4wckGOVB2bvf.png" /><figcaption>Gamification Analysis</figcaption></figure><h3><strong>Introducing Our Solution Concept: Cooworka! </strong>🎊</h3><p>After an extensive research journey, we’re excited to present Cooworka — an innovative app that revolutionizes the way people share their experiences of working from cafes through an engaging gamified approach.</p><p><strong>Explore What Cooworka Offers:</strong></p><ol><li><strong>Find Your Ideal Cafe </strong><br>Discover nearby cafes tailored to your work preferences with Cooworka’s comprehensive search feature. Whether you need strong wifi, ergonomic seating, meeting rooms, smoking areas, parking facilities, places of worship, or reliable electricity, Cooworka helps you find the perfect spot to work.</li><li><strong>Detailed Cafe Insights </strong><br>Dive into comprehensive details about cafes, including ratings, electricity availability, wifi quality, pricing, exact location, operating hours, and amenities like ergonomic furniture, meeting rooms, smoking area, and parking facilities.</li><li><strong>Earn Rewards by Sharing<br></strong> Engage with Cooworka’s rewarding gamification system where each review unlocks mysterious rewards stored in chests. Receive reminders to claim rewards, motivating ongoing participation and enhancing your cafe exploration.</li><li><strong>Streamlined Review Process</strong><br>Simplify your experience with Cooworka’s intuitive review form. Rate and provide detailed feedback on wifi strength, power outlets, comfort levels, and more. Earn XP for thorough reviews and improved interaction.</li><li><strong>Valuing User Feedback</strong><br>At Cooworka, user reviews are invaluable guides that inform others. Each review uncovers top cafes and highlights amenities like reliable wifi, comfortable seating, parking availability, and more. As reviews accumulate, they dynamically capture evolving experiences, offering real-time insights that enrich cafe exploration. User feedback drives visible improvements, empowering users to make informed choices and contribute to our vibrant cafe community.</li><li><strong>Personalize Your Avatar</strong><br>Customize your digital presence with rewards from Cooworka. Unlock accessories and outfits by writing reviews and leveling up with earned XP, creating a unique digital persona that grows with your contributions.</li></ol><h3>Visualization Process 🎨</h3><h4>Brand design</h4><p>Cooworka exists to help users easily share their reviews and insights about cafes. Designed to foster a sense of community, productivity, and trustworthiness, Cooworka thrives on human insight. The Cooworka logo features a chat bubble and a parrot, symbolizing the community we build and the sharing of valuable information. The blue in the logo signifies trustworthiness, and the Sans-Serif font is chosen to convey a friendly, enjoyable, and minimalist feel. We use Nunito for title and sub title, and SF Pro for the body text. We have develop a design system to ensure efficient and consistent design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GsM3bUEizPHXwUE9HUK3pg.gif" /><figcaption>Cooworka App Logo</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RZFC4SYm74imYtYLFAHs9g.png" /><figcaption>Font and Color Palette</figcaption></figure><h4>Design (Lo-Fi &amp; Hi-Fi)</h4><p>After finalizing the brand design, we proceeded to design the user flow and create the low-fidelity and high-fidelity versions of the app. Our goals for this application are:</p><p>1. Minimize fake reviews by implementing a “check-in process.” Users can review cafes only if they open the app and press the check-in button, which is active only when they are in the cafe.</p><p>2. Motivate users to complete the review fields by adding an XP counter to increase user engagement.</p><p>3. Avoid confusion when users enter the application by providing cafe recommendations based on categories.</p><p>This goal helps us to determine the UI/UX design that will be created. We start with brainstorming and sketching, and once we believe it’s sufficient, we proceed to develop it into a high-fidelity design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwIR1ywEgg6cgzCZtNI-3g.gif" /><figcaption>Lo-Fi &amp; Hi-Fi Comparison</figcaption></figure><p>Cooworka relies heavily on user feedback. We aim to create an application that is easy to use and enjoyable. Therefore, we conduct user testing with our target audience. Check out the next part to see how users feel about Cooworka!</p><h3><a href="https://medium.com/@felicianhw/share-your-perfect-workspace-cooworkas-engaging-review-system-part-2-79a0fb0f93fe">Click here to read Part 2!!</a></h3><p>© 2024 Aileen Chalina Wijaya, Lucinda Artahni, Natasha Hartanti Winata, Shazkia Aulia Shafira Dewi, Sherly Phangestu. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76d8d8275404" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CareGuard: Health Monitoring App with Custom SOS, Messaging, Calls, and Location Tracking on Apple…]]></title>
            <link>https://medium.com/@felicianhw/careguard-health-monitoring-app-with-custom-sos-messaging-calls-and-location-tracking-on-apple-c44f39c75a94?source=rss-88b48152ff7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c44f39c75a94</guid>
            <category><![CDATA[watchkit]]></category>
            <category><![CDATA[healthkit]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[emergency-response]]></category>
            <category><![CDATA[health-monitoring]]></category>
            <dc:creator><![CDATA[Natasha Hartanti Winata]]></dc:creator>
            <pubDate>Fri, 31 May 2024 01:36:34 GMT</pubDate>
            <atom:updated>2024-05-31T01:45:22.544Z</atom:updated>
            <content:encoded><![CDATA[<h3>CareGuard: Health Monitoring App with Custom SOS, Messaging, Calls, and Location Tracking on Apple Watch</h3><p>I often use Apple’s native Health application to monitor my well-being. While the app offers excellent features, I noticed significant gaps in its alert system, especially concerning blood oxygen levels and heart rates. The Apple Watch can notify users about abnormal heart rates, but it lacks the capability to trigger emergency responses or alert about low blood oxygen levels. This deficiency is particularly critical for the elderly, who may not exhibit visible symptoms during emergencies and cannot be constantly monitored by caregivers.</p><p>To address these concerns, I developed <strong>CareGuard</strong>, an advanced health monitoring app designed for Apple Watch. CareGuard focuses on providing <strong>real-time alerts for dangerously low blood oxygen levels and abnormal heart rates, ensuring that elderly users receive timely assistance during emergencies</strong>. If the user fails to respond to the alert within <strong>30 seconds</strong>, the app automatically <strong>triggers an SOS call to emergency services and sends the user’s location</strong> to designated contacts, such as family members, caregivers, or doctors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wI0BLWv4pKG5vqXBVXMXXg.png" /><figcaption>App Preview — Main features</figcaption></figure><p>However, during the development of this app, I encountered several limitations:</p><ul><li><strong>Third-party apps cannot directly start measuring blood oxygen levels</strong>; they can only fetch existing data from HealthKit. The measurement must be initiated through Apple’s built-in “Blood Oxygen” app.</li><li><strong>Third-party apps cannot trigger Apple’s built-in SOS feature</strong>.</li><li><strong>Third-party apps cannot automatically call or send messages without user confirmation.</strong> This restriction is in place to prevent unauthorized actions by third-party apps, requiring user confirmation for such actions.</li></ul><p>Due to these limitations, the blood oxygen measuring feature in CareGuard can only retrieve data from HealthKit and cannot start measurements directly from the app. To address the SOS trigger limitation, I implemented a <strong>custom emergency SOS feature as an alternative to replicate the SOS emergency experience.</strong> This feature activates if the heart rate is ≤ 40 or ≥ 150, or if the blood oxygen level is ≤ 88%. If the user does not respond within 30 seconds, a custom SOS interface appears, presenting a pre-generated message with the user’s location. The user can then press “<em>Send</em>” to notify emergency contacts. Additionally, the SOS feature prompts the user to call registered emergency contacts, which also requires user confirmation to press “<em>Call</em>” button.</p><p>Tech Stack that I use to develop CareGuard includes <strong>HealthKit, WatchKit, CoreLocation, AVFoundation, and SwiftUI</strong>.</p><h3><strong>Implementation:</strong></h3><p>First, we need to integrate HealthKit to fetch and write data from Apple built-in Health App.</p><p><strong>HealthKit Integration</strong></p><p>To integrate HealthKit into our app, we need to obtain user permission by making specific adjustments. This involves modifying the info.plist file. To do this, navigate to the project file, select the iOS app target, and go to the info tab. Here, add two new keys to enable the app to request the necessary permissions from the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jz1VhlFjm7zHi6umn-6DTA.png" /><figcaption>info.plist — Integrate HealthKit</figcaption></figure><p>Additionally, it is essential to include HealthKit and Background Modes capabilities in the app. This allows the app to function properly when running in the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHzzcWgJolgPlpERYJwqeQ.png" /><figcaption>Signing &amp; Capabilities</figcaption></figure><p><strong>Authorization and Setup</strong></p><p>To monitor blood oxygen levels and heart rates, CareGuard requires access to the user’s health data through HealthKit. Below are the steps to request authorization and start monitoring:</p><pre>import Foundation<br>import HealthKit<br><br>class MeasureManager: NSObject, ObservableObject {<br>    private let healthStore = HKHealthStore()<br><br>    @Published var isMeasuring = false<br>    @Published var latestOxygenLevel: Double = 0.98<br>    @Published var previousOxygenLevel: Double = 0<br>    @Published var timeAgo: String = &quot;&quot;<br><br>    @Published var latestHeartRate: Double = 70<br>    @Published var previousHeartRate: Double = 0<br>    @Published var showEmergencyOxygen = false<br>    @Published var showEmergencyHeart = false<br><br>    private var sosTriggered = false<br><br>    func requestAuthorization() {<br>        guard HKHealthStore.isHealthDataAvailable() else {<br>            return<br>        }<br><br>        let typesToRead: Set&lt;HKObjectType&gt; = [<br>            HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!,<br>            HKObjectType.quantityType(forIdentifier: .heartRate)!<br>        ]<br><br>        healthStore.requestAuthorization(toShare: nil, read: typesToRead) { success, error in<br>            if success {<br>                self.startObservingOxygenSaturation()<br>                self.startObservingHeartRate()<br>                self.loadPreviousOxygenSaturation()<br>                self.loadPreviousHeartRate()<br>            } else if let error = error {<br>                print(&quot;Failed to request authorization for health data: \(error.localizedDescription)&quot;)<br>            }<br>        }<br>    }</pre><p><strong>Monitoring and Fetching Health Data</strong></p><p>Once authorization is granted, CareGuard starts observing and fetching the latest health metrics. It also continuously checks for emergencies based on the user’s heart rate and blood oxygen levels.</p><pre><br>    private func startObservingOxygenSaturation() {<br>        guard let oxygenSaturationType = HKObjectType.quantityType(forIdentifier: .oxygenSaturation) else {<br>            return<br>        }<br><br>        let query = HKObserverQuery(sampleType: oxygenSaturationType, predicate: nil) { query, completionHandler, error in<br>            if let error = error {<br>                print(&quot;Failed to observe oxygen saturation: \(error.localizedDescription)&quot;)<br>                return<br>            }<br><br>            self.fetchLatestOxygenSaturation { oxygenSaturation in<br>                DispatchQueue.main.async {<br>                    self.latestOxygenLevel = oxygenSaturation<br>                    self.isMeasuring = false<br>                    self.checkForEmergency()<br>                }<br>            }<br>        }<br><br>        healthStore.execute(query)<br>    }<br><br>    private func fetchLatestOxygenSaturation(completion: @escaping (Double) -&gt; Void) {<br>        guard let oxygenSaturationType = HKObjectType.quantityType(forIdentifier: .oxygenSaturation) else {<br>            completion(0)<br>            return<br>        }<br><br>        let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false)<br>        let query = HKSampleQuery(sampleType: oxygenSaturationType, predicate: nil, limit: 1, sortDescriptors: [sortDescriptor]) { query, samples, error in<br>            guard let sample = samples?.first as? HKQuantitySample else {<br>                completion(0)<br>                return<br>            }<br><br>            let oxygenSaturation = sample.quantity.doubleValue(for: HKUnit.percent())<br>            completion(oxygenSaturation)<br>        }<br><br>        healthStore.execute(query)<br>    }<br><br>    private func startObservingHeartRate() {<br>        guard let heartRateType = HKObjectType.quantityType(forIdentifier: .heartRate) else {<br>            return<br>        }<br><br>        let query = HKObserverQuery(sampleType: heartRateType, predicate: nil) { query, completionHandler, error in<br>            if let error = error {<br>                print(&quot;Failed to observe heart rate: \(error.localizedDescription)&quot;)<br>                return<br>            }<br><br>            self.fetchLatestHeartRate { heartRate in<br>                DispatchQueue.main.async {<br>                    self.latestHeartRate = heartRate<br>                    self.isMeasuring = false<br>                    self.checkForEmergency()<br>                }<br>            }<br>        }<br><br>        healthStore.execute(query)<br>    }<br><br>    private func fetchLatestHeartRate(completion: @escaping (Double) -&gt; Void) {<br>        guard let heartRateType = HKObjectType.quantityType(forIdentifier: .heartRate) else {<br>            completion(0)<br>            return<br>        }<br><br>        let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false)<br>        let query = HKSampleQuery(sampleType: heartRateType, predicate: nil, limit: 1, sortDescriptors: [sortDescriptor]) { query, samples, error in<br>            guard let sample = samples?.first as? HKQuantitySample else {<br>                completion(0)<br>                return<br>            }<br><br>            let heartRate = sample.quantity.doubleValue(for: HKUnit.count().unitDivided(by: HKUnit.minute()))<br>            completion(heartRate)<br>        }<br><br>        healthStore.execute(query)<br>    }</pre><p><strong>Emergency Detection and Response</strong></p><p>CareGuard continuously checks the health metrics and triggers emergency alerts if abnormal values are detected.</p><pre><br>    func checkForEmergency() {<br>        // Ensure SOS alert is not triggered repeatedly<br>        guard !sosTriggered else { return }<br><br>        if latestHeartRate &lt;= 40 || latestHeartRate &gt;= 150 {<br>            showEmergencyHeart = true<br>            showEmergencyOxygen = false<br>            sosTriggered = true<br>        } else if latestOxygenLevel * 100 &lt;= 88 {<br>            showEmergencyOxygen = true<br>            showEmergencyHeart = false<br>            sosTriggered = true<br>        } else {<br>            showEmergencyHeart = false<br>            showEmergencyOxygen = false<br>            sosTriggered = false<br>        }<br>    }</pre><p><strong>Emergency Handler</strong></p><p>In the event of an emergency, quick and effective communication is crucial. This is where the EmergencyHandler comes into play. When an emergency is detected, we need an EmergencyHandler that sends a message with the user’s location and calls emergency services. For demonstration purposes, I have set the phone number for messages and calls to “123”, but this can be easily modified to match the user’s actual emergency contacts and appropriate emergency numbers. This setup ensures that users receive the necessary assistance without delay, providing peace of mind for both the user and their loved ones.</p><pre>import WatchKit<br>import CoreLocation<br><br>class EmergencyHandler {<br>    let measureManager: MeasureManager<br>    let locationManagerDelegate: LocationManagerDelegate<br><br>    init(measureManager: MeasureManager, locationManagerDelegate: LocationManagerDelegate) {<br>        self.measureManager = measureManager<br>        self.locationManagerDelegate = locationManagerDelegate<br>    }<br><br>    func sendEmergencyMessageAndCall() {<br>        sendEmergencyMessage {<br>            self.callEmergency()<br>        }<br>    }<br><br>    func sendEmergencyMessage(completion: @escaping () -&gt; Void) {<br>        guard let location = locationManagerDelegate.userLocation else {<br>            print(&quot;Location not available&quot;)<br>            return<br>        }<br><br>        let phoneNumber = &quot;123&quot;<br>        let latitude = location.coordinate.latitude<br>        let longitude = location.coordinate.longitude<br>        let url = &quot;http://maps.apple.com/?ll=\(latitude),\(longitude)&quot;<br><br>        let message = &quot;Jane Doe&#39;s heart rate is critically low (\(measureManager.latestHeartRate) BPM). Jane Doe needs emergency assistance immediately. Location: \(url)&quot;<br><br>        if let messageURL = URL(string: &quot;sms:imessage:\(phoneNumber)&amp;body=\(message)&quot;) {<br>            print(&quot;message sent&quot;)<br>            let wkExtension = WKExtension.shared()<br>            wkExtension.openSystemURL(messageURL)<br><br>            // Simulate delay for sending the message before making the call<br>            DispatchQueue.main.asyncAfter(deadline: .now() + 2) {<br>                completion()<br>            }<br>        }<br>    }<br><br>    func callEmergency() {<br>        let phoneNumber = &quot;123&quot;<br>        if let telURL = URL(string: &quot;tel:\(phoneNumber)&quot;) {<br>            print(&quot;calling emergency&quot;)<br>            let wkExtension = WKExtension.shared()<br>            wkExtension.openSystemURL(telURL)<br>        }<br>    }<br>}</pre><p>For sending messages, I used WKExtension because the MessageUI framework is not supported in watchOS. Consequently, I cannot directly send the user’s live location, which is one of the features of MessageUI. To work around this, I use a URL link that includes the user’s latitude and longitude coordinates. The URL format is http://maps.apple.com/?ll=\(latitude),\(longitude). <strong>Remember to use </strong>%3F<strong> as the encoding for </strong>?<strong> to ensure the link works correctly. </strong>Therefore, in your code, you should write the URL as <a href="http://maps.apple.com/%3Fll=/(latitude),/(longitude).">http://maps.apple.com/%3Fll=\(latitude),\(longitude).</a></p><p><strong>Location Manager</strong></p><p>To obtain the user’s location, we need a LocationManager that requests authorization and retrieves the user’s latitude and longitude coordinates. The necessary keys must be added to the info.plist file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Jz4PeKJizdZp6_gKD5Vvg.png" /><figcaption>info.plist — Location</figcaption></figure><p>This setup ensures that our app has the required permissions to access the user’s location data.</p><p>Here’s the code for the LocationManager and its delegate:</p><pre>import CoreLocation<br><br>class LocationManagerDelegate: NSObject, CLLocationManagerDelegate {<br>    var userLocation: CLLocation?<br><br>    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {<br>        guard let location = locations.last else { return }<br>        userLocation = location<br>        manager.stopUpdatingLocation()<br>    }<br>}<br><br>class LocationManager: ObservableObject {<br>    @Published var locationManager = CLLocationManager()<br>    @Published var locationManagerDelegate = LocationManagerDelegate()<br><br>    init() {<br>        locationManager.delegate = locationManagerDelegate<br>        locationManager.requestWhenInUseAuthorization()<br>    }<br><br>    func startUpdatingLocation() {<br>        locationManager.startUpdatingLocation()<br>    }<br><br>    func stopUpdatingLocation() {<br>        locationManager.stopUpdatingLocation()<br>    }<br>}</pre><p>This LocationManager class handles the initialization and location updates, while the LocationManagerDelegate class processes the location data and stops updates once the location is retrieved.</p><p>Below is a preview of the CareGuard application when the SOS button is activated. The app sends a message to registered emergency contacts, including the URL of the user’s location, and initiates a call to the registered emergency services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVs8lv4fNLZE9rwhLz2mCg.png" /><figcaption>App Preview — Send Message and Call</figcaption></figure><p>With these components — MeasureManager, EmergencyHandler, and LocationManager — you can create a comprehensive health monitoring app like CareGuard. These classes and functions can be called in various views (e.g., MeasureView, EmergencyView) as needed. Guardian ensures the safety and well-being of elderly users by providing timely alerts and emergency responses based on their health metrics.</p><p>For the complete code and to explore further details, visit my GitHub repository: <a href="https://github.com/NatashaHW/CareGuard">CareGuard</a></p><h3>Thank You</h3><p>© 2024 Natasha Hartanti Winata. All Rights Reserved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c44f39c75a94" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>