<?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[Mobiroller Tech - Medium]]></title>
        <description><![CDATA[Mobiroller platformunu geliştiren ekip olarak üzerinde çalıştığımız problemleri, ilginç konuları ve hikayelerimizi burada paylaşıyoruz. - Medium]]></description>
        <link>https://medium.com/mobiroller-tech?source=rss----28667e84819---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Mobiroller Tech - Medium</title>
            <link>https://medium.com/mobiroller-tech?source=rss----28667e84819---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:50:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/mobiroller-tech" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to show a success or Failure message after an action dispatched in NgRx]]></title>
            <link>https://medium.com/mobiroller-tech/how-to-show-a-success-or-failure-message-after-an-action-dispatched-in-ngrx-6091687d3332?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/6091687d3332</guid>
            <category><![CDATA[ngrx]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Hamid Hassani]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 08:54:23 GMT</pubDate>
            <atom:updated>2023-06-06T08:54:23.146Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L2U6lSKPT702kdVv4dPEDw.png" /></figure><p>With the traditional attitude of developing Angular projects, you were able to do all stuff in your components via calling services, you could subscribe to them and show reactions when they got the response from the server side, moreover, this process was extremely easy and straightforward, right?</p><p>but what if you wanted to do that when you’re trying to follow the NGRX approach for developing your Angular project? you’re not calling services in your components anymore, you only dispatch actions. thereby, there would be a good question here, how we can <br>give feedback to our users if we dispatch an action?</p><p>It’s vital to communicate with our users effectively, and one way to achieve this is by showing them messages indicating the result of their actions. For example, after a successful login or registration, you might want to display a welcome message, or after a failed form submission, you might want to let the user know what went wrong.</p><p>In this article, I’ll explore how to overcome this challenge, I will share my solution for showing success and failure messages using Ngrx.</p><p>First of all, we need an interface, like the one below</p><pre>export interface StoreActionResultModel {<br>  message: string;<br>  messageType: StoreActionsMessageTypesList;<br>}</pre><p>Second of all, we need to define our actions like the below</p><pre>export const DeleteWebHook = createAction(<br>  &#39;[WebHook] Delete Web Hook&#39;,<br>  props&lt;{ payload: any}&gt;()<br>);<br><br>export const DeleteWebHookSuccess = createAction(<br>  &#39;[WebHook] Delete Web Hook Success&#39;,<br>  props&lt;{<br>    payload: {<br>      id: string;<br>      result: StoreActionResultModel;<br>    };<br>  }&gt;()<br>);<br><br>export const DeleteWebHookFailure = createAction(<br>  &#39;[WebHook] Delete Web Hook Failure&#39;,<br>  props&lt;{<br>    payload: {<br>      result: StoreActionResultModel;<br>    };<br>  }&gt;()<br>);</pre><p>Last but not least, we need a class that defines an Effect, that it’s duty is listening to actions like the below store-actions-result-message.effects.ts</p><pre>import { Actions, createEffect, ofType } from &#39;@ngrx/effects&#39;;<br>import { map } from &#39;rxjs/operators&#39;;<br><br>import { Injectable } from &#39;@angular/core&#39;;<br><br>import {<br>  CreateWebHookFailure,<br>  CreateWebHookSuccess,<br>  DeleteWebHookFailure,<br>  DeleteWebHookSuccess,<br>  UpdateWebHookFailure,<br>  UpdateWebHookSuccess<br>} from &#39;src/app/modules/webhook&#39;;<br>import { StoreActionsMessageTypesList } from &#39;./store-actions-message.model&#39;;<br>import { MessageService } from &#39;primeng/api&#39;;<br>import { TranslateService } from &#39;@ngx-translate/core&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class StoreActionsResultMessageEffect {<br>  private readonly _actionsForShowingMessage = [<br>    DeleteWebHookSuccess,<br>    DeleteWebHookFailure,<br>    UpdateWebHookSuccess,<br>    UpdateWebHookFailure,<br>    CreateWebHookSuccess,<br>    CreateWebHookFailure<br>  ];<br><br>  /**<br>   * Result actions are those actions that manage the result of an action, let&#39;s suppose we have an action called DeleteWebhook,<br>   * the possible results would be DeleteWebHookSuccess and DeleteWebHookFailure and when these actions are dispatched somewhere<br>   * in the project we are supposed to react to them, show a message to the user,<br>   * etc. with this effect we are going to listen to these types of actions and show a message to users<br>   */<br>  public listenToAllResultActions$ = createEffect(<br>    () =&gt; {<br>      return this._actions$.pipe(<br>        ofType(...this._actionsForShowingMessage),<br>        map(({ payload }) =&gt; {<br>          this.messageService.add({<br>            severity:<br>              payload.result.messageType == StoreActionsMessageTypesList.Success<br>                ? &#39;success&#39;<br>                : &#39;error&#39;,<br>            summary: this._translateService.instant(&#39;SHARED.MESSAGES.ERROR&#39;),<br>            detail: this._translateService.instant(payload.result.message)<br>          });<br>        })<br>      );<br>    },<br>    { dispatch: false }<br>  );<br><br>  constructor(<br>    public messageService: MessageService,<br>    private _actions$: Actions,<br>    private _translateService: TranslateService<br>  ) {}<br>}</pre><p>Now, it’s time to show your messages in your project, personally I’m using the primeng as my component library so I’m gonna use toast component in the app.component.ts</p><pre>&lt;router-outlet&gt;&lt;/router-outlet&gt;<br>&lt;p-toast position=&quot;bottom-center&quot; [preventOpenDuplicates]=&quot;true&quot;&gt;&lt;/p-toast&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6091687d3332" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/how-to-show-a-success-or-failure-message-after-an-action-dispatched-in-ngrx-6091687d3332">How to show a success or Failure message after an action dispatched in NgRx</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing NgRx in Angular: A Comprehensive Guide]]></title>
            <link>https://medium.com/mobiroller-tech/implementing-ngrx-in-angular-a-comprehensive-guide-5e8497ed667?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/5e8497ed667</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[ngrx]]></category>
            <dc:creator><![CDATA[Hamid Hassani]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 21:44:28 GMT</pubDate>
            <atom:updated>2023-04-30T14:23:43.931Z</atom:updated>
            <content:encoded><![CDATA[<p>NgRx is a state management library for Angular applications that follows the Redux pattern. It provides a predictable and centralized way to manage the state of an application, making it easier to handle complex state management scenarios. In this article, we’ll explore how to implement NgRx in an Angular application step by step.</p><p>by the way, if you are not familiar with NGRX and state management you can read my previous article that described the basics concepts of NGRX, <a href="https://medium.com/mobiroller-tech/ngrx-in-angular-1a07d4ec2451">https://medium.com/mobiroller-tech/ngrx-in-angular-1a07d4ec2451</a>, also it’s worth noting that if you like to watch a video about ngrx subject, I have uploaded ‘<a href="https://www.youtube.com/watch?v=q9qq5DsWgy0">How to use NgRx in Angular — YouTube</a>’ video on my youtube channel, follow the link and watch that out.</p><h3>How to implement NGRX in action?</h3><p><strong>Step 1: Install NGRX Packages</strong><br> The first step is to install the required NGRX packages in your Angular application. Open a terminal and navigate to your Angular project’s root directory. Then, run the following commands to install the required packages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*iuPbXvIu6vPJPjwUevfXtg.png" /></figure><h3>Installed packages usage:</h3><p>· @ngrx/store, used for managing the store</p><p>· @ngrx/effects, used for handling side effects in store</p><p>· @ngrx/store-devtools provides developer tools and instrumentation for the store, with this package we can monitor the changes of the store in the browser</p><h3>Step 2: Create the Store (state)</h3><p>Let’s suppose we want to create a store for the user module so we tend to store user profile information in our store. In order to do that let’s create a folder in our user profile module called data-access, in data-access create a store folder. So far so good, we’re gonna define all the required stuff of the user profile store here. Start with creating a file called user-profile.reducer.ts (forget other files for now, I will explain what they are and what we should about them)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*FW5dwRXvJTxXx2kNM1QPIA.png" /></figure><p>In this file, we need to define our store (every time that we create a store we need to feed/initialize it)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*2dg08bvHSD0naLuo4Ge9PQ.png" /></figure><h3>Step 2: Create your Actions</h3><p>Before diving into this part let me explain the Action concept in Ngrx. In fact, Actions are nothing but an event(or command) that you dispatch/issue in your project in order to do a specific job like fetching user data from API, or updating an existing product, etc.</p><p>Examples:</p><p>· loadUserProfileInformation</p><p>· GetListOfApps</p><p>· LoadStoreInformation</p><p>· LoadWebSaleChannelData</p><p>Let’s continue with coding 😊, let’s imagine we want to fetch our user profile information from the server, so the first step would be defining a service class that calls http request for fetching the desired data, right? Therefore let’s create the user.service.ts, in this service class we will have something like the below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*HFyCYdftJZQcBEpDAJ-uJA.png" /></figure><p>Now it’s time to define our actions in terms of issuing a command to NGRX hey I want you to do something for me, since we are going to talk with NGRX about user profiles let’s create actions about that topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*8edmJ1J9PXI7NQBIODw_Sw.png" /></figure><p>In addition to loadUserProfileInformation, there are two other commands here which are loadUserProfileInformationSuccess and loadUserProfileInformationFailure, don’t panic they are nothing but complementary commands of loadUserProfileInformation. It means if we want to issue the command we just need the simple loadUserProfileInformation action (I will tell you what is the usage of other commands a little bit later)</p><p>As the last point about Actions I would say, we will dispatch actions in the components with dispatch command like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*qDvhUMkSUwGWbLny2tocSQ.png" /></figure><p>It’s getting interesting I guess, let’s dive into reducers which is the next piece of the NGRX puzzle</p><h3>Step 3: Create a Reducer</h3><p><strong>What is a reducer?</strong></p><p>Is that your question? Okay let me explain it this as well, Reducer is a pure function that takes the current state (which is userProfileFeatureState) and an action as input and returns a new state. hold on, I thought it got complicated, let me put it this way, imagine you have a listener that listens to what components are demanding from the store. Remember our greeting component? It wanted to load user profile information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*qDvhUMkSUwGWbLny2tocSQ.png" /></figure><p>So reducers tend to listen to these commands (actions that dispatch from components), and based on what is received it executes a method that changes the store somehow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*CS9WL4D8blcb1LEnxGQNOw.png" /></figure><p>Now, it’s time to explain the actions in the reducer.</p><p>1. loadUserProfileInformation: this action is dispatched from the component, when it is received by the reducer it will start to call an API so it’s going to take time, in the meanwhile the only part that we must change in our state is the status, so we change it to <strong>loading</strong></p><p>2. loadUserProfileInformationSuccess: this action will dispatch when we receive our data from API side.</p><p>3. loadUserProfileInformationFailure: this action will dispatch when we received an error from API side, like times we get 500 or 401 error.</p><p>Probably you got confused again, but wait for the last part of this puzzle, which is effects.</p><h3>Step 4: Add Required Effects</h3><h3>What is the effect?</h3><p>An effect is a class that listens to actions and performs movements consequently for those actions. Again it got confused you? All right, here is the thing, You probably want to perform API calls, database operations, or logging when an action is dispatched, how do you want to do that? Your solution would be using effects. Indeed, Effects are supposed to do extra operations when an action is dispatched through the application, Let me make it clear with our scenario which is loading user profile information. Let’s say you want to call getCurrentUserProfile API when <strong>loadUserProfileInformation</strong> action dispatch what you need is to define an effect and listen to an action like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*BZsB7r0NitzoHFotX-lE6w.png" /></figure><p>As depicted in the image when <strong>loadUserProfileInformation </strong>dispatched<strong>, </strong>loadUserProfileInformation$ will trigger cause it’s filtering dispatched actions via OfType operatore which belong to ngrx/effects package, then when user information recived successfully from API side we are returning loadUserProfileInformationSuccess which will update the store, the error part is empty by you can simple return loadUserProfileInformationFailure action as result and update the store with error value.</p><p>We are done by the concepts of NGRX up here, just a simple one is remains which is selector.</p><h3>Step 5: Read Store data via Selector</h3><p>Up to now we were discussing about data manipulation in NGRX but it’s time to know how we can use/read this data, we can do this simply by selectors.</p><h3>What is Selector in NGRX?</h3><p>Selectors are pure functions used for obtaining slices of store state, before we grab a slice of store state we need to define a feature selector that tracks the state changes and provide it’s data for us. As depicted in the below image we defined userProfileState as our feature Selector the we are passing it to our selectors and grab portion of store state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*lWe6o43LmxRdn1Pxv4EyxQ.png" /></figure><p>How to use Selector?</p><p>It’s as simple as calling the select method of the store, see the example, and you definitely find out how to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*5ahomDGLTTWJEUNXoW1gRw.png" /></figure><h3>Step 6: Configuring NGRX in our application</h3><p>So far we understood the core concepts of NGRX, also how to manipulate data and select data from the store but all that we did so far would be nothing if we don’t configure the store into our project, it means we have to register the store into our project. Let’s do that, but before jumping into coding in this part I want to mention that there are various workarounds for registering the store into the app module, mind you for the sake of simplicity, maintainability, and having more clean code I would suggest my solution.</p><p>Normally in my projects I create a core module and define a folder in that module called store, in this store folder I hold everything related to ngrx which is global, like the list of reducers/effects. When I provided the required data and everything would be ready I register the store in the core module like the below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*09QySqGlrebzLQBqmF5RWQ.png" /></figure><p>Now let me explain the code line by line, let’s start with line 12:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*m48dtsS79GnSXpTOJO6yeg.png" /></figure><p>In this line, I just register Reducers that are kept in the app.reducer.ts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*vjZoaaulXnIhxMEgWw3ocA.png" /></figure><p>By the way, there is a strange thing for you in this image, and it’s FeatureKey, you might wonder what is that? <br> Frankly, as its name suggests it’s key when we register a feature, we tie to it the reducer using a string, so it would be something like the below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*EY6FdpjMMkYW3jCUJr97fg.png" /></figure><p>The next line is the place we are registering Effects, we are adding features effects in app.effects.ts file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*lE3K3QzGBFAJtpz8ZDB6QA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*zcjGwerYSd8ag_lv9jhyYA.png" /></figure><p>Last but not least is related to store dev tools that help us to monitor store changes in a visual manner (Since it’s not our topic here I probably write a different article for that later on)</p><p>As the final step don’t remember to register core.module.ts into app.module.ts.</p><h3>Conclusion</h3><p>NgRx is a powerful state management library for Angular applications that provides a centralized way to manage the state of an application. In this article, we explored how to use it for specific features of our project and what are the core concepts of that. Definitely, there are tons of concepts and tricks that I couldn’t cover in this article thereby I would suggest being more curious about NGRX at the end I hope you like this article. cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e8497ed667" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/implementing-ngrx-in-angular-a-comprehensive-guide-5e8497ed667">Implementing NgRx in Angular: A Comprehensive Guide</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NGRX in Angular]]></title>
            <link>https://medium.com/mobiroller-tech/ngrx-in-angular-1a07d4ec2451?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/1a07d4ec2451</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ngrx]]></category>
            <category><![CDATA[state-management]]></category>
            <dc:creator><![CDATA[Hamid Hassani]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 21:44:11 GMT</pubDate>
            <atom:updated>2023-04-26T07:08:07.270Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever felt your project is getting tedious cause you have to send the same requests in different components, or you need the same data in different places and you are injecting your services again and again in order to fetch the same data, therefore, these actions lead your components get complicated, Have you ever thought you need to manage all these stuff in a centralized manner and delegate the responsibility of manipulating data to a specific mechanism, I bet if you developed a medium or large-size project you have came up with these questions.</p><p>So what would be the solution in such cases? Frankly, there are enormous workarounds for this but believe me, the best option is using state management libraries such as NGRX, NGXX, Akita, etc. Among these libraries, I prefer to use NGRX in my project because of the better community and support by its team.<br>Long story short, we want to use NGRX in our project in terms of having state management but what do we mean by the state? <br>In fact, We mean a global variable that we can update and read its data wherever we want.</p><p>So we want to manage the state with a solution in our project, but how? Managing the state in an Angular application can be a challenging task, especially as the application grows in complexity. Stay stunned, In this article, we will take a closer look at NgRx and its features, and see how it can help you manage state in your Angular application.</p><p><strong>How does NgRx work?</strong></p><p>In the Angular project which uses NGRX, there is something called state which is a global/shared data that is accessible through all components. By the way you can define feature state, Let’s suppose you have different features in your project such as products, orders, categories, etc and we want to define a state for orders feature. we have two pages related to orders which are order list and order details pages. If we wanted to manage the order feature state we are supposed to define a class like this</p><pre><br>export class OrderFeatureState {<br>  list: any[]; // this will use in order list page<br>  order: any; // this will use in order details page<br>}</pre><p><strong>Actions in NGRX</strong></p><p>The state cannot be directly modified by components in the application. Instead, components can dispatch <strong>actions. </strong>but what are actions?<strong> </strong>is that your question? All right<strong>, </strong>Actions in NgRx are events/commands that you want to notify your store. If you want to make any change in store you have to dispatch an action and this would be the first step of the change process. Actions can be any events that are happing in your project like updating a product, creating a new brand, deleting a category, etc. Actions are dispatched by components using the <strong>Store.dispatch()</strong> method. Take a look at the below example:</p><pre><br>import { ChangeDetectorRef, Component, OnInit, ViewChild } from &#39;@angular/core&#39;;<br>import { Store } from &#39;@ngrx/store&#39;;<br><br>@Component({<br>  selector: &#39;app-applications-list&#39;,<br>  templateUrl: &#39;./applications-list.component.html&#39;,<br>  styleUrls: [&#39;./applications-list.component.scss&#39;],<br>})<br>export class ApplicationsListComponent implements OnInit {<br>  constructor(private readonly _store: Store) {}<br><br>  public ngOnInit(): void {<br>    this._store.dispatch(loadListOfApplications());<br>}<br>}</pre><p><strong>What is Reducer then?</strong></p><p>Reducers in NgRx are pure functions that take the current state and an action and return a new state. it means that are supposed to modify the state based on an action, they listen to the actions that dispatching through the project when a specific action happened they modify the state! (you can think of them like they are events or commands in the CQRS pattern)</p><pre>export const OrderFeatureReducer = createReducer(<br>  initialState,<br>  on(loadListOfApplications, (state, { response }) =&gt; ({<br>    ...state,<br>    list: response,<br>  }))</pre><p><strong>What is the Effect of NGRX?</strong></p><p>Imagine you want to dispatch an action that is supposed to fetch data from an API, like fetching list of orders:</p><pre>import { ChangeDetectorRef, Component, OnInit, ViewChild } from &#39;@angular/core&#39;;<br>import { Store } from &#39;@ngrx/store&#39;;<br><br>@Component({<br>  selector: &#39;orders-list&#39;,<br>  templateUrl: &#39;./orders-list.component.html&#39;,<br>  styleUrls: [&#39;./orders-list.component.scss&#39;],<br>})<br>export class OrdersListComponent implements OnInit {<br>  constructor(private readonly _store: Store) {}<br><br>  public ngOnInit(): void {<br>    this._store.dispatch(fetchListOfOrders());<br>}<br>}</pre><p>Remember that I told you when an action is dispatched the reducers update the state, How can they understand how to change/update the state? Exactly, based on the action response, but what if the action response wasn’t ready to use? So if you want to make HTTP requests or update the browser’s location, log something, etc by an action that needs to wait you have to use an effect in order to handle the side effects and update the state.<br>So if you want to do something that there is no need to wait you directly update the state by reducer but if you wanted to do an action that needed to call API or asynchronous operations you have to use effect too.</p><p>So in a nutshell, Effects are defined as classes that implement the <strong>Effect</strong> interface. They listen for specific actions, and when they receive one, they perform some side effects and dispatch new actions to update the state of the application. Effects are typically used to manage asynchronous operations, such as loading data from a server.</p><pre>import { Actions, createEffect, ofType } from &#39;@ngrx/effects&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class OrderFeatureEffects {<br>  public fetchListOfOrdersEffect$ = createEffect(() =&gt;<br>    this._actions$.pipe(<br>      ofType(fetchListOfOrders),<br>      switchMap((actions) =&gt; {<br>        return this._orderService.getAllOrders().pipe(<br>          map(<br>            (response) =&gt;<br>              listOfOrdersFetchedSuccessfully({ response: response }),<br>            catchError(() =&gt; EMPTY)<br>          )<br>        );<br>      })<br>    )<br>  );<br><br>  constructor(<br>    private readonly _actions$: Actions,<br>    private readonly _orderService: OrderService<br>  ) {}<br>}</pre><p><strong>Selectors</strong></p><p>Selectors are functions that are used to query the state of the application. They are used to extract specific pieces of data from the store, and they can also be used to derive new data from the existing state. Selectors are memoized, which means that they cache the results of previous computations and only recompute when the input data changes.</p><p>Selectors can be used to improve the performance of an application by reducing the number of times that the application needs to recompute data. They can also be used to simplify the logic of components by encapsulating complex data transformations.</p><pre>export const orderState =<br>  createFeatureSelector&lt;orderFeatureState&gt;(orderFeatureKey);<br>export const selectListOfOrders= createSelector(<br>  orderState,<br>  ({ list}) =&gt; list<br>);<br><br>export const selectOrderById = createSelector(<br>  orderState,<br>  (list: any, id: string) =&gt; list.find((x: any) =&gt; x.id === id)<br>);</pre><p>Up to now, we talked about the core features of NGRX, now it’s time to examine an image provided by the official website of NGRX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOC2HaKvG4mb7LwbdxvrFg.png" /></figure><p>It’s clear as a day, that this image depicts the flow of NGRX.</p><ul><li>When it comes to working with APIs, Databases, or in general asynchronous operations you need to use Effects</li><li>If you decided to update the store you have to use Reducers</li><li>When you want to notify your store about a specific event or issue a command for doing something like fetching data you need to dispatch an action from a component</li><li>If you want to grab a portion of the store you need to use selectors</li></ul><h3><strong>Conclusion</strong></h3><p>NgRx is a powerful library for managing state in Angular applications. It provides a way to centralize state management in a predictable and testable way, using a unidirectional data flow. NgRx also provides additional features like effects and selectors, which can help you manage complex states and handle side effects. By using NgRx, you can simplify the logic of your components and improve the performance of your application. If you are working on a large-scale Angular application, using NgRx or a state management library in your project is a must, cheers.</p><p>If you want to know how you can implement NGRX in your project check out my article, <a href="https://medium.com/mobiroller-tech/implementing-ngrx-in-angular-a-comprehensive-guide-5e8497ed667">https://medium.com/mobiroller-tech/implementing-ngrx-in-angular-a-comprehensive-guide-5e8497ed667</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a07d4ec2451" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/ngrx-in-angular-1a07d4ec2451">NGRX in Angular</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is DomSanitizer in Angular?]]></title>
            <link>https://medium.com/mobiroller-tech/what-is-domsanitizer-in-angular-3c6bd8204a1f?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/3c6bd8204a1f</guid>
            <category><![CDATA[domsanitizer]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Hamid Hassani]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 21:43:42 GMT</pubDate>
            <atom:updated>2023-04-25T21:43:42.586Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular is a popular front-end framework for building dynamic web applications. One of the key features of Angular is its built-in support for security, which is essential for preventing cross-site scripting (XSS) attacks.</p><p>In Angular, the <strong>DomSanitizer </strong>service is used to sanitize and transform values, such as <strong>URLs </strong>and <strong>HTML fragments</strong>, to prevent XSS attacks. By using <strong>DomSanitizer</strong>, you can ensure that your Angular application is secure and protected from malicious code injections.</p><h3>How does DomSanitizer work?</h3><p>The <strong>DomSanitizer</strong> service provides a set of methods for sanitizing and transforming values in different ways. Here are some of the most commonly used methods:</p><ul><li><strong>bypassSecurityTrustHtml</strong>(): Sanitizes an HTML string and marks it as trusted, so that it can be rendered safely in the template.</li><li><strong>bypassSecurityTrustStyle</strong>(): Sanitizes a CSS style string and marks it as trusted, so that it can be used safely in a style attribute.</li><li><strong>bypassSecurityTrustScript</strong>(): Sanitizes a script string and marks it as trusted, so that it can be executed safely.</li><li><strong>bypassSecurityTrustUrl</strong>(): Sanitizes a URL string and marks it as trusted, so that it can be used safely in a link or iframe.</li><li><strong>sanitize</strong>(): Sanitizes an HTML, attribute, or style value, according to a specific security context.</li></ul><p>Each of these methods takes a string value as input and returns a <strong>SafeHtml</strong>, <strong>SafeStyle</strong>, <strong>SafeScript</strong>, <strong>SafeUrl</strong>, or <strong>SafeValue</strong> object, respectively. These objects tell Angular that the value has been sanitized and is safe to use.</p><p>As an example, suppose you have an Angular component that displays the user’s profile picture, which is stored in a URL. To prevent XSS attacks, you can use <strong>DomSanitizer</strong> to sanitize the URL before rendering it in the template:</p><pre>typescript<br>import { Component } from &#39;@angular/core&#39;;<br>import { DomSanitizer, SafeUrl } from &#39;@angular/platform-browser&#39;;<br><br>@Component({<br>  selector: &#39;app-profile&#39;,<br>   template: `&lt;img [src]=&quot;sanitizedUrl&quot; alt=&quot;Profile picture&quot;&gt;`<br>})<br>export class ProfileComponent {<br>public unsafeUrl: string = &#39;https://mobiroller.com/profile-picture.jpg&#39;;<br><br>constructor(private sanitizer: DomSanitizer) {}<br><br>public get sanitizedUrl(): SafeUrl {<br>  return this.sanitizer.bypassSecurityTrustUrl(this.unsafeUrl);<br>}<br>}</pre><p>Let me demonstrate another example that is related to urls:</p><pre>import { Component, OnInit } from &#39;@angular/core&#39;;<br>import { DomSanitizer, SafeUrl } from &#39;@angular/platform-browser&#39;;<br>import { ApiService } from &#39;./api.service&#39;;<br><br>@Component({<br>selector: &#39;app-links&#39;,<br>template: `&lt;h2&gt;Links&lt;/h2&gt;<br>           &lt;ul&gt;<br>           &lt;li *ngFor=&quot;let link of links&quot;&gt;<br>           &lt;a [href]=&quot;sanitizedUrl(link.url)&quot; target=&quot;_blank&quot;&gt;{{ link.title }}&lt;/a&gt;<br>           &lt;/li&gt;<br>           &lt;/ul&gt;`<br>})<br>export class LinksComponent implements OnInit {<br><br>public links: any[];<br> <br>constructor(<br> private apiService: ApiService, <br> private sanitizer: DomSanitizer) {}<br><br>ngOnInit(): void {<br>  this.apiService.getLinks().subscribe((data: any[]) =&gt; this.links = data);<br>}<br><br>public sanitizedUrl(url: string): SafeUrl {<br> return this.sanitizer.bypassSecurityTrustUrl(url);<br>}<br>}</pre><p>So far so good, up to now we learned what is domSanatizer in Angular and how it basically works, it’s time to dive into more details, thereby let’s continue with describing sanitizer methods.</p><h3>bypassSecurityTrustHtml()</h3><p>As I said before the <strong>bypassSecurityTrustHtml</strong>() method is used to sanitize an HTML string and mark it as trusted so that it can be rendered safely in the template.</p><p>Here’s an example of how to use <strong>bypassSecurityTrustHtml</strong>() to render HTML in Angular:</p><pre>import { Component } from &#39;@angular/core&#39;;<br>import { DomSanitizer, SafeHtml } from &#39;@angular/platform-browser&#39;;<br><br>@Component({<br> selector: &#39;app-html-example&#39;,<br> template: `&lt;div [innerHTML]=&quot;sanitizedHtml&quot;&gt;&lt;/div&gt;`<br>})<br>export class HtmlExampleComponent {<br><br>public unsafeHtml: string = &#39;&lt;p&gt;Hello, &lt;strong&gt;world!&lt;/strong&gt;&lt;/p&gt;&#39;;<br><br>constructor(private sanitizer: DomSanitizer) {}<br><br>public get sanitizedHtml(): SafeHtml {<br>  return this.sanitizer.bypassSecurityTrustHtml(this.unsafeHtml);<br>}<br>}</pre><p>In this example, we’re using <strong>bypassSecurityTrustHtml</strong>() to sanitize the <strong>unsafeHtml</strong> string before rendering it in the template.</p><h3>bypassSecurityTrustStyle()</h3><p>I described before that The <strong>bypassSecurityTrustStyle</strong>() method is used to sanitize a CSS style string and mark it as trusted so that it can be used safely in a style attribute.</p><p>Here’s an example of how to use <strong>bypassSecurityTrustStyle</strong>() to apply CSS styles in Angular:</p><pre>import { Component } from &#39;@angular/core&#39;;<br>import { DomSanitizer, SafeStyle } from &#39;@angular/platform-browser&#39;;<br><br>@Component({<br> selector: &#39;app-style-example&#39;,<br> template: `&lt;div [style]=&quot;sanitizedStyle&quot;&gt;Hello, world!&lt;/div&gt;`<br>})<br>export class StyleExampleComponent {<br><br>public unsafeStyle: string = &#39;color: red; font-size: 20px;&#39;;<br><br>constructor(private sanitizer: DomSanitizer) {}<br><br>public get sanitizedStyle(): SafeStyle {<br>  return this.sanitizer.bypassSecurityTrustStyle(this.unsafeStyle);<br>}<br>}</pre><p>In this example, we’re using <strong>bypassSecurityTrustStyle</strong>() to sanitize the <strong>unsafeStyle</strong> string before applying it to the <strong>style</strong> attribute in the template. The <strong>SafeStyle</strong> object returned by <strong>bypassSecurityTrustStyle</strong>() tells Angular that the CSS styles are safe to use.</p><h3>bypassSecurityTrustScript()</h3><p>The <strong>bypassSecurityTrustScript</strong> method is a part of Angular’s <strong>DomSanitizer</strong> service that allows developers to safely embed script elements in their templates. This method can be used to bypass the default security settings and trust a given script string, which can then be used in the HTML document.</p><p>Here’s an example of how to use the <strong>bypassSecurityTrustScript</strong> method in an Angular component:</p><pre>import { Component } from &#39;@angular/core&#39;;<br>import { DomSanitizer } from &#39;@angular/platform-browser&#39;;<br><br>@Component({<br>selector: &#39;app-script-example&#39;,<br>template: `&lt;script [src]=&quot;trustedScript&quot;&gt;&lt;/script&gt;`,<br>})<br>export class ScriptExampleComponent {<br> public scriptString: string = &#39;console.log(&quot;Hello world!&quot;);&#39;;<br> publictrustedScript: any;<br> <br> constructor(private sanitizer: DomSanitizer) {<br>  this.trustedScript = this.sanitizer.bypassSecurityTrustScript(this.scriptString);<br>  }<br>}</pre><p>In this example, we have a component that contains a <strong>script</strong> element with a <strong>src</strong> attribute that is bound to a variable named <strong>trustedScript</strong>. This variable is initialized in the constructor using the <strong>bypassSecurityTrustScript </strong>method to trust a given script string.</p><p>The <strong>scriptString</strong> variable contains a simple script that logs “Hello world!” to the console. Normally, adding a script element to the HTML document in this way would be blocked by the browser’s security settings. However, by using the <strong>bypassSecurityTrustScript</strong> method, we are telling Angular to trust the script and allow it to be executed.</p><p>Note that the <strong>bypassSecurityTrustScript</strong> method should only be used when it is absolutely necessary to include script elements in your templates. Care should be taken to ensure that any script strings that are trusted using this method come from a trusted source, as they can potentially introduce security vulnerabilities in your application.</p><h3>Conclusion</h3><p><strong>DomSanitizer</strong> is an important service in Angular that helps prevent XSS attacks by sanitizing and transforming values. By using <strong>DomSanitizer</strong> in your Angular applications, you can ensure that your application is secure and protected from malicious code injections.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c6bd8204a1f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/what-is-domsanitizer-in-angular-3c6bd8204a1f">What is DomSanitizer in Angular?</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is ‘‘ngcc ’’ in Angular?]]></title>
            <link>https://medium.com/mobiroller-tech/what-is-ngcc-in-angular-1643d537bf20?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/1643d537bf20</guid>
            <category><![CDATA[ngcc]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Hamid Hassani]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 21:42:56 GMT</pubDate>
            <atom:updated>2023-04-25T21:42:56.463Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Angular is a popular front-end framework that provides a powerful platform for building complex web applications. One of the challenges of using Angular is ensuring that all packages and dependencies used in a project are compatible with the version of Angular being used. The Angular team provides a tool called `ngcc` to help address this issue.</p><h3>What is exactly`ngcc`?</h3><p>The `ngcc` is short for “Angular Compatibility Compiler”. It is a tool that is used to compile packages that were built with an older version of Angular to work with the latest version of Angular.</p><p>When a package is compiled with `ngcc`, the tool inspects the package’s code and generates new code that is compatible with the latest version of Angular. The generated code is stored in a separate directory in the package and is used instead of the original code when the package is used with the latest version of Angular.</p><p>The `ngcc` tool is included with the Angular CLI, and is run automatically when you build or serve an Angular project with the `ng build` or `ng serve` commands. It is also run automatically when packages are installed or updated with the `npm` package manager.</p><h3>How does `ngcc` work precisely?</h3><p>When you run `ng build` or `ng serve`, the Angular compiler first looks for the `__ngcc_entry_points__.json` file in your project’s `node_modules` directory. This file contains metadata about packages that have been compiled with `ngcc`.</p><p>If the file exists, the compiler uses the metadata to load the compiled code for any packages that have been compiled with `ngcc`. If the file does not exist, the compiler falls back to loading the original code for the packages.</p><p>When `ngcc` compiles a package, it generates new code that is compatible with the latest version of Angular. The generated code is stored in the `node_modules` directory in the package’s `__ivy_ngcc__` directory.</p><p>The `__ivy_ngcc__` directory contains two subdirectories: `esm2015` and `esm5`. These directories contain the compiled code for the package in ES2015 and ES5 formats, respectively. The `typings` directory contains the typings files for the package.</p><p>When a package is installed or updated with `npm`, `ngcc` automatically compiles the package if it has not been compiled already. If the package has already been compiled, `ngcc` checks to see if the version of the package has changed. If the version has changed, `ngcc` recompiles the package.</p><h4>What is `__ngcc_entry_points__.json`?</h4><p>`__ngcc_entry_points__.json` is a metadata file that is generated by `ngcc`. This file contains information about the Angular packages that have been compiled by `ngcc`.</p><p>Each entry point in the `__ngcc_entry_points__.json` file represents a package that has been compiled by `ngcc`. Each entry point contains the following information:</p><p>- `name`: The name of the package.</p><p>- `esm2015`: The path to the compiled ES2015 version of the package.</p><p>- `esm5`: The path to the compiled ES5 version of the package.</p><p>- `typings`: The path to the typings file for the package.</p><p>- `compiledByAngular`: A boolean value indicating whether the package was compiled by `ngcc`.</p><p>When the Angular compiler encounters a package that has been compiled by `ngcc`, it uses the information in the `__ngcc_entry_points__.json` file to load the compiled code instead of the original code. This ensures that packages used in an Angular project are compatible with the version of Angular being used.</p><pre>{<br>  &quot;ngccVersion&quot;: &quot;14.2.12&quot;,<br>  &quot;configFileHash&quot;: &quot;6883213aec2e6448f60915fdasfdf864b10646a78045af10f17ba40f81f18dd7c1b8e7&quot;,<br>  &quot;lockFileHash&quot;: &quot;5caa59305hgbb31ac6e5c72874fa5d66jhgjhg980fd31bd0675f124685f65297108c48f9&quot;,<br>  &quot;entryPointPaths&quot;: [<br>    [<br>      &quot;@angular/animations&quot;,<br>      &quot;@angular/animations&quot;<br>    ],<br>    [<br>      &quot;@angular/animations&quot;,<br>      &quot;@angular/animations/browser&quot;<br>    ],<br>    [<br>      &quot;@angular/animations&quot;,<br>      &quot;@angular/animations/browser/testing&quot;<br>    ],<br>    [<br>      &quot;@angular/cdk&quot;,<br>      &quot;@angular/cdk&quot;<br>    ],<br>    [<br>      &quot;@angular/cdk&quot;,<br>      &quot;@angular/cdk/a11y&quot;<br>    ],<br>    [<br>      &quot;webpack&quot;,<br>      &quot;webpack&quot;<br>    ],<br>    [<br>      &quot;zone.js&quot;,<br>      &quot;zone.js&quot;<br>    ]<br>  ]</pre><h3>Why is ngcc important?</h3><p>The Angular framework is constantly evolving, with new features and optimizations being added with each release. However, this means that packages built with older versions of Angular may not be compatible with the latest version. This can cause errors and unexpected behavior when using packages in an Angular project.</p><p>ngcc helps to address this issue by providing a way to automatically compile packages to work with the latest version of Angular. This can save developers a lot of time and effort, as they no longer have to manually update packages or search for compatible versions.</p><p>Additionally, ngcc allows packages to be updated independently of the Angular version being used in a project. This means that packages can be updated more frequently, providing access to the latest features and bug fixes.</p><h4>Conclusion</h4><p>In conclusion, `ngcc` and `__ngcc_entry_points__.json` are important tools in the Angular ecosystem. `ngcc` ensures that packages built with an older version of Angular can be used with the latest version of Angular, while `__ngcc_entry_points__.json` provides metadata that is used by the Angular compiler to load the compiled code for these packages. By using these tools, Angular developers can ensure that their projects are always using the latest and most compatible versions of the packages and dependencies they need.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1643d537bf20" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/what-is-ngcc-in-angular-1643d537bf20">What is ‘‘ngcc ’’ in Angular?</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Use UIStackView Like TableView]]></title>
            <link>https://medium.com/mobiroller-tech/how-to-use-uistackview-like-tableview-5e8ddefff055?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/5e8ddefff055</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[tableviews]]></category>
            <category><![CDATA[stack-view]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Gorkem Gur]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 08:43:13 GMT</pubDate>
            <atom:updated>2022-09-20T22:35:10.478Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we are going to learn how to use UIStackView as UITableView and UIView as UITableViewCell.</p><h4><strong>So why do we need this usage?</strong></h4><ul><li>If you don’t want to define or deal with tableview’s data source and delegate methods so long story short if you want to reduce complexity you can choose to use UIStackView,</li><li>You may have to use a scrollview on the page to be designed, etc.</li></ul><p>We set our use case in the list above. Now we have to think about how to set up an algorithm to use UIStackView as TableView.</p><h4>First, we need a UIView to display the incoming data. Then when this UIView is clicked we need to get the clicked index and the model from clicked view.</h4><p>So let’s create a design file (I used xib but you can use storyboard or whatever you want like programmatically it does not matter).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glS_CG1NOsoIb8V1KSsvog.png" /><figcaption>Basic Design For Usage StackView</figcaption></figure><blockquote>Then, We will use the nibloadable extension to create our interface. We need to integrate Nibloadable to our custom View , like the below code.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9e00b2dcf239e1bbbb2ef53717d4cb1/href">https://medium.com/media/e9e00b2dcf239e1bbbb2ef53717d4cb1/href</a></iframe><h4>We should create UIStackViewExtension</h4><p>We will create UIStackViewExtension in terms of readability, we do not want complicated code blocks in ViewController.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b30308152474275edfc91b22ba3abf07/href">https://medium.com/media/b30308152474275edfc91b22ba3abf07/href</a></iframe><p>After the create this extension we need to use these function in our ViewController with UIStackView.</p><p>Let’s check ExampleStackViewController</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/078a646c2b2f201cf2f3be25c6c3fb6f/href">https://medium.com/media/078a646c2b2f201cf2f3be25c6c3fb6f/href</a></iframe><p>We will do main operations via above codes. If you can look carefully we added tag to each MockView because we need to get clicked index when user tapped the rows of stackView.</p><h4>There are 2 items to consider here.</h4><ul><li>You need to set UITapGestureRecognizer in for loop for each MockView,</li><li>You have to add tags in for loop and use these tags in TapGestureRecognizer function to get the row the user clicked.</li></ul><p>That’s it you can use your UIStackView as UITableView, long story short our UIStackView becomes UITableView and our MockView becomes UITableViewCell now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*OxLRu6_U-p2ekB4hzFMUvg.gif" /><figcaption>ExampleStackViewUsage App Preview</figcaption></figure><p>I have tried to cover most of the things, but if something left please feel free to ask me :)</p><p>You can check full code of Project here:</p><p><a href="https://github.com/gorkemgur/ExampleStackViewApp">GitHub - gorkemgur/ExampleStackViewApp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e8ddefff055" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/how-to-use-uistackview-like-tableview-5e8ddefff055">How To Use UIStackView Like TableView</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encrypted Shared Preferences Nedir?]]></title>
            <link>https://medium.com/mobiroller-tech/encrypted-shared-preferences-nedir-fa63bf1ece00?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/fa63bf1ece00</guid>
            <category><![CDATA[sharedpreferences]]></category>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Hasan Polat]]></dc:creator>
            <pubDate>Mon, 05 Sep 2022 10:53:34 GMT</pubDate>
            <atom:updated>2022-09-05T10:53:33.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*ol1lT5QO7n1UmkoAf91osg.png" /></figure><p>Encrypted Shared Preferences, android uygulamalarda sıkça kullanılan Shared Preferences sınıfının genişletilmiş halidir.</p><p>Shared Preferences ile verileri saklayabiliriz fakat bu veriler herhangi bir şifreleme yöntemi ile kayıt altına alınmıyor. Bu sebep ile verilerimiz kötü niyetli kişiler tarafından ele geçirilebilir ve bu durum geliştirdiğimiz uygulamanın güvenilirliğini düşürebilir aynı zamanda kullanıcı verilerinin çalınmasına da yol açabilir.</p><p>Bu noktada Encrypted Shared Preferences, verilerimizi güvenli ve şifreli olarak tutmamıza olanak sağlıyor</p><h4>Encrypted Shared Preferences</h4><p>İlk olarak Android Jetpack’in Security kütüphanesinde tanıtılıyor. Saklamak istediğimiz bütün verileri otomatik olarak şifreleyip çözme özelliğine sahiptir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ma_q33knqvAGNaRXf4AXfQ.png" /></figure><p>Security kütüphanesine ait daha detaylı bilgi almak için aşağıdaki bağlantıyı okuyabilirsiniz.</p><blockquote><a href="https://developer.android.com/jetpack/androidx/releases/security">https://developer.android.com/jetpack/androidx/releases/security</a></blockquote><h4><strong>Encrypted Shared Preferences Kullanımı</strong></h4><pre>minSdkVersion 21</pre><p>İlk olarak, build.gradle (app) içerisine aşağıdaki satırı ekliyoruz.</p><pre>implementation &quot;androidx.security:security-crypto:1.1.0-alpha03&quot;</pre><p>Bu aşamadan sonra verileri şifreli olarak tutabilmek için bir şifreleme anahtarına ihtiyacımız var.</p><p>Bu anahtar, Master Key olarak tanımlanıyor. Master Key, Android işletim sisteminin en güvenli konumu olan Android Keystore içerisinde AES(Advanced Encryption Standard) şifreleme kullanılarak saklanmaktadır.</p><pre>val masterKey = MasterKey.Builder(<em>applicationContext</em>, MasterKey.<em>DEFAULT_MASTER_KEY_ALIAS</em>).setKeyScheme(MasterKey.KeyScheme.<em>AES256_GCM</em>).build()</pre><p>Artık Encrypted Shared Preferences kullanımına dair bir örnek gerçekleştirebiliriz. İlk olarak nesnemizi oluşturuyoruz.</p><pre>val encryptedSharedPreferences = EncryptedSharedPreferences.create(<em>applicationContext</em>, &quot;file_name&quot;, masterKey, EncryptedSharedPreferences.PrefKeyEncryptionScheme.<em>AES256_SIV</em>, EncryptedSharedPreferences.PrefValueEncryptionScheme.<em>AES256_GCM</em>)</pre><blockquote>Verilerin saklanacağı dosya ismini tırnak içerisinde ki değer ile özelleştirebilirsiniz.</blockquote><p>Bu aşamadan sonra verileri yazmak ve okumak için kullandığımız metot’lar Shared Preferences ile ortaktır. Örnek olarak bir kullanıcıya ait ad-soyad ve numara bilgisini kayıt etmek isteyelim.</p><pre>encryptedSharedPreferences.edit()<br>    .putString(&quot;fullName&quot;,&quot;hasan polat&quot;)<br>    .putInt(&quot;no&quot;,123456789)<br>    .apply()</pre><p>Uygulamayı çalıştırıp sonucu görebilmek için Device File Explorer içerisine giriniz:</p><p>Daha sonrasında; data/data/&lt;app.package.name&gt;/shared_prefs/ dizinine bakarsanız buna benzer bir yapının oluştuğunu göreceksiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qdJptSjevuK3F0t39_AbbQ.png" /><figcaption>Encrypted Shared Preferences</figcaption></figure><p>Aynı verileri Shared Preferences ile kayıt etmek isteseydik;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*w93eoOAim2cOQsbwe1ITfA.png" /><figcaption>Shared Preferences</figcaption></figure><p>Sonuç olarak;</p><ul><li>Encrypted Shared Preferences kullanımı ile hem key hem value değerlerimiz şifrelenerek kayıt altına alınmış oluyor</li><li>Key-Value değerlerini saklarken ayrıca key ve value için keyset’ler bulunmaktadır. Bu keyset’ler verileri şifrelemek ve çözmek için kullanılan şifrelenmiş anahtar içeririr. Yazının başında oluşturduğumuz master key ise bu keysetleri çözmek için kullanılır.</li></ul><p><strong>Kaynakça</strong></p><p><a href="https://developer.android.com/reference/androidx/security/crypto/EncryptedSharedPreferences">https://developer.android.com/reference/androidx/security/crypto/EncryptedSharedPreferences</a></p><p><a href="https://bignerdranch.com/blog/encrypting-shared-preferences-with-the-androidx-security-library/">https://bignerdranch.com/blog/encrypting-shared-preferences-with-the-androidx-security-library/</a></p><p><a href="https://developer.android.com/topic/security/data">https://developer.android.com/topic/security/data</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa63bf1ece00" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/encrypted-shared-preferences-nedir-fa63bf1ece00">Encrypted Shared Preferences Nedir?</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Use Git Pre Commit On Our Projects]]></title>
            <link>https://medium.com/mobiroller-tech/how-to-use-git-pre-commit-on-our-projects-f5b1d9c16aad?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/f5b1d9c16aad</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[gitflow]]></category>
            <category><![CDATA[pre-commit]]></category>
            <dc:creator><![CDATA[Gorkem Gur]]></dc:creator>
            <pubDate>Fri, 17 Jun 2022 18:52:22 GMT</pubDate>
            <atom:updated>2022-06-17T18:52:22.120Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Everyone,<br>We’ll learn integration of git pre commit to our project in this article.</p><p>Let’s start, so what is the git hook or git pre-commit with an example. Let me explain this :) Let’s say we have development mode, this mode changes some features in the project but you don&#39;t want to show these changes to your customers or testers. So how you can achieve this goal ? Actually, you have a lot of options to do this. For example; I can remove related files before committing and pushing them to repo. That’s the best option on my opinion, what if you forgot to remove that line and 100 users installed your app to their devices, that’s gonna be terrible user experience. This mistake you make during the development process may damage your reputation with some customers.</p><p>First of all we are human and we can forget somethings right ? There is a good solution about this situation and it is called git pre-commit. That solution does not allow developers to commit unwanted lines or code blocks.</p><p>You and your team need to know little bit terminal commands to run script and if you want to customize pre-commit you need to learn bash script (basic level).</p><p>We do not need to install any extension except git :). If you are a curious person, you may have seen these files before</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*QKpBOv6E48dHDsuO0fmAmQ.png" /><figcaption>Listing Project Files</figcaption></figure><p>You can type <strong>cd .git. </strong>command and you can see the hooks file with ls -la command, after you see the hooks file you need to type<strong>cd hooks</strong> command to enter file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*4q1v79SXBwbmT_HdyzrS0A.png" /><figcaption>Git Hook Samples Under The Hooks Folder</figcaption></figure><p>You can see above the image there are the necessary sample files under the hooks folder.In this article we will use pre-commit file with symlink (i will explain why we need to use that).</p><p>Here we are! Finally we can create our pre-commit file, first you need to create a folder called .hooks in your project folder</p><ul><li>cd ~/Documents/Github/ExampleApp (It’s my project path you need to write your own project file path)</li><li>touch setup.sh</li><li>mkdir .hooks</li><li>cd .hooks/</li><li>touch pre-commit</li><li>sudo chmod +x ../setup.sh</li></ul><p>We created the necessary files with above code the next step is creating our setup.sh (the developer team need to run this bash script on their terminal)</p><p>So what is the setup.sh ? This file is linking our pre-commit file to .git/hooks/pre-commit file and we need to say, git you need to use our .hooks file you do not need to .git/hooks/ file.</p><pre>#setup.sh</pre><pre>ln -s -f $(pwd)/.hooks/pre-commit .git/hooks/pre-commit<br>git config core.hooksPath $(pwd)/.hooks<br>sudo chmod +x $(pwd)/.hooks/pre-commit<br>echo pre-commit &gt;&gt; $(pwd)/.git/info/exclude</pre><ul><li>First line is linking our pre-commit to git pre-commit,</li><li>The second line is tells the git path of the our .hooks/ file,</li><li>The third line is important because we need to give access pre-commit file to check our tracked / untracked, modified files</li></ul><p>Then the last line is very important this line is excluding our pre-commit file of our condition in pre-commit file (It’s complicated but i will explain that so do not worry.)</p><p>So we created our setup.sh we need to develop our pre-commit file. I develop this file to my own needs your situation can be different. I do not want to commit if the file contents a string like developmentMode(true)</p><pre>#pre-commit</pre><pre>#!/bin/bash</pre><pre>#declared an array if we need one more than string<br>declare -a unallowedStringsArray=(&#39;developmentMode(true)&#39;)</pre><pre>#we need to search our string in files if files contains<br>#that string commit&#39;ll be rejected with error message</pre><pre>for i in &quot;${unallowedStringsArray[@]}&quot;<br>do<br>    git diff --cached --name-only | xargs grep --with-filename $i &amp;&amp; echo &quot;COMMIT REJECTED! Found &#39;$i&#39; references. Please remove them before commiting.&quot; &amp;&amp; exit 1<br>done</pre><pre>exit 0</pre><p>And finally we can use our customized files and share the our developer team :)</p><p>You just need to commit these changed files to your repo, do not forget to explain how to run setup.sh the developer team with belowe codes</p><ul><li>sudo chmod +x setup.sh</li><li>./setup.sh</li></ul><p>The Final Result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*JVA4lpJqb_QCCEGDMeY8_g.png" /><figcaption>Sample Pre-Commit Usage</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5b1d9c16aad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/how-to-use-git-pre-commit-on-our-projects-f5b1d9c16aad">How To Use Git Pre Commit On Our Projects</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose Nedir? — 1 —]]></title>
            <link>https://medium.com/mobiroller-tech/jetpack-compose-nedir-1-66bdead7d82b?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/66bdead7d82b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Hasan Polat]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 07:50:56 GMT</pubDate>
            <atom:updated>2022-04-19T07:50:56.589Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jetpack Compose Nedir? -1-</h3><p>Selamlar, bu yazıda, Jetpack Compose hakkında araştırma yapıp öğrendiğim bilgileri sizinle paylaşacağım. Bu kısımda anlatacaklarım part-1 olacak. 3 part olacak şekilde anlatmayı düşünüyorum. Umarım keyif alırsınız..</p><h3><strong><em>Jetpack Compose Nedir?</em></strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*OT4J6X5y_vrm5_5xpCUDKw.png" /></figure><p>Öncelikle Android’in tanımını sizinle paylaşmak istiyorum.</p><blockquote><strong>Jetpack Compose is Android’s modern toolkit for building native UI.</strong></blockquote><p>Kısaca “Native Android UI’ları oluşturmayı sağlayan modern bir toolkit.” olarak kendisinden bahsediyor ve geliştiricilere aşağıdaki kolaylıkları sağladığını belirtiyor.</p><ul><li>Daha az kod</li><li>Sezgisel</li><li>Geliştirmeyi hızlandırın</li><li>Güçlü</li></ul><h4>Daha az kod -&gt;</h4><p>Daha az kod yazmak, geliştirmenin tüm aşamalarını etkiler. Örneğin, bir geliştirici olarak, daha az test ve daha az hata olasılığı elde edebilirsiniz. Aynı şekilde bir gözden geçiren veya bakımcı olarak okumak, anlamak, gözden geçirmek ve sürdürmek için daha az kodunuz var.</p><h4>Sezgisel -&gt;</h4><p>Compose, bildirime dayalı bir API kullanır. Yapmanız gereken tek şeyin kullanıcı arayüzünüzü tanımlamak olduğu anlamına gelir. Compose gerisini halleder.</p><h4>Geliştirmeyi hızlandırın -&gt;</h4><p>Compose tüm kodunuzla uyumludur. En popüler kütüphaneler olan Navigation, ViewModel, ve Kotlin Coroutines; Compose ile çalışır. Böylece istediğiniz zaman ve istediğiniz yerde kullanmaya başlayabilirsiniz.</p><h4>Güçlü -&gt;</h4><p>Android platform API’lerine doğrudan erişim ve Materyal Tasarımı, Karanlık tema, animasyonlar ve daha fazlası için yerleşik desteğe sahip güzel uygulamalar oluşturmanıza olanak tanır.</p><p><strong>Peki bu kolaylıkları nasıl sağlıyor gelin bunlardan bahsedelim.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*h_xs5DTJyW3lhkD03XcCrw.png" /></figure><p><strong>1-</strong> Uygulama geliştirirken kullandığımız view’lar kendisine bağlı bir üst view ’dan miras alır. Jetpack Compose’ da ise, kullanılan view miras süreçlerine dahil olmadan direkt olarak kullanılabilir biçimde oluyor</p><p><strong>2- </strong>Yazdığınız kodu anında görüntüleyebilirsiniz.</p><p><strong>3-</strong> Declarative UI yaklaşımıyla Jetpack Compose kullanarak kodladığımızda daha basit ve daha az satır kodla geliştirme yapabilirsiniz.</p><p><strong>Declarative UI Nedir?</strong></p><p>Uygulama içerisinde, kullanıcının herhangi bir etkileşimi sonrası mevcut UI’ ı güncellememiz gerekebilir. Bu durumda gözüken view’ları manuel olarak güncellemek hata yapmamıza ve bundan dolayı uygulamamızın çökmesine sebep olabilir.</p><p>Jetpack Compose, UI güncellemelerinde bahsettiğim bu karışıklığı ortadan kaldırabilecek bir kolaylık sağlıyor.</p><p><strong>Peki bu kolaylığı nasıl sağlıyor?</strong></p><p>State kavramı ile sağlıyor. Örnek olarak UI’da gösterdiğimiz herhangi bir view’ in <strong>visible</strong> veya <strong>inVisible</strong> olmasını istiyorsak <strong>state</strong> ile kontrol ederek yapmamız gerekir.</p><p>Bu yapı, tüm ekranı sıfırdan tekrar oluşturarak veya sadece gerekli durumlarda değişiklikler uygulayarak çalışıyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*R6VLAuf8R1CzoJJTc6iM_Q.png" /></figure><p>Bu durumun maliyetli olabileceği düşünülebilir fakat Compose bunu sadece güncellemesi gereken UI parçasını <strong>recomposition </strong>yaparak, yani <strong>düzenleyerek(oluşturarak) </strong>yapıyor ve bu şekilde sanılanın aksine çok maliyetli bir durum gibi gözükmüyor.</p><h3>Kurulum</h3><p>Android studio üzerinde yeni bir proje oluşturmaya başlayalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*HIqABTzkWpoIlvBnnyG3qA.png" /></figure><p>New project tıkladıktan sonra Empty Compose Activity seçiyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*6qoKg3ZK2DB50dpThM2apQ.png" /></figure><p>Açılan pencerede oluşturacağımız proje ile ilgili ayarları değiştirebilirsiniz.</p><p>1- Oluşturacağımız proje için<strong> minimum SDK olarak API 21</strong>: Android 5.0 (Lollipop) seçilebilir</p><p>2- Jetpack Compose, Kotlin ile geliştirildiği için desteklenen dil olarak <strong>sadece Kotlin</strong> seçeneğini göreceğiz.</p><p>Sonrasında, finish’e basarak projemizi oluşturuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*IFg77HhQDovctJRxeIEQag.png" /></figure><p>Burada ilk olarak MainActivity içerisinde ki setContent kısmından bahsetmek istiyorum. Bu kısım da bir activity’e ait layout dosyasını (.xml) inflate etmek yerine Composable fonksiyonlar çağırır ve bu şekilde UI oluştururuz.</p><p><strong>Composable Function Nedir?</strong></p><p>UI’da bir şeyler oluşturmak için <strong>@Composable</strong> etiketi kullanırız. Bundan dolayı ekranda bir text veya button gibi ögeler oluşturacaksınız bunların composable fonksiyon olması gerekiyor.</p><p>1- Tüm composable fonksiyon’lar bu etikete sahip olmalıdır; bu açıklama, Compose derleyicisine bu işlevin verileri kullanıcı arayüzüne dönüştürmeyi amaçladığını bildirir.</p><p>2- UI oluşturma işini üstlendiklerinden dolayı geriye hiçbir değer döndürmezler.</p><p>3- Composable fonksiyonları, composable fonksiyonlar içerisinden çağırmanız gerek. Bu durum Kotlin suspend fonksiyon kullanımına benziyor.</p><p>Diğer yandan <strong>@Preview</strong> etiketinden bahsedecek olursak;</p><p>Composable fonksiyonlarınıza bu etiketi eklediğinizde Default Preview kısmından <strong>anlık olarak yapılan değişikliği görüntüleyebilirsiniz.</strong></p><p>Bu şekilde geliştirmeyi ciddi anlamda hızlandırdığını düşünüyorum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*tvDPaBCaF7uDwjkxZEB8ow.png" /></figure><p>Şimdilik bu kısımda anlatacaklarım bu kadar. Bir sonraki yazımda biraz daha detay verip örnek bir uygulama geliştirmeye çalışacağız.</p><p><strong>Kaynakça</strong></p><p><a href="https://developer.android.com/jetpack/compose"><strong>https://developer.android.com/jetpack/compose</strong></a></p><p><a href="https://developer.android.com/jetpack/compose/tutorial"><strong>https://developer.android.com/jetpack/compose/tutorial</strong></a></p><p><a href="https://developer.android.com/codelabs/jetpack-compose-basics#0"><strong>https://developer.android.com/codelabs/jetpack-compose-basics</strong></a></p><p><a href="https://iamcodder.medium.com/jetpack-compose-%C3%A7ok-daha-az-%C3%A7ok-daha-g%C3%BC%C3%A7l%C3%BC-dccd24840eb8"><strong>https://iamcodder.medium.com/jetpack-compose-%C3%A7ok-daha-az-%C3%A7ok-daha-g%C3%BC%C3%A7l%C3%BC-dccd24840eb8</strong></a></p><p><a href="https://elifboncuk.dev/2020/03/09/building-ui-with-compose/"><strong>https://elifboncuk.dev/2020/03/09/building-ui-with-compose/</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66bdead7d82b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/jetpack-compose-nedir-1-66bdead7d82b">Jetpack Compose Nedir? — 1 —</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VIPER]]></title>
            <link>https://medium.com/mobiroller-tech/viper-588f1b60af1b?source=rss----28667e84819---4</link>
            <guid isPermaLink="false">https://medium.com/p/588f1b60af1b</guid>
            <category><![CDATA[viper]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Sefa Çelik]]></dc:creator>
            <pubDate>Wed, 06 Apr 2022 08:01:59 GMT</pubDate>
            <atom:updated>2022-04-06T08:01:59.754Z</atom:updated>
            <content:encoded><![CDATA[<p>Yazılım geliştirme sürecinde bir çok zorluk ve bu zorluklardan doğan ihtiyaçlar vardır. Bunlardan biri de yazılım mimarileridir. Mimariler kod yazanlar için bir çok kolaylık sunar. Bunlara örnek vermek gerekirse:</p><p>1- Okuma/yazma kolaylaşır.</p><p>2- Projenin yönetimi ve denetimi kolaylaşır</p><p>3- Testlerin yapılması ve yazılması kolaylaşır.</p><p>MVC, 1996 yılında kullanılmaya başlamış ve projeleri modüllere ayırmada başarılı olmuş bir modeldir. Microsoft ve Amazon gibi şirketler bu mimari ile geliştirme yaptı ve yapmakta. Bu şirketlerin yanı sıra Apple da kendi iOS uygulamalarında MVC ile geliştirme yapıyor. Fakat projelerin büyümesi, karmaşıklığın artması ile MVC ihtiyaçları karşılayamamaya başladı. Viper da bu ihtiyaçtan doğan bir mimarilerden biri.</p><p>Viper ismini View, Interactor, Presenter, Entity, Router’ın ilk harflerinden almakta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/0*xW18KcqJWUIDMYDq.png" /></figure><p><strong>View:</strong></p><p>Kullanıcının göreceği kısım burada oluşturulur. Presenter ile haberleşir. Hangi içeriğin gösterileceği View’e bağlıdır. Kullanıcı actionları Presenter’a yönlendirir.</p><p><strong>Interactor:</strong></p><p>Business logic işlemlerinin yapıldığı kısımdır. Presenter ile haberleşir.</p><p><strong>Presenter:</strong></p><p>Presenter, View ile ilgili logic’i içeren kısımdır. Router, Interactor ve View ile haberleşir. Interactor’dan data alır ve View katmanına iletir. View’dan da kullanıcı aksiyonlarını alır ve yönlendirir. View ile Interactor arasında bir köprü görevi görür.</p><p><strong>Entity:</strong></p><p>Interactor’da kullanılan modellleri içerir. Entity’ler sadece Interactor tarafından kullanılır.</p><p><strong>Router:</strong></p><p>Ekranların ne zaman gösterileceğinin belirlendiği, uygulama flowunun kontrol edildiği katmandır. Presenter ile haberleşir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Pua-Ur1T4ltfQq-6GQRuuA.jpeg" /></figure><p>App projesini bir ev olarak düşünürsek her bir sayfayı bir oda, her bir odayı da bir viper modülü olarak düşünebiliriz. Bu modüller arasındaki haberleşme ise protokollerle yapılır. Yaşam döngüleri ve referans yapısı göz önüne alındığında VIPER tasarım mimarisi iOS projeler için en uygun olanıdır. Büyük ve bakım yapılması zor olan projelerde başarılı bir şekilde uygulanabilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6rCr7rcNSGRqIXZs7RxOgQ.png" /></figure><p><strong>VIPER mimarisinin avantajları</strong></p><p>1- Kodun test edilebilirliğini ve tekrar kullanılabilirliğini sağlar.</p><p>2- Rollerine göre uygulamayı komponentlere böler ve ilgili kodların birbirinden bağımsız ayrılmasını sağlar.</p><p>3- Yeni özelliklerin eklenmesini kolaylaştırır.</p><p>4- UI logic Business logicden ayrı yazıldığı için testlerin yazımını kolaylaştırır.</p><p><strong>VIPER mimarisinin dezavantajları</strong></p><p>1- Küçük projelerde karmaşıklığı artırır.</p><p>2- Ekibin paterni iyi bilmesi ve ona uygun kod yazması gerekir.</p><p>3- Yeni başlayanlarda paterne uygun kod yazma için öğrenme süreci gerektirir.</p><p><strong>Viper Örnek Proje linki:</strong> <a href="https://github.com/sefaceliik/Viper-Example/tree/main/Viper-Example">https://github.com/sefaceliik/Viper-Example/tree/main/Viper-Example</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=588f1b60af1b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobiroller-tech/viper-588f1b60af1b">VIPER</a> was originally published in <a href="https://medium.com/mobiroller-tech">Mobiroller Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>