<?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 Sören Kirchner on Medium]]></title>
        <description><![CDATA[Stories by Sören Kirchner on Medium]]></description>
        <link>https://medium.com/@soeren-kirchner?source=rss-c6f67150158f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Yobr5Y9IFpSdXWBXPn9BSg.jpeg</url>
            <title>Stories by Sören Kirchner on Medium</title>
            <link>https://medium.com/@soeren-kirchner?source=rss-c6f67150158f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 05:14:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@soeren-kirchner/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[Deep Deterministic Policy Gradient (DDPG) with and without Ornstein–Uhlenbeck process]]></title>
            <link>https://soeren-kirchner.medium.com/deep-deterministic-policy-gradient-ddpg-with-and-without-ornstein-uhlenbeck-process-e6d272adfc3?source=rss-c6f67150158f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6d272adfc3</guid>
            <category><![CDATA[ornstein-uhlenbeck]]></category>
            <category><![CDATA[deep-reinforcement]]></category>
            <category><![CDATA[action-noise]]></category>
            <category><![CDATA[ddpg]]></category>
            <category><![CDATA[adaptive-parameter-noise]]></category>
            <dc:creator><![CDATA[Sören Kirchner]]></dc:creator>
            <pubDate>Wed, 29 Sep 2021 19:10:17 GMT</pubDate>
            <atom:updated>2021-09-29T19:24:57.049Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ef5t0Twdk6ggX4ppOIQbeA.jpeg" /></figure><h3>Replacing the Ornstein-Uhlenbeck Process Action Noise by simpler Normal Action Noise or Adaptive Parameter Noise</h3><h3>Motivation</h3><p>In my Deep Reinforcement Learning course at Udacity, I had to do a project solving the Reacher Environment. You can choose between different algorithms to implement and I chose DDGP. In the <a href="https://arxiv.org/pdf/1509.02971v6.pdf">original paper</a>, the researchers introduced the Ornstein-Uhlenbeck process for generating random values to be applied as action noise. They write:</p><blockquote>As detailed in the supplementary materials we used an Ornstein-Uhlenbeck process (Uhlenbeck &amp; Ornstein, 1930) to generate temporally correlated exploration for exploration efficiency in physical control problems with inertia (similar use of auto- correlated noise was introduced in (Wawrzyn ́ski, 2015))</blockquote><p>This sounds more like intuition than a strong connected reason but of course, it is worth giving it a try. And in the end, it works. But this alone does not explain, why this complicated algorithm to generate a series of random numbers instead of using common normal distributed random numbers will improve the learning.</p><p>So I decided to try out using common <strong>normal noise</strong> and <strong>adaptive parameter noise</strong> as well.</p><h3>The Environment</h3><p>Before I discuss the different methods, I give some introduction about the used environment. The environment is described on the project page as follows:</p><blockquote>In this environment, a double-jointed arm can move to target locations. A reward of +0.1 is provided for each step that the agent’s hand is in the goal location. Thus, the goal of your agent is to maintain its position at the target location for as many time steps as possible.</blockquote><blockquote>The observation space consists of 33 variables corresponding to position, rotation, velocity, and angular velocities of the arm. Each action is a vector with four numbers, corresponding to torque applicable to two joints. Every entry in the action vector should be a number between -1 and 1.</blockquote><blockquote>The environment is considered solved, when the average (over 100 episodes) of the <strong>average scores</strong> is at least +30.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEM3UjRuH0aA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEM3UjRuH0aA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEM3UjRuH0aA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/50be715e8bb69af063c679a84ebd6843/href">https://medium.com/media/50be715e8bb69af063c679a84ebd6843/href</a></iframe><p>I used a version with 20 identical agents, each with its copy of the environment. More details like where to download and how to install you will find in the <a href="https://github.com/soeren-kirchner/project2-reacher">GitHub repository of my implementation</a>.</p><h3>Implementations</h3><p>I will only explain the parts that differ and show only the relevant parts of the code. You find the complete implementations in the <a href="https://github.com/soeren-kirchner/project2-reacher">GitHub repository</a> and for the math, please have a look at the linked papers.</p><p>As part of the original DDPG concept, the state values will be forward passed thru the Actor and we get the action values. While training noise will be added to the action values and they will be forward passed thru the Critic together with the state values. For the noise, they used the Ornstein-Uhlenbeck process. So the noise is called ou-noise for short.</p><h3>Ornstein-Uhlenbeck Process Action Noise</h3><h4>Ornstein-Uhlenbeck Process</h4><p>The <a href="https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process">Ornstein-Uhlenbeck Process</a> is a stochastic process discovered and published in 1930 by G. E. Uhlenbeck and L. S. Ornstein in their paper <a href="http://entsphere.com/pub/pdf/1930%20Uhlenbeck,%20on%20the%20theory%20of%20the%20Brownian%20motion.pdf">“On the Theory of the Brownian Motion”</a>. It has applications in physics and financial mathematics.</p><p>The process has some interesting properties. It is a <a href="https://en.wikipedia.org/wiki/Gaussian_process">Gaussian</a> and a <a href="https://en.wikipedia.org/wiki/Markov_chain">Markov</a> process. I assume, that’s where the intuition to use it as action noise came from. The simplified key properties we need to know for our application are:</p><ul><li>The next value depends on the current value.</li><li>The generated values have a normal distribution.</li></ul><p>An implementation of the process looks as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/159a9d666d9553cd2e759cd6b6a5160c/href">https://medium.com/media/159a9d666d9553cd2e759cd6b6a5160c/href</a></iframe><h4>Adding OU-Noise to the Action Values</h4><p>The class must be initialized once with the needed action size.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afb0ce8e81303957db905ffd0b32889a/href">https://medium.com/media/afb0ce8e81303957db905ffd0b32889a/href</a></iframe><p>Then every call of the sample()-method will give the next values (ou-noise) used for adding noise to the action.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d0da05afacd629af3f5f77caac9f724/href">https://medium.com/media/3d0da05afacd629af3f5f77caac9f724/href</a></iframe><p>In addition, all implementations I saw, reset the ou-noise after each episode. I also didn’t find a reason for this. But I haven’t tested, if it works without too.</p><h4>Result</h4><p>After some tests and hyperparameter tuning I got the following results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*gz-4a2gV3J7Vom3VXscDxw.png" /><figcaption>Result with ou-noise.</figcaption></figure><p>I think those are good results. The learning progress is relatively even. The average score is reached for the first time after 46 episodes and it then stays above this value. And it reaches consistently high values.</p><h3>Normal Action Noise</h3><p>After I got it running and the agent learned well, I kept everything the same and only replaced the ou-noise with normal noise. Therefore the ou-noise class for generating the values is no longer necessary and can be removed.</p><p>And I changed the line that adds the noise:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9199d197221fee52053e197478f9ee8/href">https://medium.com/media/d9199d197221fee52053e197478f9ee8/href</a></iframe><p>Here we get a new hyperparameter, normal_scalar that scales how much noise is added. The line adds random noise to the action that has a standard normal distribution, a mean of 0, and a standard deviation of normal_scalar.</p><h4>Result</h4><p>With the normal_scalar set to 0.25 I got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*snyFQCe3Tj-K-GvVLsPGmQ.png" /><figcaption>Result with normal action noise.</figcaption></figure><p>The result looks similar to that from the ou-noise. The learning progress is relatively even. The average score is reached for the first time after 43 episodes and it then stays above this value. And it reaches consistently high values too.</p><h3>Adaptive Parameter Noise</h3><p>The <a href="https://arxiv.org/abs/1706.01905">Adaptiv Parameter Noise</a> is a little more complex but interesting.</p><p>The Idea: Adding noise to the weights of the Actor, forward pass the state values and get noised action values this way instead of adding the noise to the action values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*_G7hZp2-W_1-ExBrOtIG2A.png" /><figcaption>Left: Noise added to the action. Right: Noise added to the Network (Image is taken from <a href="https://openai.com/blog/better-exploration-with-parameter-noise/">OpenAI</a>)</figcaption></figure><h4>Adaptive</h4><p>In the previous methods, we can simply adjust the amount of action noise.</p><p>If we put the noise directly to the weights of the network, we can not say how much it will affect the action values. And even worse, the impact will change over time. And that’s, where adaption comes into play.</p><p>We make a copy of the current Actor and put a little amount of noise to its weights. Then we forward pass the state thru both networks and calculate the distance between the results.</p><p>If the distance is greater than the desired value, we decrease the amount of noise we put to the weights next time, and if the distance is lower than the desired value, we increase the amount of noise. The desired value is a new hyperparameter we chose similar to selecting the standard deviation on normal noise.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c3c9281824dc3500a962b1f8d115e35/href">https://medium.com/media/3c3c9281824dc3500a962b1f8d115e35/href</a></iframe><p>The add_parameter_noise() method of the Actor-network:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce799707e088f931bc37cd52912a2d04/href">https://medium.com/media/ce799707e088f931bc37cd52912a2d04/href</a></iframe><h4>Result</h4><p>After some experiments, I ended up with the desired value for the distance of 0.7 and got the following results. The average score is reached for the first time after <strong>24 episodes</strong> and it then stays above this value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*VEhq-qOHgGyNPbrYwxhE1A.png" /><figcaption>Result with adaptive parameter noise</figcaption></figure><p>To be honest, I was totally surprised and excited. It learned so fast and stayed so stable.</p><h3>Comparison and Conclusion</h3><p>The direct comparison of the results shows impressively the differences. The ou-noise and the normal-noise are producing similar and good results. Their learning curves are looking like expected, and they are fast. But in comparison, the learning curve of the adaptive parameter noise is outstanding and shows an impressive learning behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*N2Ea-Yywh1mxV_AAgiMFYQ.png" /><figcaption>blue: ou-noise, orange: normal noise, green: adaptive parameter noise</figcaption></figure><h3>Closing thoughts and notes</h3><p>Please be aware, that this is not a scientific work and no proof for anything. These are only some experiments. Maybe that there are cases and well-tuned hyperparameters where ou-noise gives better results than the others. <br>Nevertheless, it shows that simple normal noise gives similar results too.</p><p>During my research for this article, I found a <a href="https://spinningup.openai.com/en/latest/algorithms/ddpg.html">page from Open AI about DDPG</a> and they write:</p><blockquote>The authors of the original DDPG paper recommended time-correlated <a href="https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process">OU noise</a>, but more recent results suggest that uncorrelated, mean-zero Gaussian noise works perfectly well. Since the latter is simpler, it is preferred.</blockquote><p>I think Deep Reinforcement Learning is not the easiest subject to learn. ou-noise does not make it easier, especially when it is unnecessary. Okay, on the other hand, I learned a lot. <br>I want to use the article to encourage other students to try the other methods, especially adaptive parameter noise.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSAIhII0Yo5U%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSAIhII0Yo5U&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSAIhII0Yo5U%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9155e9f686e5b3fe615d6d1c695dc7d/href">https://medium.com/media/c9155e9f686e5b3fe615d6d1c695dc7d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6d272adfc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(Ent-)Gendern von Online-Publikationen]]></title>
            <link>https://blog.nullaufeins.org/ent-gendern-von-online-publikationen-ec7c40f9e490?source=rss-c6f67150158f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec7c40f9e490</guid>
            <category><![CDATA[language]]></category>
            <category><![CDATA[inclusion]]></category>
            <category><![CDATA[deutsch]]></category>
            <category><![CDATA[gender]]></category>
            <category><![CDATA[diversity]]></category>
            <dc:creator><![CDATA[Sören Kirchner]]></dc:creator>
            <pubDate>Thu, 20 May 2021 13:22:43 GMT</pubDate>
            <atom:updated>2021-05-20T14:16:46.686Z</atom:updated>
            <content:encoded><![CDATA[<h4>Liberalisierung des Genderns</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KLuG40etWOiFZn5walkDQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@enginakyurt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">engin akyurt</a> on <a href="https://unsplash.com/s/photos/wooden-doll?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Das Gendern von Texten ist gerade ein viel diskutiertes Thema und als Verleger bin ich natürlich daran interessiert und als Developer beschäftigt mich die mögliche Umsetzung.</p><h4>Wer die Wahl hat …</h4><p>Wer sich dafür entscheidet, die Publikationen im Haus zu gendern, steht vor der Frage: Wie?</p><p>Welche Form des Genderns wählt man aus? Die schon etwas betagtere Variante “LeserIn”? Oder die lautere Variante “Leser*in”, die deutlicher auf das darunter liegende Problem hinweisen soll? Oder die leisere Variante “Leser:in”, die optisch gefälliger ist. Oder gar eine radikalere Variante: Entgendern mit y nach Phettberg/Kronschläger (y-Variante). Dazu später mehr.</p><p>Bei der Suche nach der besten Lösung haben wir uns – als Verlag – viel im Netz umgesehen und es ist aussichtslos. Jede Variante hat ihr Für und Wider und die Debatten darum werden quasireligiös bis fanatisch geführt. Es gibt keine brauchbare Basis, auf der eine Entscheidung gefällt werden könnte. Häufig wird jetzt der Doppelpunkt verwendet und wir haben uns auch vorerst diesem Trend angeschlossen. Es ist einfach ein zarter Kompromiss. Das Anliegen bleibt nicht unberücksichtigt und für die Sprachwahrer:innen ist es am erträglichsten. So ist es eine praktische Lösung aus Verleger:innen-Sicht.</p><p>Auf Facebook bin ich zum Thema Gendern auf diesen schönen Satz einer Nutzerin gestoßen:</p><blockquote>Das Problem mit der Inklusion ist, dass man immer immer immer auf ein Dilemma stößt. Ich denke, dass wir verstehen müssen, dass es ein Prozess mit trial and error ist und Neugier mehr nützt als Rechthaberei.</blockquote><p>Und diesem Prozess kann noch etwas hinzugefügt werden. Eine unerzogene Variante, wenn man so möchte:</p><h3>Wir lassen die Leser:innen selbst wählen</h3><p>Nun gibt es fast alle Zeitschriftenpublikationen auch online. Das bietet natürlich ganz neue Möglichkeiten.</p><p><strong>Warum lassen wir die Leser:innen nicht einfach selbst wählen, welche der angebotenen Gender- oder Entgenderformen sie lesen möchten?</strong></p><p>Um das zu demonstrieren und auszuprobieren habe ich ein kleines Skript entwickelt und in die Gratisartikel der letzten beiden Ausgaben unseres Magazins eingebunden.</p><ul><li><a href="https://www.unerzogen-magazin.de/hefte/?magazineID=54">unerzogen Magazin – Lob und Belohnung</a></li><li><a href="https://www.unerzogen-magazin.de/hefte/?magazineID=53">unerzogen Magazin – Stress, Angst, Krise</a></li></ul><p>Die aktuelle Version bietet einige gängige Gendervarianten, Entgendern nach Phettberg/Kronschläger und noch hübsche, wenn auch nicht ganz ernst gemeinte, Varianten.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*RMmjX5dhTzEIl_xItLGXSA.gif" /></figure><p>Nun können die Leser:innen entscheiden, wie sie es lesen möchten. Und was noch entscheidender ist: Die Varianten können nun einfach mal durchprobiert werden.</p><p>In vielen Beispielen und Debatten werden oft nur die Extreme gezeigt und diskutiert. So entsteht schnell der Eindruck einer dramatischen Änderung der Sprache. Wenn man es sich jedoch an echten Publikationen anschaut, fällt auf, dass es in der Regel gar nicht so häufig im Text vorkommt.</p><h3>gendy — das (Ent-)GenderSkript</h3><p>Damit es Interessierte auch auf der eigenen Website einbinden können, habe ich dem Skript eine kleine funktionsfähige Demo hinzugefügt, was zeigt, wie es eingebunden wird und wie der Text vorbereitet werden muss.</p><p>Das Skript ist in Javascript geschrieben, ist Open Source und steht auf GitHub zur Verfügung.</p><ul><li><a href="https://github.com/soeren-kirchner/gendy">https://github.com/soeren-kirchner/gendy</a></li></ul><h3>Was ist (Ent-)Gendern</h3><p>Ich möchte gern intensiver auf das Entgendern eingehen. Entgendern meint, dass man eine Form wählt, die keine Geschlechter mehr enthält.</p><h4>Beispiel: (Ent-)Gendern nach Phettberg/Kronschläger</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FE7Vn_pS2G-Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DE7Vn_pS2G-Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FE7Vn_pS2G-Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5778f3df25a7bcd257fdd18275647244/href">https://medium.com/media/5778f3df25a7bcd257fdd18275647244/href</a></iframe><p>Diese Variante ist einfach. Im Singular wird ein <strong>y</strong> an den Wortstamm gehangen und im Plural <strong>ys</strong>. Für die Personalpronomen benutzt man den sächlichen Genus. Wer mehr darüber erfahren möchte:</p><ul><li><a href="https://www.deutschlandfunkkultur.de/entgendern-nach-hermes-phettberg-bis-das-arzty-kommt.1013.de.html?dram:article_id=492876">Bis das Arzty kommt! (Deutschlandfunk)</a></li><li><a href="https://www.researchgate.net/publication/343974830_Entgendern_nach_Phettberg_im_Uberblick">Entgendern nach Phettberg im Überblick</a></li></ul><h3>Warum es wichtig ist, Entgendern anzubieten</h3><p>Oder: Warum ich es für wichtig halte. Schaut man sich die Gendervariationen an, fällt auf, dass sie dem Grunde nach alle gleich funktionieren und nur eine Variation des Trennzeichens beinhalten. Sie fügen die feminine Form recht ausdrucksdominant dem generischen Maskulinum hinzu bzw. ersetzen es. Was natürlich berechtigt ist, dass die feminine Form nun so hervorklingt, da sie die bisher zurückgestellte war. Man erhofft sich davon, auf das Thema “Stellung der Frau in der Gesellschaft” aufmerksam zu machen und ein gesellschaftliches Umdenken zu induzieren.</p><h4>Nachteile der Genderform</h4><p>Jedoch kann diese Form nur eine Interimslösung darstellen, da sie auch einige erhebliche Nachteile mit sich bringt:</p><ul><li>Alle nonbinären oder sich nonbinär fühlenden Menschen sind immer noch ausgeschlossen.</li><li>Sie zementiert die Betrachtung der Menschen nach ihrem Geschlecht.</li><li>Sie macht die Sprache schwerer lesbar und sperriger.</li><li>Sie lässt sich in die Alltagssprache nur schwer integrieren.</li></ul><p>Der erste Punkt ergibt sich von selbst. Der zweite Punkt ist auch relativ klar. Man weist unentwegt auf die männliche und weibliche Form hin. Auch der dritte Punkt ist klar. Es ist, beispielsweise für Menschen, die gerade erst Deutsch lernen, sicher keine einfache Sache, und widerspricht offensichtlich dem inklusiven Ansatz der Einfachen Sprache.</p><p>Der letzte Punkt ist für eine Transformation wesentlich. Denn wenn die Nutzer:innen nicht mitgedacht werden, wird die Änderung auch nicht angenommen. Es mag sein, dass Autor:innen, Lektor:innen, Verleger:innen und Intellektuelle die Formen einfach in den Text aufnehmen können, dass es jedoch von einer breiten Masse angenommen und gesprochen wird, halte ich nicht für sehr wahrscheinlich. Das demnächst Gruppen von Jugendlichen von den “Lehrer[stimmloser glottaler Plosiv]innen” reden werden ist kein plausibles Szenario. Bei den “Lehrys” sieht das schon anders aus. Zumal es in der Schule meiner Kinder nicht unüblich ist, von Lehries und Schülies zu sprechen. Da ist der Schritt zu Lehrys und Schülys quasi nur noch eine Formalität.</p><h4>Vorteile des Entgenderns</h4><ul><li>Sie unterscheidet nicht mehr nach Geschlechtern und schließt somit alle Geschlechter ein.</li><li>Die grammatikalische Form ist denkbar einfach.</li><li>Sie ist sprechbar, auch unabhängig vom Bildungsstand.</li></ul><p>Beim Spaziergang mit einem befreundeten Entwickler sind wir schnell auf das Problem gestoßen, dass wir immer gegenseitig nachfragen mussten, ob wir mit Editor gerade den Menschen meinen, der einen fertigen Text für die Online-Veröffentlichung vorbereitet oder das Programm. Er kam gleich auf die Idee, der Mensch ist jetzt doch das Edity. Woran man einen weiteren Vorteil erkennen kann: Wir erhalten automatisch eine personenanzeigende Endung.</p><h3>Abschließende Gedanken</h3><p>Wir leben im 21. Jahrhundert. Im Zeitalter der Mars-Besiedlung, der Künstlichen Intelligenz und des Quantencomputers. Wir sollten doch so langsam in der Lage sein, unsere Sprache nicht nur als ein “idenditätsbildendes Kulturgut” zu betrachten, was es um jeden Preis zu erhalten gilt, sondern vor allem als Werkzeug für die Kommunikation und den gesellschaftlichen Diskurs. Und dieses Werkzeug lässt sich modernisieren.</p><p>Und wenn es Menschen gibt, die durch die aktuelle Sprache diskriminiert oder ausgeschlossen werden, so ist es doch wohl das Mindeste, dass wir nach Lösungen suchen, die das Problem beheben.</p><p>Darum finde ich das Entgendern nach Phettberg/Kronschläger eine gute Idee, aus den genannten Vorteilen. Natürlich klingt es am Anfang ungewohnt. Veränderungen sind in der Regel anfänglich ungewohnt. Aber zerstört wird die deutsche Sprache dadurch sicher nicht. Es ist ja nun nicht so, dass in jedem Text und in jedem Satz Wörter gegendert werden müssen. Auch den allmorgendlichen Goethe oder Schiller werden wir weiter im Original genießen dürfen. Es wird vermutlich auch weiterhin okay sein, wenn in Liebesromanen die Geschlechter der sich Liebenden genannt werden.</p><p><strong>Darum mein Vorschlag:</strong> Spaß dabei entwickeln, die Änderungen auszuprobieren, zu diskutieren, zu üben und unsere Sprache moderner und inklusiver zu machen.</p><p>Ich danke allen Unterstützys, die mich zur Umsetzung der Idee ermutigt und uns gut beraten haben.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec7c40f9e490" width="1" height="1" alt=""><hr><p><a href="https://blog.nullaufeins.org/ent-gendern-von-online-publikationen-ec7c40f9e490">(Ent-)Gendern von Online-Publikationen</a> was originally published in <a href="https://blog.nullaufeins.org/">nullaufeins e.V.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A SwiftUI Search Bar — Part 2]]></title>
            <link>https://soeren-kirchner.medium.com/a-swiftui-search-bar-part-2-78e33d17bcea?source=rss-c6f67150158f------2</link>
            <guid isPermaLink="false">https://medium.com/p/78e33d17bcea</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[searchbar]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Sören Kirchner]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 19:37:26 GMT</pubDate>
            <atom:updated>2021-02-07T19:37:26.494Z</atom:updated>
            <content:encoded><![CDATA[<h3>A SwiftUI Search Bar — Part 2</h3><h4>Write a SwiftUI search bar just in plain SwiftUI without wrapping UIKit components like UISearchBar.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MOXD5EZsbdpRLT6U" /><figcaption>Photo by <a href="https://unsplash.com/@chaseelliottclark?utm_source=medium&amp;utm_medium=referral">Chase Clark</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Previous Part:</strong> <a href="https://medium.com/@sk_29476/a-swiftui-search-bar-part-1-f21b0f2b41cb">A SwiftUI search bar — Part 1</a></p><p>Now let’s style the search bar and add some feature to it.</p><ul><li>a common search bar like look</li><li>an animated cancel-button</li><li>hidden on start and shown on wipe down</li></ul><p>The contact list of the Signal messenger app serves as a model.</p><h4>Create a SearchBar View</h4><p>First, let’s separate the Textfield into its own View called SearchBar. This is a bit more cleaner and we can style the search field and the list independently.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c206b313d70f6198b63742c18bd12d83/href">https://medium.com/media/c206b313d70f6198b63742c18bd12d83/href</a></iframe><p><strong>Note:</strong> onChange is now added to the new SearchBar. The value is propagated thru the @Binding.</p><h4>Style the Search Bar</h4><p>Let’s now style the search bar to a more common one. Therefore we put a magnifying glass Image left next to the Textfield by putting both into a HStack. And then we lay the HStack over a RoundedRectangle.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/357e13498f54b9587b17e2ef8b9487c4/href">https://medium.com/media/357e13498f54b9587b17e2ef8b9487c4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prkgErfdyqV85wESPEm6wg.jpeg" /></figure><p>Voila. It now looks like a common search bar. At the moment, the search bar is a little sticky to the borders, but we will solve it later.</p><h4>Add a Cancel Button</h4><p>Now we add a cancel button by wrapping it all up in another HStack. Then we put a Button right next to the just now styled TextField.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e207dd9973db6093b2ad6054fcc52ed6/href">https://medium.com/media/e207dd9973db6093b2ad6054fcc52ed6/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AbcOZA0d6kbjNLaIpBmfXg.jpeg" /></figure><h4>Intermezzo: Change List to ScrollView and LazyVStack</h4><p>Before we continue to style and implementing the search bar behavior we should consider changing List to ScrollView and LazyVStack. This comes with advantages and with disadvantages.</p><p><strong>The Disadvantages</strong>. We lose some List features like the default swipe to delete action and we have to implement this feature by ourselves if it’s needed.</p><p><strong>The Advantages</strong>. List is limited to some Styles you can choose. The default style comes with these separator lines and you cannot easily disable them (on iOS14). And this style highlights the cell if you click on a button inside. A LazyVStack does not have such limitations. You are free to style it for your needs.</p><p>Let’s replace the List with a ScrollView and a LazyVStack. Therefore we place the SearchBar and the Elements of our List using ForEach inside a LazyVStack. Then we wrap the LazyVStack with a ScrollView.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7345d78fef0f15b716ff1063205e5c6/href">https://medium.com/media/c7345d78fef0f15b716ff1063205e5c6/href</a></iframe><p><strong>Note:</strong> onAppear is now added to the LazyVStack!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qT6i6Y2X6S-bTKR57Vvy2g.jpeg" /></figure><p>Now the separator lines are gone and the search bar doesn’t stick to the borders anymore, because it’s now inside of the ScrollView and the ScrollView got padding.</p><h4>Show and Hide the Cancel-Button</h4><p>Like in the Signal messenger app, the search field is always visible on top of the list, but the cancel-button will only be shown if the user taps on the search field and will disappear if the user is done.</p><p>We add a new @State property showCancelButton to the SearchBar that will store if the cancel-button is visible or not.</p><p>We then wrap the Button in an if condition to show the Button if showCancelButton is true and hiding the Button otherwise.</p><p>And we have to set showCancelButton to true if the user taps on the search field using onTapGesture and turn it to false using the Buttons action parameter.</p><p>And of course, we have to empty the search field by setting text to an empty String. This will automatically call the FruitsController search method which then updates the publishedFruits to all fruits.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea579191821d52df51e3462c6479f001/href">https://medium.com/media/ea579191821d52df51e3462c6479f001/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*HfwUPveE4R9XigMBKuEeKw.gif" /></figure><p>There is a little problem left over. After clicking on the cancel-button, the search field is still focused and the keyboard doesn’t disappear. Unfortunately, there is no built-in SwiftUI method to hide the keyboard and to clear the focus. But there is a <a href="https://www.hackingwithswift.com/quick-start/swiftui/how-to-dismiss-the-keyboard-for-a-textfield">solution</a>. So let’s add the hideKeyboard method as an extension to the View class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d101beb1b3e26b212bec37d311ee69d5/href">https://medium.com/media/d101beb1b3e26b212bec37d311ee69d5/href</a></iframe><p>Now we can add the method to the action of the cancel-button in the SearchBar View.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf73b162057bbf1478475a0a083f5d8f/href">https://medium.com/media/bf73b162057bbf1478475a0a083f5d8f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*rSX8dMNefIuMjv5auvs6lw.gif" /></figure><p>As you see, now it works as it should.</p><h4>Add Animation</h4><p>To give the search bar a more sophisticated look and feel, let’s animate the appearance of the cancel-button a little. And this is (mainly) easy with SwiftUI. Every time we change the state of showCancelButton in our code we have to wrap it up inside a withAnimation block.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dfd94521a95fbeb5c6a42f16f454d47/href">https://medium.com/media/9dfd94521a95fbeb5c6a42f16f454d47/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8d4a9a82c12bf8167f09f11109a9f0e/href">https://medium.com/media/d8d4a9a82c12bf8167f09f11109a9f0e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*cGqNA_q3PQFDGiR-PxMCUw.gif" /></figure><p>It’s not bad, but if you take a closer look, it could be better. At the moment, if the button fades out it intersects with the moving bar.</p><h4>Add Transition</h4><p>To solve this, let’s add a transition to the Button. A transition to the right (trailing) edge.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c9eefe0a24a8e537cb239ad8a77b7c1/href">https://medium.com/media/0c9eefe0a24a8e537cb239ad8a77b7c1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*9lxZ9TSV1nLgnDcXROnWCg.gif" /></figure><p>It looks now as wanted.</p><h4>Hide the Search Bar on Long Lists</h4><p>And finally we want to hide the search bar on the appearance of the FruitsView if the list is longer than the screen like in the Signal messenger app.</p><p>To do this we simply try to scroll the list to the first element of our publishedFruits Array which is the second element of our List. (The first is the SearchBar)</p><p>Therefore let’s wrap the LazyVStack with a ScrollViewReader. Then we can scroll to the first element of our Array when the LazyVStack appears using the proxy of the ScrollViewReader.</p><p><strong>Important:</strong> Before this will take effect, we have to be sure, that the publishedFruits Array is long enough. So we need to add some more Fruits.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f0e1109cbc2535368e5b4a48585e348/href">https://medium.com/media/2f0e1109cbc2535368e5b4a48585e348/href</a></iframe><h4>The result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*q-voZ6USwtlc8WP6YxuEFQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*LKhdOLvIcD_8oTOcUd-MFg.gif" /></figure><p><strong>Source Code:</strong> <a href="https://github.com/soeren-kirchner/SearchBarSwiftUI-Part2">https://github.com/soeren-kirchner/SearchBarSwiftUI-Part2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78e33d17bcea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A SwiftUI Search Bar — Part 1]]></title>
            <link>https://soeren-kirchner.medium.com/a-swiftui-search-bar-part-1-f21b0f2b41cb?source=rss-c6f67150158f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f21b0f2b41cb</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[searchbar]]></category>
            <dc:creator><![CDATA[Sören Kirchner]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 19:37:15 GMT</pubDate>
            <atom:updated>2021-02-07T19:37:15.923Z</atom:updated>
            <content:encoded><![CDATA[<h3>A SwiftUI Search Bar — Part 1</h3><h4>Write a SwiftUI search bar just in plain SwiftUI without wrapping UIKit components like UISearchBar.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hQJxhT86HcaGbkje" /><figcaption>Photo by <a href="https://unsplash.com/@chaseelliottclark?utm_source=medium&amp;utm_medium=referral">Chase Clark</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article will show how to implement a search bar in SwiftUI.</p><p>This article has two parts.</p><ul><li><strong>Part 1</strong> (this part) shows how to create a search bar functionality without any styling.</li><li><strong>Part 2 </strong>applies a cancel button and some basic styling and animation to the search bar to look similar to that in the Signal messenger app.</li></ul><p><strong>Note:</strong> If you look for a solution to use the UISearchBar of the UIKit in SwiftUI, I recommend the articles from <a href="https://medium.com/@yugantarjain/implement-native-search-bar-in-swiftui-664a6b944538">Yugantar Jain</a> and <a href="https://axelhodler.medium.com/creating-a-search-bar-for-swiftui-e216fe8c8c7f">Axel Hodler</a>.</p><h4>Start with a Basic App Showing a List</h4><p>First, create a Project in Xcode. Select iOS and App and then select the following options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FmbtlV4ehYOF7m4vEmBDMw.jpeg" /></figure><p>Let’s now create a new Swift file named FruitsController.swift and add a Fruits struct and a FruitsController class that conforms to the ObservableObject Protocol. The FruitsController will work as the data provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b41bc250e83d88be2121776a88bfa8c/href">https://medium.com/media/6b41bc250e83d88be2121776a88bfa8c/href</a></iframe><p>And a FruitsView to the ContentView.swift that will observe the FruitsController and shows the publishedFruits published by it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/567d3a53773052d98fb126ff8d7e75ed/href">https://medium.com/media/567d3a53773052d98fb126ff8d7e75ed/href</a></iframe><p>And of course, we have to add the FruitsView to the ContentView to be shown.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08c083417d20ba54e6e633c2dc1a85c7/href">https://medium.com/media/08c083417d20ba54e6e633c2dc1a85c7/href</a></iframe><p>This short piece of code is a complete SwiftUI app showing our list of fruits. If you now run the app in the Simulator, this is what you get.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*0np3Y9PiStvL-nE25ANU5Q.jpeg" /></figure><h4>Add the Search Field</h4><p>Next, let us add a Textfield to the FruitsView as a search field on the top of our list. And wrap both within a VStack. And we need to add a @State property searchFieldValue in which the Textfield will store the user’s input into.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29de963728c1a73df6cf8daae37cc980/href">https://medium.com/media/29de963728c1a73df6cf8daae37cc980/href</a></iframe><h4>Prepare the FruitsController</h4><p>The approach is, to keep all the search logic inside the Controller. It provides the data as well as what data will be exposed. Therefore let’s add a property fruits containing all the original data and the publishedFruits property for the published data. That simply means that the result of a search on fruits will be stored in publishedFruits.</p><p>For the initialization of publishedFruits we simply write the class initializer init() and assign fruits to publishedFruits. Both should of course be the same before any search is done.</p><p>In addition, we need to add a search method, that filters all fruits containing the key and stores the result into publishedFruits.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e946757e077ee2f58c52100e0f5d797b/href">https://medium.com/media/e946757e077ee2f58c52100e0f5d797b/href</a></iframe><h4>Connect them</h4><p>In the last step, we have to call the search method if the user inputs a search term.</p><p>For the search, we implement the action of the onChange method of the TextField and call the search method of the FruitsController with the entered search term.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1bfc8ea694bd60b52123e367439a42f0/href">https://medium.com/media/1bfc8ea694bd60b52123e367439a42f0/href</a></iframe><h4>That’s all</h4><p>This is a small pure SwiftUI search bar app. No storyboard, no outlets, no UIViewControllerRepresentable, etc. Just a few lines of code, that shows the power of SwiftUI. But there is more</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DGAvFR11qSMVzgvenAKLPg.gif" /></figure><p><a href="https://medium.com/@sk_29476/a-swiftui-search-bar-part-2-78e33d17bcea">Part 2</a> will show how to add a little more styling, for a more real world application.</p><p><strong>Next Part:</strong> <a href="https://medium.com/@sk_29476/a-swiftui-search-bar-part-2-78e33d17bcea">A SwiftUI search bar — Part 2</a></p><p><strong>Source Code:</strong> <a href="https://github.com/soeren-kirchner/SearchBarSwiftUI-Part1">https://github.com/soeren-kirchner/SearchBarSwiftUI-Part1</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f21b0f2b41cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>