<?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 Zekibiyikli on Medium]]></title>
        <description><![CDATA[Stories by Zekibiyikli on Medium]]></description>
        <link>https://medium.com/@zbiyikli1?source=rss-2a49201a428e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*y5GwcfI1zBTtJAgw</url>
            <title>Stories by Zekibiyikli on Medium</title>
            <link>https://medium.com/@zbiyikli1?source=rss-2a49201a428e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:34:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zbiyikli1/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[Mobile Terse | Flutter Widgets (English)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-flutter-widgets-english-f2c2a4be3710?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c2a4be3710</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 11:01:21 GMT</pubDate>
            <atom:updated>2026-07-29T11:01:21.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3Z9Kbd_jj_EvRqROdlCWw.png" /></figure><p>“This is a roadmap — you need to dive deep into each topic on your own”</p><h3>1. The Three Trees: Widget, Element, RenderObject</h3><ul><li><strong>Widget Tree</strong>: the immutable “configuration” tree, recreated on every build</li><li><strong>Element Tree</strong>: the tree holding widget lifecycles and their position, persisting across builds</li><li><strong>RenderObject Tree</strong>: the low-level tree performing actual layout, painting, and hit-testing</li></ul><pre>// A new Widget is created on every build call, but the Element and RenderObject persist<br>class Greeting extends StatelessWidget {  <br>  final String name;  <br>  const Greeting({super.key, required this.name});</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return Text(&#39;Hello, $name!&#39;);   // the Text widget is also part of these three trees  <br>  }  <br>}</pre><h3>2. StatelessWidget vs StatefulWidget in Depth</h3><ul><li><strong>StatelessWidget</strong>: a widget with no internal state, producing UI solely from its parameters</li><li><strong>StatefulWidget</strong>: a widget that creates a separate State object via createState(), letting that object survive across builds</li><li><strong>Widget vs State Distinction</strong>: the Widget is recreated on every build, while the State object stays the same</li></ul><pre>class Counter extends StatefulWidget {  <br>  const Counter({super.key});</pre><pre>  @override  <br>  State&lt;Counter&gt; createState() =&gt; _CounterState();   // State lives separately from the widget  <br>}</pre><pre>class _CounterState extends State&lt;Counter&gt; {  <br>  int _count = 0;                                     // preserved even when the widget rebuilds</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return ElevatedButton(  <br>      onPressed: () =&gt; setState(() =&gt; _count++),  <br>      child: Text(&#39;Clicks: $_count&#39;),  <br>    );  <br>  }  <br>}</pre><h3>3. BuildContext</h3><ul><li><strong>BuildContext</strong>: a reference representing a widget’s position in the Element tree, granting access to theme/navigation/inherited widgets</li><li><strong>The context.of() Pattern</strong>: a common API pattern like Theme.of(context), Navigator.of(context) that searches upward in the tree for the nearest ancestor</li></ul><pre>Widget build(BuildContext context) {  <br>  final theme = Theme.of(context);              // searches the tree for the nearest Theme widget  <br>  final width = MediaQuery.of(context).size.width;</pre><pre>  return Container(  <br>    color: theme.colorScheme.primary,  <br>    width: width * 0.8,  <br>  );  <br>}</pre><h3>4. State Management: setState</h3><ul><li><strong>setState</strong>: the call telling the framework “this State’s data has changed, rebuild the related widget”</li><li><strong>Synchronous Execution</strong>: the code inside setState must run synchronously; async work happens outside of it</li></ul><pre>class DataScreen extends StatefulWidget {  <br>  const DataScreen({super.key});  <br>  @override  <br>  State&lt;DataScreen&gt; createState() =&gt; _DataScreenState();  <br>}</pre><pre>class _DataScreenState extends State&lt;DataScreen&gt; {  <br>  String? _data;</pre><pre>  Future&lt;void&gt; _fetchData() async {  <br>    final result = await api.fetch();            // the async part happens outside setState  <br>    setState(() =&gt; _data = result);              // only the state assignment goes inside setState  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) =&gt; Text(_data ?? &#39;Loading...&#39;);  <br>}</pre><h3>5. State Hoisting with InheritedWidget</h3><ul><li><strong>InheritedWidget</strong>: the core mechanism for propagating a value down the widget tree without passing it as a parameter</li><li><strong>Foundation of Provider</strong>: the structure underlying popular state management libraries like Provider and Riverpod</li></ul><pre>class ThemeProvider extends InheritedWidget {  <br>  final bool isDark;  <br>  const ThemeProvider({super.key, required this.isDark, required super.child});</pre><pre>  static ThemeProvider of(BuildContext context) {  <br>    return context.dependOnInheritedWidgetOfExactType&lt;ThemeProvider&gt;()!;   // finds the nearest ancestor  <br>  }</pre><pre>  @override  <br>  bool updateShouldNotify(ThemeProvider old) =&gt; isDark != old.isDark;  <br>}</pre><pre>// Usage: ThemeProvider.of(context).isDark</pre><h3>6. Widget Rebuild &amp; Performance</h3><ul><li><strong>const Constructor</strong>: marking unchanging widgets as const so Flutter can skip recreating them entirely</li><li><strong>Splitting the Widget Tree</strong>: breaking up a large build() method into smaller widgets to narrow the rebuild scope</li></ul><pre>// Bad: the entire build() runs on every setState<br>Widget build(BuildContext context) {  <br>  return Column(children: [  <br>    Text(&#39;Static title&#39;),         // recreated unnecessarily because it&#39;s not const  <br>    Text(&#39;$_counter&#39;),  <br>  ]);  <br>}</pre><pre>// Good: the unchanging part is const, only the changing widget is recreated<br>Widget build(BuildContext context) {  <br>  return Column(children: [  <br>    const Text(&#39;Static title&#39;),   // const: fully exempt from rebuild  <br>    Text(&#39;$_counter&#39;),  <br>  ]);  <br>}</pre><h3>7. Keys: ValueKey, ObjectKey, GlobalKey</h3><ul><li><strong>Key</strong>: the identity Flutter uses to match widgets between the old and new tree</li><li><strong>ValueKey/ObjectKey</strong>: used to correctly match widgets whose order may change, like list items</li><li><strong>GlobalKey</strong>: the most powerful but most expensive key type, granting access to a widget’s State or position from elsewhere in the tree</li></ul><pre>ListView(  <br>  children: tasks.map((task) =&gt; TaskCard(  <br>    key: ValueKey(task.id),          // state matches correctly even if the list is reordered  <br>    task: task,  <br>  )).toList(),  <br>)</pre><pre>final formKey = GlobalKey&lt;FormState&gt;();<br>Form(key: formKey, child: ...);<br>formKey.currentState?.validate();      // accessing State from elsewhere in the tree</pre><h3>8. Layout Widgets: Expanded, Flexible, Stack</h3><ul><li><strong>Expanded</strong>: filling the remaining space inside a Row/Column</li><li><strong>Flexible</strong>: flexible sizing that, unlike Expanded, can also preserve the content’s natural size</li><li><strong>Stack + Positioned</strong>: freely stacking and positioning widgets on top of each other</li></ul><pre>Row(  <br>  children: [  <br>    Expanded(flex: 2, child: Container(color: Colors.blue)),   // 2/3 of the remaining space  <br>    Expanded(flex: 1, child: Container(color: Colors.red)),    // 1/3 of the remaining space  <br>  ],  <br>)</pre><pre>Stack(  <br>  children: [  <br>    Image.network(url),  <br>    Positioned(bottom: 8, right: 8, child: Icon(Icons.favorite)),  <br>  ],  <br>)</pre><h3>9. Slivers &amp; CustomScrollView</h3><ul><li><strong>Sliver</strong>: a low-level layout protocol breaking scroll behavior into customizable pieces</li><li><strong>CustomScrollView</strong>: combining multiple slivers (SliverAppBar, SliverList, SliverGrid) into a single scrollable area</li><li><strong>SliverAppBar</strong>: collapsible app bar behavior that shrinks/expands as you scroll</li></ul><pre>CustomScrollView(  <br>  slivers: [  <br>    SliverAppBar(  <br>      expandedHeight: 200,  <br>      flexibleSpace: FlexibleSpaceBar(title: Text(&#39;Title&#39;)),  <br>      pinned: true,  <br>    ),  <br>    SliverList(  <br>      delegate: SliverChildBuilderDelegate(  <br>        (context, index) =&gt; ListTile(title: Text(&#39;Row $index&#39;)),  <br>        childCount: 50,  <br>      ),  <br>    ),  <br>  ],  <br>)</pre><h3>10. Theming: Theme &amp; ThemeData</h3><ul><li><strong>ThemeData</strong>: the central configuration propagating color, typography, and component styles across the app</li><li><strong>Theme.of(context)</strong>: accessing the nearest Theme widget’s data</li><li><strong>ThemeExtension</strong>: an extension point for adding app-specific theme values not covered by Material</li></ul><pre>MaterialApp(  <br>  theme: ThemeData(  <br>    colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),  <br>    useMaterial3: true,  <br>  ),  <br>  darkTheme: ThemeData.dark(useMaterial3: true),  <br>  themeMode: ThemeMode.system,  <br>)</pre><pre>// Usage<br>Container(color: Theme.of(context).colorScheme.primary)</pre><h3>11. Custom RenderObject</h3><ul><li><strong>RenderObject</strong>: the object underlying a widget that performs actual measurement (layout) and painting</li><li><strong>performLayout/paint</strong>: the methods a RenderObject must override, containing the sizing and drawing logic</li><li><strong>When It’s Needed</strong>: for entirely custom layout/drawing behavior that can’t be expressed with existing widgets</li></ul><pre>class CustomRenderBox extends RenderBox {  <br>  @override  <br>  void performLayout() {  <br>    size = constraints.constrain(const Size(100, 100));  <br>  }</pre><pre>  @override  <br>  void paint(PaintingContext context, Offset offset) {  <br>    context.canvas.drawRect(  <br>      offset &amp; size,  <br>      Paint()..color = Colors.blue,  <br>    );  <br>  }  <br>}</pre><h3>12. Animation: AnimationController &amp; Tween</h3><ul><li><strong>AnimationController</strong>: the core class managing an animation’s duration, progress, and direction</li><li><strong>Tween</strong>: a structure defining interpolation between start and end values</li><li><strong>AnimatedBuilder</strong>: an optimizing widget that only redraws the relevant subtree when an animation value changes</li></ul><pre>class ExpandableBox extends StatefulWidget {  <br>  const ExpandableBox({super.key});  <br>  @override  <br>  State&lt;ExpandableBox&gt; createState() =&gt; _ExpandableBoxState();  <br>}</pre><pre>class _ExpandableBoxState extends State&lt;ExpandableBox&gt;  <br>    with SingleTickerProviderStateMixin {  <br>  late final AnimationController _controller = AnimationController(  <br>    duration: const Duration(milliseconds: 300), vsync: this,  <br>  );  <br>  late final Animation&lt;double&gt; _size = Tween(begin: 80.0, end: 200.0)  <br>    .animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut));</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return AnimatedBuilder(  <br>      animation: _size,  <br>      builder: (context, child) =&gt; Container(width: _size.value, height: _size.value),  <br>    );  <br>  }  <br>}</pre><h3>13. Implicit Animations</h3><ul><li><strong>AnimatedContainer/AnimatedOpacity</strong>: automatic animation without writing an AnimationController, just by changing the target value</li><li><strong>Use Case</strong>: avoiding all the boilerplate of an AnimationController for simple, one-directional transitions</li></ul><pre>class SimpleTransition extends StatefulWidget {  <br>  const SimpleTransition({super.key});  <br>  @override  <br>  State&lt;SimpleTransition&gt; createState() =&gt; _SimpleTransitionState();  <br>}</pre><pre>class _SimpleTransitionState extends State&lt;SimpleTransition&gt; {  <br>  bool _wide = false;</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return GestureDetector(  <br>      onTap: () =&gt; setState(() =&gt; _wide = !_wide),  <br>      child: AnimatedContainer(  <br>        duration: const Duration(milliseconds: 200),  <br>        width: _wide ? 300 : 100,             // only the target changes, animation is automatic  <br>      ),  <br>    );  <br>  }  <br>}</pre><h3>14. Gesture Handling</h3><ul><li><strong>GestureDetector</strong>: a widget capturing high-level touch events like taps, drags, and pinches</li><li><strong>Listener</strong>: lower-level access to raw pointer events (down/move/up)</li><li><strong>Gesture Arena</strong>: Flutter’s mechanism for deciding which gesture detector “wins” when multiple detectors conflict</li></ul><pre>GestureDetector(  <br>  onTap: () =&gt; print(&#39;Tapped&#39;),  <br>  onPanUpdate: (details) =&gt; setState(() =&gt; _offset += details.delta),  <br>  onScaleUpdate: (details) =&gt; setState(() =&gt; _scale = details.scale),  <br>  child: Container(color: Colors.blue, width: 100, height: 100),  <br>)</pre><h3>15. CustomPaint &amp; Canvas</h3><ul><li><strong>CustomPaint</strong>: a widget using a CustomPainter to draw directly</li><li><strong>shouldRepaint</strong>: controlling when the painter should redraw, avoiding unnecessary painting</li></ul><pre>class ChartPainter extends CustomPainter {  <br>  final double percentage;  <br>  ChartPainter(this.percentage);</pre><pre>  @override  <br>  void paint(Canvas canvas, Size size) {  <br>    final paint = Paint()  <br>      ..color = Colors.blue  <br>      ..style = PaintingStyle.stroke  <br>      ..strokeWidth = 8;  <br>    canvas.drawArc(  <br>      Offset.zero &amp; size, -90 * (3.14159 / 180), 2 * 3.14159 * percentage, false, paint,  <br>    );  <br>  }</pre><pre>  @override  <br>  bool shouldRepaint(ChartPainter old) =&gt; old.percentage != percentage;  <br>}</pre><h3>16. Builder Pattern: LayoutBuilder, ValueListenableBuilder</h3><ul><li><strong>LayoutBuilder</strong>: building different widgets based on the constraints (BoxConstraints) given by the parent widget</li><li><strong>ValueListenableBuilder</strong>: listening to a ValueNotifier and only redrawing the relevant part when it changes</li><li><strong>The Builder Pattern</strong>: broadly, a functional widget approach used to provide a new BuildContext or react to specific data</li></ul><pre>LayoutBuilder(  <br>  builder: (context, constraints) {  <br>    if (constraints.maxWidth &gt; 600) return WideScreenLayout();  <br>    return NarrowScreenLayout();  <br>  },  <br>)</pre><pre>final counter = ValueNotifier&lt;int&gt;(0);</pre><pre>ValueListenableBuilder&lt;int&gt;(  <br>  valueListenable: counter,  <br>  builder: (context, value, child) =&gt; Text(&#39;$value&#39;),   // redraws only when counter changes  <br>)</pre><h3>17. Widget Lifecycle in Depth</h3><ul><li><strong>initState</strong>: called once when the State object is created; context isn&#39;t fully ready yet</li><li><strong>didChangeDependencies</strong>: called right after initState, and whenever a dependent InheritedWidget changes</li><li><strong>didUpdateWidget</strong>: called when the parent rebuilds and reuses the same State with a different widget configuration</li><li><strong>deactivate/dispose</strong>: called when the widget is removed from the tree (deactivate) and permanently destroyed (dispose)</li></ul><pre>class Example extends StatefulWidget {  <br>  final String id;  <br>  const Example({super.key, required this.id});  <br>  @override  <br>  State&lt;Example&gt; createState() =&gt; _ExampleState();  <br>}</pre><pre>class _ExampleState extends State&lt;Example&gt; {  <br>  @override  <br>  void initState() {  <br>    super.initState();  <br>    print(&#39;Created&#39;);  <br>  }</pre><pre>  @override  <br>  void didUpdateWidget(Example old) {  <br>    super.didUpdateWidget(old);  <br>    if (old.id != widget.id) print(&#39;id changed: ${old.id} -&gt; ${widget.id}&#39;);  <br>  }</pre><pre>  @override  <br>  void dispose() {  <br>    print(&#39;Cleaning up&#39;);  <br>    super.dispose();  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) =&gt; Text(widget.id);  <br>}</pre><h3>18. Testing: WidgetTester</h3><ul><li><strong>testWidgets</strong>: the test function for widget tests, running on a virtual binding</li><li><strong>pumpWidget/pump</strong>: “mounting” a widget in the test environment and advancing frames</li><li><strong>find</strong>: locating a specific widget in the tree by text, type, or key</li></ul><pre>testWidgets(&#39;counter increments on tap&#39;, (tester) async {  <br>  await tester.pumpWidget(const MaterialApp(home: Counter()));</pre><pre>  expect(find.text(&#39;Clicks: 0&#39;), findsOneWidget);</pre><pre>  await tester.tap(find.byType(ElevatedButton));  <br>  await tester.pump();                              // process the new frame</pre><pre>  expect(find.text(&#39;Clicks: 1&#39;), findsOneWidget);  <br>});</pre><h3>19. Performance: RepaintBoundary</h3><ul><li><strong>RepaintBoundary</strong>: isolating a subtree’s painting so that changes within it don’t force parent/sibling widgets to repaint</li><li><strong>When to Use It</strong>: protecting static content around a frequently changing animated widget from being repainted</li></ul><pre>Column(  <br>  children: [  <br>    const StaticHeader(),                  // content that rarely changes  <br>    RepaintBoundary(                        // the animation is isolated here  <br>      child: SpinningIcon(),  <br>    ),  <br>  ],  <br>)</pre><h3>20. Overlay &amp; Portal Patterns</h3><ul><li><strong>Overlay</strong>: a layer for widgets shown on top, outside the widget tree’s normal flow</li><li><strong>OverlayEntry</strong>: a single, manually managed entry added to an Overlay</li><li><strong>Use Cases</strong>: UI like tooltips, dropdown menus, and snackbars that need to be triggered from anywhere in the tree and shown on top</li></ul><pre>void showTooltip(BuildContext context) {  <br>  final overlay = Overlay.of(context);  <br>  late OverlayEntry entry;  <br>  entry = OverlayEntry(  <br>    builder: (context) =&gt; Positioned(  <br>      top: 100, left: 50,  <br>      child: Material(child: Text(&#39;Tooltip text&#39;)),  <br>    ),  <br>  );  <br>  overlay.insert(entry);  <br>  Future.delayed(const Duration(seconds: 2), () =&gt; entry.remove());  <br>}</pre><h3>21. Focus &amp; Keyboard Handling</h3><ul><li><strong>FocusNode</strong>: programmatically controlling a widget’s keyboard/input focus</li><li><strong>FocusScope</strong>: grouping and managing focus behavior within a subtree</li><li><strong>Shortcuts/Actions</strong>: binding keyboard shortcuts to the widget tree declaratively</li></ul><pre>class FormField extends StatefulWidget {  <br>  const FormField({super.key});  <br>  @override  <br>  State&lt;FormField&gt; createState() =&gt; _FormFieldState();  <br>}</pre><pre>class _FormFieldState extends State&lt;FormField&gt; {  <br>  final _focusNode = FocusNode();</pre><pre>  @override  <br>  void dispose() {  <br>    _focusNode.dispose();  <br>    super.dispose();  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return TextField(focusNode: _focusNode);  <br>  }  <br>}</pre><h3>22. Accessibility: The Semantics Widget</h3><ul><li><strong>Semantics</strong>: a widget adding meaning and description for screen readers</li><li><strong>excludeSemantics</strong>: ignoring child widgets’ own semantic info in favor of the description above</li><li><strong>MergeSemantics</strong>: combining multiple child widgets into a single accessibility unit</li></ul><pre>Semantics(  <br>  label: &#39;Add to favorites&#39;,  <br>  button: true,  <br>  child: ExcludeSemantics(  <br>    child: Icon(Icons.favorite_border),   // the icon&#39;s own semantics are hidden, replaced by the one above  <br>  ),  <br>)</pre><h3>23. Platform View Interop</h3><ul><li><strong>AndroidView / UiKitView</strong>: embedding native Android/iOS views into the Flutter widget tree</li><li><strong>PlatformViewLink</strong>: a more performant, hybrid-composition-based platform view integration</li><li><strong>Use Cases</strong>: map SDKs, native video players, and other components with no Flutter-native equivalent</li></ul><pre>Widget build(BuildContext context) {  <br>  if (Platform.isAndroid) {  <br>    return const AndroidView(viewType: &#39;map_view&#39;);  <br>  } else if (Platform.isIOS) {  <br>    return const UiKitView(viewType: &#39;map_view&#39;);  <br>  }  <br>  return const Placeholder();  <br>}</pre><h3>24. Inspecting Widgets with DevTools</h3><ul><li><strong>Widget Inspector</strong>: a DevTools tool that live-visualizes the widget tree and detects layout issues</li><li><strong>Rebuild Counters</strong>: a performance view showing which widgets rebuild and how often</li><li><strong>debugPrintRebuildDirtyWidgets</strong>: a debug flag printing which widgets are marked “dirty” to the console</li></ul><pre>void main() {  <br>  debugPrintRebuildDirtyWidgets = true;   // shows which widgets rebuild in the console  <br>  runApp(const App());  <br>}</pre><h3>25. Other Things You Should Know in Production</h3><ul><li><strong>Widget vs Element Confusion</strong>: remembering that context.widget and the State accessed via context have different lifetimes</li><li><strong>Not Using BuildContext After Async Gaps</strong>: the requirement to check mounted before using context after an await</li><li><strong>Deferred Components</strong>: downloading some features on demand to reduce app size</li><li><strong>Impeller Rendering</strong>: the impact of Flutter’s new rendering engine on widget performance</li></ul><pre>Future&lt;void&gt; loadData() async {  <br>  final result = await api.fetch();  <br>  if (!mounted) return;               // don&#39;t call setState if the widget has been removed from the tree  <br>  setState(() =&gt; _data = result);  <br>}</pre><h3>Glossary of Terms</h3><h3>Core Concepts</h3><ul><li><strong>Widget Tree/Element Tree/RenderObject Tree</strong>: Flutter’s three-layer tree structure representing the UI.</li><li><strong>BuildContext</strong>: a reference representing a widget’s position in the Element tree.</li><li><strong>Key</strong>: the identity used to match widgets between the old and new tree.</li><li><strong>RenderObject</strong>: the low-level object performing actual layout and painting.</li></ul><h3>State Management</h3><ul><li><strong>setState</strong>: the call notifying the framework of a state change and triggering a rebuild.</li><li><strong>InheritedWidget</strong>: the core mechanism sharing a value across the tree without passing it as a parameter.</li><li><strong>ValueNotifier</strong>: a simple observable type notifying listeners when its value changes.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>Sliver</strong>: a low-level protocol breaking scroll behavior into customizable pieces.</li><li><strong>Expanded/Flexible</strong>: layout widgets distributing remaining space inside a Row/Column.</li><li><strong>CustomPaint</strong>: a widget enabling direct drawing on a Canvas.</li></ul><h3>Animation</h3><ul><li><strong>AnimationController</strong>: the core class managing an animation’s duration and progress.</li><li><strong>Tween</strong>: a structure defining interpolation between start and end values.</li><li><strong>AnimatedBuilder</strong>: a widget that only redraws the relevant tree when an animation value changes.</li></ul><h3>Performance</h3><ul><li><strong>const Constructor</strong>: an optimization exempting a widget from rebuild.</li><li><strong>RepaintBoundary</strong>: a widget isolating a subtree’s painting.</li><li><strong>Widget Inspector</strong>: the DevTools tool for live-inspecting the widget tree.</li></ul><h3>Resources</h3><h3>Core Concepts</h3><ul><li><strong>Flutter Official Documentation</strong> =&gt; <a href="https://docs.flutter.dev/">https://docs.flutter.dev/</a></li><li><strong>Widgets Introduction</strong> =&gt; <a href="https://docs.flutter.dev/ui/widgets-intro">https://docs.flutter.dev/ui/widgets-intro</a></li><li><strong>Understanding Constraints</strong> =&gt; <a href="https://docs.flutter.dev/ui/layout/constraints">https://docs.flutter.dev/ui/layout/constraints</a></li></ul><h3>State Management</h3><ul><li><strong>State Management</strong> =&gt; <a href="https://docs.flutter.dev/data-and-backend/state-mgmt/intro">https://docs.flutter.dev/data-and-backend/state-mgmt/intro</a></li><li><strong>InheritedWidget</strong> =&gt; <a href="https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html">https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html</a></li></ul><h3>Animation</h3><ul><li><strong>Animations Overview</strong> =&gt; <a href="https://docs.flutter.dev/ui/animations">https://docs.flutter.dev/ui/animations</a></li><li><strong>Implicit Animations</strong> =&gt; <a href="https://docs.flutter.dev/ui/animations/implicit-animations">https://docs.flutter.dev/ui/animations/implicit-animations</a></li></ul><h3>Performance</h3><ul><li><strong>Performance Best Practices</strong> =&gt; <a href="https://docs.flutter.dev/perf/best-practices">https://docs.flutter.dev/perf/best-practices</a></li><li><strong>Flutter DevTools</strong> =&gt; <a href="https://docs.flutter.dev/tools/devtools">https://docs.flutter.dev/tools/devtools</a></li></ul><h3>Testing</h3><ul><li><strong>Widget Testing</strong> =&gt; <a href="https://docs.flutter.dev/testing/overview">https://docs.flutter.dev/testing/overview</a></li></ul><h3>Slivers &amp; Layout</h3><ul><li><strong>Slivers</strong> =&gt; <a href="https://docs.flutter.dev/ui/advanced/slivers">https://docs.flutter.dev/ui/advanced/slivers</a></li></ul><h3>Platform Interop</h3><ul><li><strong>Platform Views</strong> =&gt; <a href="https://docs.flutter.dev/platform-integration/android/platform-views">https://docs.flutter.dev/platform-integration/android/platform-views</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c2a4be3710" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Flutter Widgets (Türkçe)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-flutter-widgets-t%C3%BCrk%C3%A7e-9b8062d214fd?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b8062d214fd</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 11:01:15 GMT</pubDate>
            <atom:updated>2026-07-29T11:01:15.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hth8bESykSTZ4LCg3VSNg.png" /></figure><p>“Bu bir yol haritasıdır, her başlığı ayrı ayrı derinlemesine çalışman gerekir”</p><h3>1. Üç Ağaç: Widget, Element, RenderObject</h3><ul><li><strong>Widget Tree</strong>: UI’ın değişmez (immutable), her build’de yeniden oluşturulan “yapılandırma” ağacı</li><li><strong>Element Tree</strong>: Widget’ların yaşam döngüsünü ve ağaçtaki konumunu tutan, build’ler arasında kalıcı olan ağaç</li><li><strong>RenderObject Tree</strong>: Gerçek layout, boyama (painting) ve hit-test işlemlerini yapan alt seviye ağaç</li></ul><pre>// Her build çağrısında yeni bir Widget oluşur, ama Element ve RenderObject korunur<br>class Selamla extends StatelessWidget {  <br>  final String isim;  <br>  const Selamla({super.key, required this.isim});</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return Text(&#39;Merhaba, $isim!&#39;);   // Text widget&#39;ı da bu üç ağacın bir parçası olur  <br>  }  <br>}</pre><h3>2. StatelessWidget vs StatefulWidget Derinlemesine</h3><ul><li><strong>StatelessWidget</strong>: Kendi state’i olmayan, sadece parametrelerine göre UI üreten widget</li><li><strong>StatefulWidget</strong>: createState() ile ayrı bir State nesnesi yaratan, bu nesnenin build&#39;ler arasında yaşamasını sağlayan widget</li><li><strong>Widget vs State Ayrımı</strong>: Widget her build’de yeniden oluşurken, State nesnesinin aynı kalması</li></ul><pre>class Sayac extends StatefulWidget {  <br>  const Sayac({super.key});</pre><pre>  @override  <br>  State&lt;Sayac&gt; createState() =&gt; _SayacState();   // State, widget&#39;tan ayrı yaşar  <br>}</pre><pre>class _SayacState extends State&lt;Sayac&gt; {  <br>  int _sayi = 0;                                  // bu değer widget yeniden build edilse de korunur</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return ElevatedButton(  <br>      onPressed: () =&gt; setState(() =&gt; _sayi++),  <br>      child: Text(&#39;Tıklama: $_sayi&#39;),  <br>    );  <br>  }  <br>}</pre><h3>3. BuildContext</h3><ul><li><strong>BuildContext</strong>: Bir widget’ın Element ağacındaki konumunu temsil eden, tema/navigation/inherited widget erişimi sağlayan referans</li><li><strong>context.of() Deseni</strong>: Theme.of(context), Navigator.of(context) gibi, en yakın atayı ağaçta yukarı doğru arayan yaygın API deseni</li></ul><pre>Widget build(BuildContext context) {  <br>  final tema = Theme.of(context);              // en yakın Theme widget&#39;ını ağaçta arar  <br>  final genislik = MediaQuery.of(context).size.width;</pre><pre>  return Container(  <br>    color: tema.colorScheme.primary,  <br>    width: genislik * 0.8,  <br>  );  <br>}</pre><h3>4. State Yönetimi: setState</h3><ul><li><strong>setState</strong>: Framework’e “bu State’in verisi değişti, ilgili widget’ı yeniden build et” diyen çağrı</li><li><strong>Senkron Çalışma</strong>: setState içindeki kodun senkron çalışması gerekliliği, asenkron işlemler setState dışında yapılır</li></ul><pre>class VeriEkrani extends StatefulWidget {  <br>  const VeriEkrani({super.key});  <br>  @override  <br>  State&lt;VeriEkrani&gt; createState() =&gt; _VeriEkraniState();  <br>}</pre><pre>class _VeriEkraniState extends State&lt;VeriEkrani&gt; {  <br>  String? _veri;</pre><pre>  Future&lt;void&gt; _veriGetir() async {  <br>    final sonuc = await api.getir();            // asenkron kısım setState dışında  <br>    setState(() =&gt; _veri = sonuc);              // sadece state ataması setState içinde  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) =&gt; Text(_veri ?? &#39;Yükleniyor...&#39;);  <br>}</pre><h3>5. InheritedWidget ile State Hoisting</h3><ul><li><strong>InheritedWidget</strong>: Bir değeri widget ağacında parametre geçmeden alt widget’lara yayan temel mekanizma</li><li><strong>Provider’ın Temeli</strong>: Provider, Riverpod gibi popüler state management kütüphanelerinin altında yatan yapı</li></ul><pre>class TemaSaglayici extends InheritedWidget {  <br>  final bool koyuTema;  <br>  const TemaSaglayici({super.key, required this.koyuTema, required super.child});</pre><pre>  static TemaSaglayici of(BuildContext context) {  <br>    return context.dependOnInheritedWidgetOfExactType&lt;TemaSaglayici&gt;()!;   // en yakın atayı bulur  <br>  }</pre><pre>  @override  <br>  bool updateShouldNotify(TemaSaglayici eski) =&gt; koyuTema != eski.koyuTema;  <br>}</pre><pre>// Kullanım: TemaSaglayici.of(context).koyuTema</pre><h3>6. Widget Rebuild ve Performans</h3><ul><li><strong>const Constructor</strong>: Değişmeyen widget’ları const işaretleyerek Flutter&#39;ın onları yeniden oluşturmayı tamamen atlamasını sağlama</li><li><strong>Widget Ağacını Bölmek</strong>: Büyük bir build() metodunu küçük widget&#39;lara ayırarak rebuild kapsamını daraltma</li></ul><pre>// Kötü: tüm build() her setState&#39;te çalışır<br>Widget build(BuildContext context) {  <br>  return Column(children: [  <br>    Text(&#39;Statik başlık&#39;),        // const olmadığı için gereksiz yeniden oluşur  <br>    Text(&#39;$_sayac&#39;),  <br>  ]);  <br>}</pre><pre>// İyi: değişmeyen kısım const, sadece değişen widget yeniden oluşur<br>Widget build(BuildContext context) {  <br>  return Column(children: [  <br>    const Text(&#39;Statik başlık&#39;),  // const: rebuild&#39;den tamamen muaf  <br>    Text(&#39;$_sayac&#39;),  <br>  ]);  <br>}</pre><h3>7. Keys: ValueKey, ObjectKey, GlobalKey</h3><ul><li><strong>Key</strong>: Flutter’ın widget’ları eski/yeni ağaç arasında eşleştirirken kullandığı kimlik</li><li><strong>ValueKey/ObjectKey</strong>: Liste elemanları gibi, sırası değişebilen widget’ları doğru eşleştirmek için kullanılır</li><li><strong>GlobalKey</strong>: Widget’ın State’ine veya konumuna ağacın başka bir yerinden erişim sağlayan, en güçlü ama en maliyetli key türü</li></ul><pre>ListView(  <br>  children: gorevler.map((gorev) =&gt; GorevKarti(  <br>    key: ValueKey(gorev.id),          // liste yeniden sıralansa bile doğru state eşleşir  <br>    gorev: gorev,  <br>  )).toList(),  <br>)</pre><pre>final formKey = GlobalKey&lt;FormState&gt;();<br>Form(key: formKey, child: ...);<br>formKey.currentState?.validate();      // ağacın başka bir yerinden State&#39;e erişim</pre><h3>8. Layout Widgets: Expanded, Flexible, Stack</h3><ul><li><strong>Expanded</strong>: Bir Row/Column içinde kalan boşluğu doldurma</li><li><strong>Flexible</strong>: Expanded’ın aksine, içeriğin doğal boyutunu da koruyabilen esnek boyutlandırma</li><li><strong>Stack + Positioned</strong>: Widget’ları serbestçe üst üste ve konumlandırarak yerleştirme</li></ul><pre>Row(  <br>  children: [  <br>    Expanded(flex: 2, child: Container(color: Colors.blue)),   // kalan alanın 2/3&#39;ü  <br>    Expanded(flex: 1, child: Container(color: Colors.red)),    // kalan alanın 1/3&#39;ü  <br>  ],  <br>)</pre><pre>Stack(  <br>  children: [  <br>    Image.network(url),  <br>    Positioned(bottom: 8, right: 8, child: Icon(Icons.favorite)),  <br>  ],  <br>)</pre><h3>9. Slivers ve CustomScrollView</h3><ul><li><strong>Sliver</strong>: Kaydırma davranışını özelleştirilebilir parçalara bölen düşük seviyeli layout protokolü</li><li><strong>CustomScrollView</strong>: Birden fazla sliver’ı (SliverAppBar, SliverList, SliverGrid) tek bir kaydırma alanında birleştirme</li><li><strong>SliverAppBar</strong>: Kaydırıldıkça küçülen/genişleyen, collapsible app bar davranışı</li></ul><pre>CustomScrollView(  <br>  slivers: [  <br>    SliverAppBar(  <br>      expandedHeight: 200,  <br>      flexibleSpace: FlexibleSpaceBar(title: Text(&#39;Başlık&#39;)),  <br>      pinned: true,  <br>    ),  <br>    SliverList(  <br>      delegate: SliverChildBuilderDelegate(  <br>        (context, index) =&gt; ListTile(title: Text(&#39;Satır $index&#39;)),  <br>        childCount: 50,  <br>      ),  <br>    ),  <br>  ],  <br>)</pre><h3>10. Theming: Theme ve ThemeData</h3><ul><li><strong>ThemeData</strong>: Renk, tipografi, bileşen stillerini tüm uygulamaya yayan merkezi yapılandırma</li><li><strong>Theme.of(context)</strong>: En yakın Theme widget’ının verisine erişim</li><li><strong>ThemeExtension</strong>: Uygulamaya özel, Material’de olmayan tema değerleri eklemek için genişletme noktası</li></ul><pre>MaterialApp(  <br>  theme: ThemeData(  <br>    colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),  <br>    useMaterial3: true,  <br>  ),  <br>  darkTheme: ThemeData.dark(useMaterial3: true),  <br>  themeMode: ThemeMode.system,  <br>)</pre><pre>// Kullanım<br>Container(color: Theme.of(context).colorScheme.primary)</pre><h3>11. Custom RenderObject</h3><ul><li><strong>RenderObject</strong>: Widget’ın altında yatan, gerçek ölçüm (layout) ve boyama (paint) işlemlerini yapan nesne</li><li><strong>performLayout/paint</strong>: Bir RenderObject’in override etmesi gereken, boyutlandırma ve çizim mantığını içeren metodlar</li><li><strong>Ne Zaman Gerekir</strong>: Var olan widget’larla ifade edilemeyen, tamamen özel layout/çizim davranışları için</li></ul><pre>class OzelRenderKutu extends RenderBox {  <br>  @override  <br>  void performLayout() {  <br>    size = constraints.constrain(const Size(100, 100));  <br>  }</pre><pre>  @override  <br>  void paint(PaintingContext context, Offset ofset) {  <br>    context.canvas.drawRect(  <br>      ofset &amp; size,  <br>      Paint()..color = Colors.blue,  <br>    );  <br>  }  <br>}</pre><h3>12. Animation: AnimationController ve Tween</h3><ul><li><strong>AnimationController</strong>: Bir animasyonun süresini, ilerlemesini ve yönünü yöneten temel sınıf</li><li><strong>Tween</strong>: Başlangıç ve bitiş değerleri arasında interpolasyon tanımlayan yapı</li><li><strong>AnimatedBuilder</strong>: Bir animasyon değeri değiştiğinde sadece ilgili alt ağacı yeniden çizen optimize edici widget</li></ul><pre>class GenislesenKutu extends StatefulWidget {  <br>  const GenislesenKutu({super.key});  <br>  @override  <br>  State&lt;GenislesenKutu&gt; createState() =&gt; _GenislesenKutuState();  <br>}</pre><pre>class _GenislesenKutuState extends State&lt;GenislesenKutu&gt;  <br>    with SingleTickerProviderStateMixin {  <br>  late final AnimationController _controller = AnimationController(  <br>    duration: const Duration(milliseconds: 300), vsync: this,  <br>  );  <br>  late final Animation&lt;double&gt; _boyut = Tween(begin: 80.0, end: 200.0)  <br>    .animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut));</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return AnimatedBuilder(  <br>      animation: _boyut,  <br>      builder: (context, child) =&gt; Container(width: _boyut.value, height: _boyut.value),  <br>    );  <br>  }  <br>}</pre><h3>13. İmplicit Animasyonlar</h3><ul><li><strong>AnimatedContainer/AnimatedOpacity</strong>: AnimationController yazmadan, sadece hedef değeri değiştirerek otomatik animasyon</li><li><strong>Kullanım Alanı</strong>: Basit, tek yönlü geçişler için AnimationController&#39;ın tüm boilerplate&#39;inden kaçınma</li></ul><pre>class BasitGecis extends StatefulWidget {  <br>  const BasitGecis({super.key});  <br>  @override  <br>  State&lt;BasitGecis&gt; createState() =&gt; _BasitGecisState();  <br>}</pre><pre>class _BasitGecisState extends State&lt;BasitGecis&gt; {  <br>  bool _genis = false;</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return GestureDetector(  <br>      onTap: () =&gt; setState(() =&gt; _genis = !_genis),  <br>      child: AnimatedContainer(  <br>        duration: const Duration(milliseconds: 200),  <br>        width: _genis ? 300 : 100,             // sadece hedef değişir, animasyon otomatik  <br>      ),  <br>    );  <br>  }  <br>}</pre><h3>14. Gesture Handling</h3><ul><li><strong>GestureDetector</strong>: Tıklama, sürükleme, pinch gibi yüksek seviyeli dokunma olaylarını yakalayan widget</li><li><strong>Listener</strong>: Ham pointer olaylarına (down/move/up) daha düşük seviyeli erişim</li><li><strong>Gesture Arena</strong>: Birden fazla gesture detector çakıştığında Flutter’ın hangisinin “kazanacağına” karar verme mekanizması</li></ul><pre>GestureDetector(  <br>  onTap: () =&gt; print(&#39;Tıklandı&#39;),  <br>  onPanUpdate: (detay) =&gt; setState(() =&gt; _ofset += detay.delta),  <br>  onScaleUpdate: (detay) =&gt; setState(() =&gt; _olcek = detay.scale),  <br>  child: Container(color: Colors.blue, width: 100, height: 100),  <br>)</pre><h3>15. CustomPaint ve Canvas</h3><ul><li><strong>CustomPaint</strong>: Doğrudan çizim yapmak için bir CustomPainter kullanan widget</li><li><strong>shouldRepaint</strong>: Painter’ın ne zaman yeniden çizileceğini kontrol ederek gereksiz çizimi önleme</li></ul><pre>class GrafikCizici extends CustomPainter {  <br>  final double yuzde;  <br>  GrafikCizici(this.yuzde);</pre><pre>  @override  <br>  void paint(Canvas canvas, Size boyut) {  <br>    final boyaKalemi = Paint()  <br>      ..color = Colors.blue  <br>      ..style = PaintingStyle.stroke  <br>      ..strokeWidth = 8;  <br>    canvas.drawArc(  <br>      Offset.zero &amp; boyut, -90 * (3.14159 / 180), 2 * 3.14159 * yuzde, false, boyaKalemi,  <br>    );  <br>  }</pre><pre>  @override  <br>  bool shouldRepaint(GrafikCizici eski) =&gt; eski.yuzde != yuzde;  <br>}</pre><h3>16. Builder Pattern: LayoutBuilder, ValueListenableBuilder</h3><ul><li><strong>LayoutBuilder</strong>: Üst widget’ın verdiği constraint’lere (BoxConstraints) göre farklı widget’lar oluşturma</li><li><strong>ValueListenableBuilder</strong>: Bir ValueNotifier&#39;ı dinleyip sadece değeri değiştiğinde ilgili kısmı yeniden çizme</li><li><strong>Builder Deseni</strong>: Genel olarak, yeni bir BuildContext sağlamak veya belirli bir veriye tepki vermek için kullanılan fonksiyonel widget yaklaşımı</li></ul><pre>LayoutBuilder(  <br>  builder: (context, constraints) {  <br>    if (constraints.maxWidth &gt; 600) return GenisEkranDuzeni();  <br>    return DarEkranDuzeni();  <br>  },  <br>)</pre><pre>final sayac = ValueNotifier&lt;int&gt;(0);</pre><pre>ValueListenableBuilder&lt;int&gt;(  <br>  valueListenable: sayac,  <br>  builder: (context, deger, child) =&gt; Text(&#39;$deger&#39;),   // sadece sayac değişince yeniden çizilir  <br>)</pre><h3>17. Widget Yaşam Döngüsü Derinlemesine</h3><ul><li><strong>initState</strong>: State nesnesi oluşturulduğunda bir kez çağrılır, context henüz tam hazır değildir</li><li><strong>didChangeDependencies</strong>: initState&#39;ten hemen sonra ve bağımlı bir InheritedWidget değiştiğinde çağrılır</li><li><strong>didUpdateWidget</strong>: Parent yeniden build edip aynı State’i farklı bir widget konfigürasyonuyla kullandığında çağrılır</li><li><strong>deactivate/dispose</strong>: Widget ağaçtan kaldırılırken (deactivate) ve kalıcı olarak yok edilirken (dispose) çağrılır</li></ul><pre>class Ornek extends StatefulWidget {  <br>  final String id;  <br>  const Ornek({super.key, required this.id});  <br>  @override  <br>  State&lt;Ornek&gt; createState() =&gt; _OrnekState();  <br>}</pre><pre>class _OrnekState extends State&lt;Ornek&gt; {  <br>  @override  <br>  void initState() {  <br>    super.initState();  <br>    print(&#39;Oluşturuldu&#39;);  <br>  }</pre><pre>  @override  <br>  void didUpdateWidget(Ornek eski) {  <br>    super.didUpdateWidget(eski);  <br>    if (eski.id != widget.id) print(&#39;id değişti: ${eski.id} -&gt; ${widget.id}&#39;);  <br>  }</pre><pre>  @override  <br>  void dispose() {  <br>    print(&#39;Temizleniyor&#39;);  <br>    super.dispose();  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) =&gt; Text(widget.id);  <br>}</pre><h3>18. Testing: WidgetTester</h3><ul><li><strong>testWidgets</strong>: Widget testleri için kullanılan, sanal bir binding üzerinde çalışan test fonksiyonu</li><li><strong>pumpWidget/pump</strong>: Bir widget’ı test ortamına “yerleştirme” ve frame’leri ilerletme</li><li><strong>find</strong>: Widget ağacında belirli bir widget’ı metin, tip veya key’e göre arama</li></ul><pre>testWidgets(&#39;sayaç tıklanınca artmalı&#39;, (tester) async {  <br>  await tester.pumpWidget(const MaterialApp(home: Sayac()));</pre><pre>  expect(find.text(&#39;Tıklama: 0&#39;), findsOneWidget);</pre><pre>  await tester.tap(find.byType(ElevatedButton));  <br>  await tester.pump();                              // yeni frame&#39;i işle</pre><pre>  expect(find.text(&#39;Tıklama: 1&#39;), findsOneWidget);  <br>});</pre><h3>19. Performans: RepaintBoundary</h3><ul><li><strong>RepaintBoundary</strong>: Bir alt ağacın çizimini izole ederek, o ağaç değiştiğinde üst/kardeş widget’ların yeniden boyanmasını önleme</li><li><strong>Ne Zaman Kullanılır</strong>: Sık değişen animasyonlu bir widget’ın etrafındaki statik içeriği yeniden boyamaktan korumak için</li></ul><pre>Column(  <br>  children: [  <br>    const StatikBaslik(),                  // sık değişmeyen içerik  <br>    RepaintBoundary(                        // animasyon burada izole edilir  <br>      child: DonenIkon(),  <br>    ),  <br>  ],  <br>)</pre><h3>20. Overlay ve Portal Desenleri</h3><ul><li><strong>Overlay</strong>: Widget ağacının normal akışının dışında, en üstte gösterilen widget’lar için katman</li><li><strong>OverlayEntry</strong>: Bir Overlay’e eklenen, manuel olarak yönetilen tekil giriş</li><li><strong>Kullanım Alanları</strong>: Tooltip, dropdown menü, snackbar gibi ağacın herhangi bir yerinden tetiklenip en üstte gösterilmesi gereken UI’lar</li></ul><pre>void tooltipGoster(BuildContext context) {  <br>  final overlay = Overlay.of(context);  <br>  late OverlayEntry girdi;  <br>  girdi = OverlayEntry(  <br>    builder: (context) =&gt; Positioned(  <br>      top: 100, left: 50,  <br>      child: Material(child: Text(&#39;İpucu metni&#39;)),  <br>    ),  <br>  );  <br>  overlay.insert(girdi);  <br>  Future.delayed(const Duration(seconds: 2), () =&gt; girdi.remove());  <br>}</pre><h3>21. Focus ve Klavye Yönetimi</h3><ul><li><strong>FocusNode</strong>: Bir widget’ın klavye/input odağını (focus) programatik olarak kontrol etme</li><li><strong>FocusScope</strong>: Bir alt ağaçtaki focus davranışını gruplama ve yönetme</li><li><strong>Shortcuts/Actions</strong>: Klavye kısayollarını deklaratif şekilde widget ağacına bağlama</li></ul><pre>class FormAlani extends StatefulWidget {  <br>  const FormAlani({super.key});  <br>  @override  <br>  State&lt;FormAlani&gt; createState() =&gt; _FormAlaniState();  <br>}</pre><pre>class _FormAlaniState extends State&lt;FormAlani&gt; {  <br>  final _focusNode = FocusNode();</pre><pre>  @override  <br>  void dispose() {  <br>    _focusNode.dispose();  <br>    super.dispose();  <br>  }</pre><pre>  @override  <br>  Widget build(BuildContext context) {  <br>    return TextField(focusNode: _focusNode);  <br>  }  <br>}</pre><h3>22. Erişilebilirlik: Semantics Widget</h3><ul><li><strong>Semantics</strong>: Bir widget’a ekran okuyucular için anlam ve açıklama ekleyen widget</li><li><strong>excludeSemantics</strong>: Alt widget’ların kendi semantic bilgisini görmezden gelip üstteki açıklamayı kullanma</li><li><strong>MergeSemantics</strong>: Birden fazla alt widget’ı tek bir erişilebilirlik birimine birleştirme</li></ul><pre>Semantics(  <br>  label: &#39;Favorilere ekle&#39;,  <br>  button: true,  <br>  child: ExcludeSemantics(  <br>    child: Icon(Icons.favorite_border),   // ikonun kendi semantiği gizlenir, üsttekiyle değiştirilir  <br>  ),  <br>)</pre><h3>23. Platform View Interop</h3><ul><li><strong>AndroidView / UiKitView</strong>: Native Android/iOS view’larını Flutter widget ağacına gömme</li><li><strong>PlatformViewLink</strong>: Daha performanslı, hibrit composition tabanlı platform view entegrasyonu</li><li><strong>Kullanım Alanları</strong>: Harita SDK’ları, native video player gibi Flutter’da native karşılığı olmayan bileşenler</li></ul><pre>Widget build(BuildContext context) {  <br>  if (Platform.isAndroid) {  <br>    return const AndroidView(viewType: &#39;harita_gorunumu&#39;);  <br>  } else if (Platform.isIOS) {  <br>    return const UiKitView(viewType: &#39;harita_gorunumu&#39;);  <br>  }  <br>  return const Placeholder();  <br>}</pre><h3>24. DevTools ile Widget İnceleme</h3><ul><li><strong>Widget Inspector</strong>: Widget ağacını canlı görselleştiren, layout sorunlarını tespit eden DevTools aracı</li><li><strong>Rebuild Sayaçları</strong>: Hangi widget’ların ne sıklıkla yeniden build edildiğini gösteren performans görünümü</li><li><strong>debugPrintRebuildDirtyWidgets</strong>: Konsola hangi widget’ların “dirty” olarak işaretlendiğini yazdıran debug flag’i</li></ul><pre>void main() {  <br>  debugPrintRebuildDirtyWidgets = true;   // konsolda hangi widget&#39;ların rebuild olduğunu gösterir  <br>  runApp(const Uygulama());  <br>}</pre><h3>25. Production’da Bilinmesi Gereken Diğer Konular</h3><ul><li><strong>Widget vs Element Karışıklığı</strong>: context.widget ile context üzerinden erişilen State&#39;in farklı ömürlere sahip olduğunu unutmama</li><li><strong>BuildContext’i Async Sonrası Kullanmama</strong>: await sonrası context kullanmadan önce mounted kontrolü yapma zorunluluğu</li><li><strong>Deferred Components</strong>: Uygulama boyutunu küçültmek için bazı özellikleri talep üzerine indirme</li><li><strong>Impeller Rendering</strong>: Flutter’ın yeni render motorunun widget performansına etkisi</li></ul><pre>Future&lt;void&gt; veriYukle() async {  <br>  final sonuc = await api.getir();  <br>  if (!mounted) return;               // widget ağaçtan kaldırılmışsa setState çağırma  <br>  setState(() =&gt; _veri = sonuc);  <br>}</pre><h3>Terimler Sözlüğü</h3><h3>Temel Kavramlar</h3><ul><li><strong>Widget Tree/Element Tree/RenderObject Tree</strong>: Flutter’ın UI’ı temsil eden üç katmanlı ağaç yapısı.</li><li><strong>BuildContext</strong>: Bir widget’ın Element ağacındaki konumunu temsil eden referans.</li><li><strong>Key</strong>: Widget’ları eski/yeni ağaç arasında eşleştirmek için kullanılan kimlik.</li><li><strong>RenderObject</strong>: Gerçek layout ve boyama işlemlerini yapan alt seviye nesne.</li></ul><h3>State Yönetimi</h3><ul><li><strong>setState</strong>: Framework’e state değişikliğini bildiren ve rebuild tetikleyen çağrı.</li><li><strong>InheritedWidget</strong>: Bir değeri ağaçta parametre geçmeden paylaşan temel mekanizma.</li><li><strong>ValueNotifier</strong>: Değeri değiştiğinde dinleyicilerini haberdar eden basit gözlemlenebilir tip.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>Sliver</strong>: Kaydırma davranışını özelleştirilebilir parçalara bölen düşük seviyeli protokol.</li><li><strong>Expanded/Flexible</strong>: Row/Column içinde kalan alanı paylaştıran layout widget’ları.</li><li><strong>CustomPaint</strong>: Doğrudan Canvas üzerinde çizim yapmayı sağlayan widget.</li></ul><h3>Animasyon</h3><ul><li><strong>AnimationController</strong>: Animasyonun süresini ve ilerlemesini yöneten temel sınıf.</li><li><strong>Tween</strong>: Başlangıç ve bitiş değerleri arasında interpolasyon tanımlayan yapı.</li><li><strong>AnimatedBuilder</strong>: Animasyon değeri değiştiğinde sadece ilgili ağacı yeniden çizen widget.</li></ul><h3>Performans</h3><ul><li><strong>const Constructor</strong>: Widget’ı rebuild’den muaf tutan optimizasyon.</li><li><strong>RepaintBoundary</strong>: Bir alt ağacın boyamasını izole eden widget.</li><li><strong>Widget Inspector</strong>: DevTools içindeki, widget ağacını canlı inceleme aracı.</li></ul><h3>Kaynaklar</h3><h3>Temel Kavramlar</h3><ul><li><strong>Flutter Resmi Dokümantasyon</strong> =&gt; <a href="https://docs.flutter.dev/">https://docs.flutter.dev/</a></li><li><strong>Widgets Introduction</strong> =&gt; <a href="https://docs.flutter.dev/ui/widgets-intro">https://docs.flutter.dev/ui/widgets-intro</a></li><li><strong>Understanding Constraints</strong> =&gt; <a href="https://docs.flutter.dev/ui/layout/constraints">https://docs.flutter.dev/ui/layout/constraints</a></li></ul><h3>State Yönetimi</h3><ul><li><strong>State Management</strong> =&gt; <a href="https://docs.flutter.dev/data-and-backend/state-mgmt/intro">https://docs.flutter.dev/data-and-backend/state-mgmt/intro</a></li><li><strong>InheritedWidget</strong> =&gt; <a href="https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html">https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html</a></li></ul><h3>Animasyon</h3><ul><li><strong>Animations Overview</strong> =&gt; <a href="https://docs.flutter.dev/ui/animations">https://docs.flutter.dev/ui/animations</a></li><li><strong>Implicit Animations</strong> =&gt; <a href="https://docs.flutter.dev/ui/animations/implicit-animations">https://docs.flutter.dev/ui/animations/implicit-animations</a></li></ul><h3>Performans</h3><ul><li><strong>Performance Best Practices</strong> =&gt; <a href="https://docs.flutter.dev/perf/best-practices">https://docs.flutter.dev/perf/best-practices</a></li><li><strong>Flutter DevTools</strong> =&gt; <a href="https://docs.flutter.dev/tools/devtools">https://docs.flutter.dev/tools/devtools</a></li></ul><h3>Testing</h3><ul><li><strong>Widget Testing</strong> =&gt; <a href="https://docs.flutter.dev/testing/overview">https://docs.flutter.dev/testing/overview</a></li></ul><h3>Slivers &amp; Layout</h3><ul><li><strong>Slivers</strong> =&gt; <a href="https://docs.flutter.dev/ui/advanced/slivers">https://docs.flutter.dev/ui/advanced/slivers</a></li></ul><h3>Platform Interop</h3><ul><li><strong>Platform Views</strong> =&gt; <a href="https://docs.flutter.dev/platform-integration/android/platform-views">https://docs.flutter.dev/platform-integration/android/platform-views</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b8062d214fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | SwiftUI (English)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-swiftui-english-8eb7ac43127f?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eb7ac43127f</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Mon, 27 Jul 2026 12:48:43 GMT</pubDate>
            <atom:updated>2026-07-27T12:48:43.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ukZBJaRXKhMVhTcv6eH2zg.png" /></figure><p>“This is a roadmap — you need to dive deep into each topic on your own”</p><h3>1. The View Protocol &amp; Core Building Blocks</h3><ul><li><strong>View Protocol</strong>: the core protocol that turns a struct into a UI-emitting building block</li><li><strong>Declarative Approach</strong>: describing “what the UI should look like now” instead of step-by-step instructions</li><li><strong>body Property</strong>: the single required requirement every View must satisfy, returning some View</li></ul><pre>struct Greeting: View {  <br>  let name: String</pre><pre>  var body: some View {  <br>    Text(&quot;Hello, \(name)!&quot;)  <br>  }  <br>}</pre><pre>struct App: View {  <br>  var body: some View {  <br>    Greeting(name: &quot;World&quot;)       // a View builds the UI tree by calling other Views  <br>  }  <br>}</pre><h3>2. State Management: @State</h3><ul><li><strong>@State</strong>: a local variable belonging to a View that changes over time and triggers a redraw</li><li><strong>Value Type Fit</strong>: @State is designed for structs, aligning with SwiftUI&#39;s value-type philosophy</li></ul><pre>struct Counter: View {  <br>  @State private var count = 0</pre><pre>  var body: some View {  <br>    Button(&quot;Click count: \(count)&quot;) {  <br>      count += 1                    // redraws automatically when count changes  <br>    }  <br>  }  <br>}</pre><h3>3. @Binding: State Hoisting</h3><ul><li><strong>@Binding</strong>: a property wrapper granting read/write access to state owned by another View, without taking ownership</li><li><strong>Purpose</strong>: moving state from a child View to its parent, making the View stateless</li></ul><pre>struct CounterScreen: View {  <br>  @State private var count = 0  </pre><pre>  var body: some View {  <br>    Counter(value: $count)          // $ creates a binding, state lives in the parent  <br>  }  <br>}</pre><pre>struct Counter: View {  <br>  @Binding var value: Int           // stateless, only takes a binding  </pre><pre>  var body: some View {  <br>    Button(&quot;Value: \(value)&quot;) { value += 1 }  <br>  }  <br>}</pre><h3>4. The View Update Mechanism</h3><ul><li><strong>Diffing</strong>: SwiftUI only recomputes the Views affected by a state change</li><li><strong>Identity</strong>: SwiftUI tracks Views by positional or id-based identity, not struct equality</li><li><strong>Equatable View</strong>: making a View Equatable lets SwiftUI compare it, avoiding unnecessary recomputation</li></ul><pre>struct UserList: View {  <br>  let users: [User]  </pre><pre>  var body: some View {  <br>    // SwiftUI can skip recomputing this View if users hasn&#39;t changed  <br>    List(users) { user in  <br>      Text(user.name)  <br>    }  <br>  }  <br>}</pre><h3>5. View Modifiers</h3><ul><li><strong>Modifier</strong>: chainable functions that configure a View’s appearance and behavior from the outside</li><li><strong>Order Matters</strong>: the order in the modifier chain directly affects the result — each modifier returns a new View</li></ul><pre>struct Card: View {  <br>  var body: some View {  <br>    Text(&quot;Content&quot;)  <br>      .padding(8)              // inner spacing first  <br>      .background(Color.gray)  // then the background  <br>      .padding(16)              // then outer spacing  <br>      .onTapGesture { }  <br>  }  <br>}</pre><h3>6. Layout Basics: VStack, HStack, ZStack</h3><ul><li><strong>VStack</strong>: the core layout that arranges elements vertically</li><li><strong>HStack</strong>: the core layout that arranges elements horizontally</li><li><strong>ZStack</strong>: a layout that stacks elements on top of each other</li></ul><pre>struct ProfileCard: View {  <br>  var body: some View {  <br>    VStack {  <br>      ZStack(alignment: .bottomTrailing) {  <br>        Image(&quot;profile&quot;)  <br>        Image(systemName: &quot;checkmark.seal.fill&quot;)  <br>      }  <br>      HStack {  <br>        Text(&quot;John Doe&quot;)  <br>        Text(&quot;• Active&quot;)  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>7. List &amp; ForEach</h3><ul><li><strong>List</strong>: a built-in View creating a performant, scrollable list</li><li><strong>ForEach</strong>: a construct converting a collection into Views, requiring Identifiable</li><li><strong>LazyVStack/LazyHStack</strong>: used outside of List, inside a ScrollView, when lazy loading is needed</li></ul><pre>struct UserList: View {  <br>  let users: [User]     // should conform to Identifiable, or an id keypath must be given</pre><pre>  var body: some View {  <br>    List(users) { user in    // each one is tracked by a stable id  <br>      Text(user.name)  <br>    }  <br>  }  <br>}</pre><pre>struct CustomList: View {  <br>  var body: some View {  <br>    ScrollView {  <br>      LazyVStack {  <br>        ForEach(0..&lt;1000) { i in  <br>          Text(&quot;Row \(i)&quot;)  <br>        }  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>8. NavigationStack</h3><ul><li><strong>NavigationStack</strong>: the modern navigation container introduced in iOS 16+ managing push/pop transitions</li><li><strong>NavigationPath</strong>: a stack structure used for programmatic, type-safe navigation</li><li><strong>navigationDestination</strong>: defining the screen that corresponds to a given data type</li></ul><pre>struct AppNavigation: View {  <br>  @State private var path = NavigationPath()</pre><pre>  var body: some View {  <br>    NavigationStack(path: $path) {  <br>      HomeScreen(onClick: { id in path.append(id) })  <br>        .navigationDestination(for: String.self) { id in  <br>          DetailScreen(id: id)  <br>        }  <br>    }  <br>  }  <br>}</pre><h3>9. Side Effects: onAppear, onChange, task</h3><ul><li><strong>onAppear/onDisappear</strong>: side effects triggered when a View appears/disappears from screen</li><li><strong>onChange</strong>: a callback that runs when a value changes, providing the old and new values</li><li><strong>task</strong>: a modifier that starts async work tied to the View’s lifecycle, automatically cancelled</li></ul><pre>struct UserScreen: View {  <br>  let id: String  <br>  @State private var user: User?</pre><pre>  var body: some View {  <br>    VStack {  <br>      if let user { Text(user.name) }  <br>    }  <br>    .task(id: id) {                     // re-triggers when id changes, cancelled when the View disappears  <br>      user = try? await service.getUser(id: id)  <br>    }  <br>    .onChange(of: id) { oldId, newId in  <br>      print(&quot;\(oldId) -&gt; \(newId)&quot;)  <br>    }  <br>  }  <br>}</pre><h3>10. @State vs @StateObject vs @ObservedObject</h3><ul><li><strong>@State</strong>: local state belonging to a View, for value types (struct/enum)</li><li><strong>@StateObject</strong>: the initial creation where a View owns an ObservableObject, its lifecycle tied to the View</li><li><strong>@ObservedObject</strong>: a reference to an ObservableObject whose ownership lives elsewhere</li></ul><pre>class UserViewModel: ObservableObject {  <br>  @Published var name: String = &quot;&quot;  <br>}</pre><pre>struct Screen: View {  <br>  @StateObject private var viewModel = UserViewModel()   // created and owned by this View</pre><pre>  var body: some View {  <br>    SubScreen(viewModel: viewModel)  <br>  }  <br>}</pre><pre>struct SubScreen: View {  <br>  @ObservedObject var viewModel: UserViewModel            // passed in, ownership lies elsewhere  </pre><pre>  var body: some View {  <br>    Text(viewModel.name)  <br>  }  <br>}</pre><h3>11. Environment &amp; EnvironmentObject</h3><ul><li><strong>@Environment</strong>: reading a system or custom value implicitly across the View tree without passing it as a parameter</li><li><strong>@EnvironmentObject</strong>: sharing an ObservableObject implicitly across the tree</li><li><strong>Use Case</strong>: broad dependencies like theme or user session</li></ul><pre>struct App: View {  <br>  @StateObject private var session = UserSession()</pre><pre>  var body: some View {  <br>    ContentScreen()  <br>      .environmentObject(session)          // any View in the subtree can access it  <br>  }  <br>}</pre><pre>struct ContentScreen: View {  <br>  @EnvironmentObject var session: UserSession   // accessed without passing a parameter  </pre><pre>  var body: some View {  <br>    Text(session.username)  <br>  }  <br>}</pre><h3>12. ViewBuilder &amp; Composable Design Patterns</h3><ul><li><strong>@ViewBuilder</strong>: a compiler feature that combines multiple View expressions into a single some View</li><li><strong>Custom Container Views</strong>: building flexible, reusable Views with a content: () -&gt; Content parameter</li></ul><pre>struct Card&lt;Content: View&gt;: View {  <br>  @ViewBuilder let content: () -&gt; Content</pre><pre>  var body: some View {  <br>    VStack {  <br>      content()                            // the caller injects its own content  <br>    }  <br>    .padding()  <br>    .background(Color(.systemGray6))  <br>    .cornerRadius(12)  <br>  }  <br>}</pre><pre>Card {  <br>  Text(&quot;Title&quot;)  <br>  Text(&quot;Subtitle&quot;)  <br>}</pre><h3>13. Custom Layout Protocol (iOS 16+)</h3><ul><li><strong>Layout Protocol</strong>: fully customizing the measurement and placement logic of Views</li><li><strong>sizeThatFits/placeSubviews</strong>: methods for measuring subviews and placing them at a calculated position</li></ul><pre>struct FlowLayout: Layout {  <br>  func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -&gt; CGSize {  <br>    CGSize(width: proposal.width ?? 0, height: 200)  <br>  }</pre><pre>  func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {  <br>    var x = bounds.minX  <br>    for subview in subviews {  <br>      let size = subview.sizeThatFits(.unspecified)  <br>      subview.place(at: CGPoint(x: x, y: bounds.minY), proposal: .unspecified)  <br>      x += size.width  <br>    }  <br>  }  <br>}</pre><h3>14. Animation: withAnimation, matchedGeometryEffect</h3><ul><li><strong>withAnimation</strong>: wrapping a state change with a specific animation curve</li><li><strong>animation Modifier</strong>: defining automatic animation tied to a value</li><li><strong>matchedGeometryEffect</strong>: creating a fluid transition (hero animation) between two different Views</li></ul><pre>struct ExpandableCard: View {  <br>  @State private var expanded = false</pre><pre>  var body: some View {  <br>    RoundedRectangle(cornerRadius: 12)  <br>      .frame(height: expanded ? 200 : 80)  <br>      .onTapGesture {  <br>        withAnimation(.spring()) {  <br>          expanded.toggle()          // the change happens animated  <br>        }  <br>      }  <br>  }  <br>}</pre><h3>15. ViewModel Integration with @Observable (iOS 17+)</h3><ul><li><strong>@Observable Macro</strong>: the newer, more performant observability system replacing the ObservableObject/@Published pair</li><li><strong>Granular Tracking</strong>: SwiftUI now only tracks changes to properties a View actually reads</li></ul><pre>@Observable  <br>class UserViewModel {  <br>  var name: String = &quot;&quot;  <br>  var isLoading: Bool = false  <br>}</pre><pre>struct Screen: View {  <br>  @State private var viewModel = UserViewModel()   // @State is enough instead of @StateObject</pre><pre>  var body: some View {  <br>    Text(viewModel.name)                            // redraws only when &#39;name&#39; changes  <br>  }  <br>}</pre><h3>16. Gesture Handling</h3><ul><li><strong>DragGesture</strong>: the built-in gesture type capturing drag movements</li><li><strong>TapGesture/LongPressGesture</strong>: click and long-press behaviors</li><li><strong>Gesture Composition</strong>: combining multiple gestures with simultaneously/sequenced</li></ul><pre>struct DraggableBox: View {  <br>  @State private var offset = CGSize.zero</pre><pre>  var body: some View {  <br>    Circle()  <br>      .frame(width: 50, height: 50)  <br>      .offset(offset)  <br>      .gesture(  <br>        DragGesture()  <br>          .onChanged { value in offset = value.translation }  <br>          .onEnded { _ in withAnimation { offset = .zero } }  <br>      )  <br>  }  <br>}</pre><h3>17. Canvas &amp; Custom Drawing</h3><ul><li><strong>Canvas View</strong>: a low-level, immediate-mode drawing API for drawing directly</li><li><strong>Path</strong>: vector drawing commands like move(to:), addLine(to:), addArc</li></ul><pre>struct SimpleChart: View {  <br>  let percentage: Double</pre><pre>  var body: some View {  <br>    Canvas { context, size in  <br>      var path = Path()  <br>      path.addArc(  <br>        center: CGPoint(x: size.width/2, y: size.height/2),  <br>        radius: size.width/2,  <br>        startAngle: .degrees(-90),  <br>        endAngle: .degrees(-90 + 360 * percentage),  <br>        clockwise: false  <br>      )  <br>      context.stroke(path, with: .color(.blue), lineWidth: 8)  <br>    }  <br>  }  <br>}</pre><h3>18. Preview: The #Preview Macro</h3><ul><li><strong>#Preview</strong>: the macro introduced in Xcode 15+ eliminating the need to write a PreviewProvider</li><li><strong>Traits</strong>: parameters like #Preview(traits: .sizeThatFitsLayout) customizing the preview</li></ul><pre>#Preview(&quot;Light Theme&quot;) {  <br>  ProfileCard()  <br>}</pre><pre>#Preview(&quot;Dark Theme&quot;) {  <br>  ProfileCard()  <br>    .preferredColorScheme(.dark)  <br>}</pre><h3>19. Testing: XCTest &amp; Swift Testing</h3><ul><li><strong>XCTest</strong>: the classic test framework Apple has used for a long time</li><li><strong>Swift Testing (iOS 18+)</strong>: a newer, more expressive test framework using the @Test macro</li><li><strong>ViewInspector</strong>: a popular open-source library for programmatically verifying SwiftUI View content</li></ul><pre>import Testing</pre><pre>struct CalculatorTests {  <br>  @Test func twoNumbersShouldAddUp() {  <br>    let result = Calculator().add(2, 3)  <br>    #expect(result == 5)  <br>  }</pre><pre>  @Test func userShouldBeFetchedAsync() async throws {  <br>    let user = try await Service().getUser(id: &quot;1&quot;)  <br>    #expect(user.name == &quot;Alice&quot;)  <br>  }  <br>}</pre><h3>20. Performance Best Practices</h3><ul><li><strong>Narrowing State Scope</strong>: keeping @State as small and local as possible to reduce unnecessary redraws</li><li><strong>Equatable Conformance</strong>: making complex Views Equatable so SwiftUI can tell nothing has changed</li><li><strong>LazyVStack/LazyHStack</strong>: avoiding building all Views at once in large lists</li></ul><pre>struct RowView: View, Equatable {  <br>  let user: User  </pre><pre>  static func == (lhs: Self, rhs: Self) -&gt; Bool {  <br>    lhs.user.id == rhs.user.id            // redraws only when the id changes  <br>  }</pre><pre>  var body: some View {  <br>    Text(user.name)  <br>  }  <br>}</pre><h3>21. Interop: UIViewRepresentable</h3><ul><li><strong>UIViewRepresentable</strong>: the protocol for embedding a classic UIKit View into the SwiftUI tree</li><li><strong>UIViewControllerRepresentable</strong>: the counterpart for embedding a UIViewController into SwiftUI</li><li><strong>Coordinator</strong>: a helper object bridging UIKit delegates/callbacks into SwiftUI</li></ul><pre>struct MapView: UIViewRepresentable {  <br>  func makeUIView(context: Context) -&gt; MKMapView {  <br>    MKMapView()  <br>  }</pre><pre>  func updateUIView(_ uiView: MKMapView, context: Context) {  <br>    // the map updates when state changes  <br>  }  <br>}</pre><h3>22. Accessibility</h3><ul><li><strong>accessibilityLabel</strong>: the spoken description of visual elements for screen readers</li><li><strong>accessibilityElement(children:)</strong>: combining multiple child elements into a single accessibility unit</li><li><strong>Dynamic Type</strong>: automatically adapting to the font size the user chose system-wide</li></ul><pre>struct StatusIcon: View {  <br>  let active: Bool</pre><pre>  var body: some View {  <br>    Image(systemName: active ? &quot;checkmark.circle&quot; : &quot;xmark.circle&quot;)  <br>      .accessibilityLabel(active ? &quot;Active status&quot; : &quot;Inactive status&quot;)   // for screen readers  <br>  }  <br>}</pre><h3>23. SwiftUI Across Platforms</h3><ul><li><strong>A Single Codebase</strong>: the same SwiftUI Views can run on iOS, iPadOS, macOS, watchOS, and visionOS</li><li><strong>Platform-Specific Modifiers</strong>: adding platform-specific behavior via conditional compilation like #if os(iOS)</li><li><strong>ViewThatFits</strong>: a container that automatically picks the best-fitting layout for different screen sizes</li></ul><pre>struct AdaptiveScreen: View {  <br>  var body: some View {  <br>    ViewThatFits {  <br>      WideScreenView()      // used if it fits  <br>      NarrowScreenView()    // falls back to this if not  <br>    }  <br>  }  <br>}</pre><h3>24. State Restoration &amp; App Lifecycle</h3><ul><li><strong>@SceneStorage</strong>: automatically saving and restoring a View’s state per scene</li><li><strong>ScenePhase</strong>: tracking the app’s active, inactive, background states via @Environment</li></ul><pre>struct Screen: View {  <br>  @SceneStorage(&quot;searchText&quot;) private var searchText = &quot;&quot;  <br>  @Environment(\.scenePhase) private var scenePhase</pre><pre>  var body: some View {  <br>    TextField(&quot;Search&quot;, text: $searchText)  <br>      .onChange(of: scenePhase) { _, newPhase in  <br>        if newPhase == .background { saveData() }  <br>      }  <br>  }  <br>}</pre><h3>25. Other Things You Should Know in Production</h3><ul><li><strong>redacted(reason:)</strong>: turning content into a placeholder appearance during loading</li><li><strong>SwiftUI Profiling with Instruments</strong>: using the “SwiftUI” template to catch unnecessary body computations</li><li><strong>App Lifecycle (SwiftUI App Protocol)</strong>: launching an app without an AppDelegate using @main</li><li><strong>Self._printChanges()</strong>: an internal API used for debugging why a View redrew</li></ul><pre>@main  <br>struct AppEntry: App {  <br>  var body: some Scene {  <br>    WindowGroup {  <br>      ContentScreen()  <br>        .redacted(reason: isLoading ? .placeholder : [])  <br>    }  <br>  }  <br>}</pre><h3>Glossary of Terms</h3><h3>Core Concepts</h3><ul><li><strong>View Protocol</strong>: the core protocol that turns a struct into a UI-emitting building block.</li><li><strong>body</strong>: the required property every View must satisfy, returning some View.</li><li><strong>Diffing</strong>: SwiftUI only recomputing the Views affected by a state change.</li><li><strong>Modifier</strong>: a chainable function configuring a View’s appearance and behavior.</li></ul><h3>State Management</h3><ul><li><strong>@State</strong>: local state belonging to a View, for value types.</li><li><strong>@Binding</strong>: a property wrapper granting read/write access without taking ownership.</li><li><strong>@StateObject / @ObservedObject</strong>: the ways an ObservableObject is owned versus referenced.</li><li><strong>@Observable</strong>: the more granular, performant observability system introduced with iOS 17.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>VStack/HStack/ZStack</strong>: SwiftUI’s core layout Views.</li><li><strong>List</strong>: a built-in View creating a performant, scrollable list.</li><li><strong>ViewBuilder</strong>: a compiler feature combining multiple View expressions into a single some View.</li><li><strong>Canvas</strong>: a low-level, immediate-mode drawing API.</li></ul><h3>Side Effects</h3><ul><li><strong>onAppear/onDisappear</strong>: effects triggered when a View appears/disappears.</li><li><strong>task</strong>: a modifier starting async work tied to the View’s lifecycle, automatically cancelled.</li><li><strong>onChange</strong>: a callback that runs when a value changes.</li></ul><h3>Ecosystem</h3><ul><li><strong>@Environment / @EnvironmentObject</strong>: mechanisms for sharing a value across the tree without passing it as a parameter.</li><li><strong>UIViewRepresentable</strong>: the protocol bridging UIKit components into SwiftUI.</li><li><strong>ViewThatFits</strong>: a container that automatically picks a layout based on screen size.</li></ul><h3>Resources</h3><h3>Core Concepts</h3><ul><li><strong>SwiftUI Official Documentation</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui">https://developer.apple.com/documentation/swiftui</a></li><li><strong>SwiftUI Tutorials</strong> =&gt; <a href="https://developer.apple.com/tutorials/swiftui">https://developer.apple.com/tutorials/swiftui</a></li><li><strong>Human Interface Guidelines</strong> =&gt; <a href="https://developer.apple.com/design/human-interface-guidelines">https://developer.apple.com/design/human-interface-guidelines</a></li></ul><h3>State Management</h3><ul><li><strong>Managing Model Data in Your App</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/managing-model-data-in-your-app">https://developer.apple.com/documentation/swiftui/managing-model-data-in-your-app</a></li><li><strong>Observation Framework</strong> =&gt; <a href="https://developer.apple.com/documentation/observation">https://developer.apple.com/documentation/observation</a></li></ul><h3>Navigation</h3><ul><li><strong>NavigationStack</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/navigationstack">https://developer.apple.com/documentation/swiftui/navigationstack</a></li></ul><h3>Animation</h3><ul><li><strong>Animations</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/animations">https://developer.apple.com/documentation/swiftui/animations</a></li></ul><h3>Testing</h3><ul><li><strong>Swift Testing</strong> =&gt; <a href="https://developer.apple.com/documentation/testing">https://developer.apple.com/documentation/testing</a></li><li><strong>XCTest</strong> =&gt; <a href="https://developer.apple.com/documentation/xctest">https://developer.apple.com/documentation/xctest</a></li></ul><h3>Performance</h3><ul><li><strong>SwiftUI Performance (WWDC)</strong> =&gt; <a href="https://developer.apple.com/videos/play/wwdc2021/10022/">https://developer.apple.com/videos/play/wwdc2021/10022/</a></li></ul><h3>Cross-Platform</h3><ul><li><strong>SwiftUI for All Platforms</strong> =&gt; <a href="https://developer.apple.com/xcode/swiftui/">https://developer.apple.com/xcode/swiftui/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eb7ac43127f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | SwiftUI (Türkçe)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-swiftui-t%C3%BCrk%C3%A7e-f73dd227222e?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f73dd227222e</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Mon, 27 Jul 2026 12:48:35 GMT</pubDate>
            <atom:updated>2026-07-27T12:48:35.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9jxrEnGPlw_K6fkq7cv7ug.png" /></figure><p>“Bu bir yol haritasıdır, her başlığı ayrı ayrı derinlemesine çalışman gerekir”</p><h3>1. View Protokolü ve Temel Yapı Taşları</h3><ul><li><strong>View Protokolü</strong>: Bir struct’ı UI üretebilen bir yapı taşına dönüştüren temel protokol</li><li><strong>Deklaratif Yaklaşım</strong>: UI’ı adım adım değil, “şu anda nasıl görünmeli” şeklinde tanımlama</li><li><strong>body Property</strong>: Her View’ın uyması gereken, some View döndüren tek zorunlu gereksinim</li></ul><pre>struct Selamla: View {  <br>  let isim: String</pre><pre>  var body: some View {  <br>    Text(&quot;Merhaba, \(isim)!&quot;)  <br>  }  <br>}</pre><pre>struct Uygulama: View {  <br>  var body: some View {  <br>    Selamla(isim: &quot;Dünya&quot;)        // View, başka View&#39;ları çağırarak UI ağacı kurar  <br>  }  <br>}</pre><h3>2. State Yönetimi: @State</h3><ul><li><strong>@State</strong>: Bir View’a ait, zamanla değişen ve UI’ı yeniden çizdiren yerel değişken</li><li><strong>Value Type Uyumu</strong>: @State&#39;in struct&#39;lar için tasarlanmış olması, SwiftUI&#39;ın value type felsefesine uygun çalışması</li></ul><pre>struct Sayac: View {  <br>  @State private var sayi = 0</pre><pre>  var body: some View {  <br>    Button(&quot;Tıklama sayısı: \(sayi)&quot;) {  <br>      sayi += 1                    // sayi değişince otomatik yeniden çizilir  <br>    }  <br>  }  <br>}</pre><h3>3. @Binding: State Hoisting</h3><ul><li><strong>@Binding</strong>: Bir state’in sahipliğini almadan, başka bir View’daki state’e okuma/yazma erişimi sağlayan property wrapper</li><li><strong>Amaç</strong>: State’i child View’dan parent’a taşıyarak View’ı stateless hale getirme</li></ul><pre>struct SayacEkrani: View {  <br>  @State private var sayi = 0  </pre><pre>  var body: some View {  <br>    Sayac(deger: $sayi)            // $ ile binding oluşturulur, state parent&#39;ta tutulur  <br>  }  <br>}</pre><pre>struct Sayac: View {  <br>  @Binding var deger: Int          // stateless, sadece binding alır  </pre><pre>  var body: some View {  <br>    Button(&quot;Değer: \(deger)&quot;) { deger += 1 }  <br>  }  <br>}</pre><h3>4. View Update Mekanizması</h3><ul><li><strong>Diffing</strong>: SwiftUI’ın, state değiştiğinde sadece etkilenen View’ları yeniden hesaplaması</li><li><strong>Identity</strong>: SwiftUI’ın View’ları struct eşitliğine göre değil, konumsal veya id tabanlı kimliğe göre takip etmesi</li><li><strong>Equatable View</strong>: Gereksiz yeniden hesaplamayı önlemek için View’ı Equatable yaparak SwiftUI&#39;a karşılaştırma imkanı verme</li></ul><pre>struct Liste: View {  <br>  let kullanicilar: [Kullanici]  </pre><pre>  var body: some View {  <br>    // kullanicilar değişmediyse SwiftUI bu View&#39;ı yeniden hesaplamayı atlayabilir  <br>    List(kullanicilar) { kullanici in  <br>      Text(kullanici.isim)  <br>    }  <br>  }  <br>}</pre><h3>5. View Modifiers</h3><ul><li><strong>Modifier</strong>: Bir View’ın görünümünü ve davranışını dışarıdan yapılandıran, zincirlenebilir fonksiyonlar</li><li><strong>Sıra Önemlidir</strong>: Modifier zincirindeki sıranın sonucu doğrudan etkilemesi — her modifier yeni bir View döndürür</li></ul><pre>struct Kart: View {  <br>  var body: some View {  <br>    Text(&quot;İçerik&quot;)  <br>      .padding(8)             // önce iç boşluk  <br>      .background(Color.gray) // sonra arkaplan  <br>      .padding(16)             // sonra dış boşluk  <br>      .onTapGesture { }  <br>  }  <br>}</pre><h3>6. Layout Temelleri: VStack, HStack, ZStack</h3><ul><li><strong>VStack</strong>: Elemanları dikey sırayla dizen temel layout</li><li><strong>HStack</strong>: Elemanları yatay sırayla dizen temel layout</li><li><strong>ZStack</strong>: Elemanları üst üste bindiren, katmanlama sağlayan layout</li></ul><pre>struct ProfilKarti: View {  <br>  var body: some View {  <br>    VStack {  <br>      ZStack(alignment: .bottomTrailing) {  <br>        Image(&quot;profil&quot;)  <br>        Image(systemName: &quot;checkmark.seal.fill&quot;)  <br>      }  <br>      HStack {  <br>        Text(&quot;Ali Veli&quot;)  <br>        Text(&quot;• Aktif&quot;)  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>7. List ve ForEach</h3><ul><li><strong>List</strong>: Performanslı, kaydırılabilir liste oluşturan yerleşik View</li><li><strong>ForEach</strong>: Bir koleksiyonu View’lara dönüştüren, Identifiable gerektiren yapı</li><li><strong>LazyVStack/LazyHStack</strong>: List dışında, ScrollView içinde lazy loading gereken durumlar için</li></ul><pre>struct KullaniciListesi: View {  <br>  let kullanicilar: [Kullanici]     // Identifiable&#39;a uymalı ya da id keypath verilmeli</pre><pre>  var body: some View {  <br>    List(kullanicilar) { kullanici in    // her biri stabil id ile takip edilir  <br>      Text(kullanici.isim)  <br>    }  <br>  }  <br>}</pre><pre>struct OzelListe: View {  <br>  var body: some View {  <br>    ScrollView {  <br>      LazyVStack {  <br>        ForEach(0..&lt;1000) { i in  <br>          Text(&quot;Satır \(i)&quot;)  <br>        }  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>8. NavigationStack</h3><ul><li><strong>NavigationStack</strong>: Ekranlar arası push/pop geçişlerini yöneten, iOS 16+ ile gelen modern navigation container</li><li><strong>NavigationPath</strong>: Programatik ve tip güvenli navigasyon için kullanılan yığın (stack) yapısı</li><li><strong>navigationDestination</strong>: Bir veri tipine karşılık gelen ekranı tanımlama</li></ul><pre>struct UygulamaNavigasyonu: View {  <br>  @State private var yol = NavigationPath()</pre><pre>  var body: some View {  <br>    NavigationStack(path: $yol) {  <br>      AnaSayfaEkrani(onTikla: { id in yol.append(id) })  <br>        .navigationDestination(for: String.self) { id in  <br>          DetayEkrani(id: id)  <br>        }  <br>    }  <br>  }  <br>}</pre><h3>9. Side Effects: onAppear, onChange, task</h3><ul><li><strong>onAppear/onDisappear</strong>: View ekrana geldiğinde/ekrandan kalktığında tetiklenen yan etkiler</li><li><strong>onChange</strong>: Bir değer değiştiğinde çalışan, eski ve yeni değeri veren callback</li><li><strong>task</strong>: View’ın yaşam döngüsüne bağlı, otomatik iptal edilen async iş başlatma modifier’ı</li></ul><pre>struct KullaniciEkrani: View {  <br>  let id: String  <br>  @State private var kullanici: Kullanici?</pre><pre>  var body: some View {  <br>    VStack {  <br>      if let kullanici { Text(kullanici.isim) }  <br>    }  <br>    .task(id: id) {                     // id değiştiğinde yeniden tetiklenir, View kalkınca iptal edilir  <br>      kullanici = try? await servis.kullaniciGetir(id: id)  <br>    }  <br>    .onChange(of: id) { eskiId, yeniId in  <br>      print(&quot;\(eskiId) -&gt; \(yeniId)&quot;)  <br>    }  <br>  }  <br>}</pre><h3>10. @State vs @StateObject vs @ObservedObject</h3><ul><li><strong>@State</strong>: Value type’lar (struct/enum) için, View’a ait yerel state</li><li><strong>@StateObject</strong>: Bir ObservableObject&#39;in View tarafından sahiplenildiği, yaşam döngüsü View&#39;a bağlı ilk oluşturma</li><li><strong>@ObservedObject</strong>: Sahipliği başka yerde olan bir ObservableObject&#39;e referans</li></ul><pre>class KullaniciViewModel: ObservableObject {  <br>  @Published var isim: String = &quot;&quot;  <br>}</pre><pre>struct Ekran: View {  <br>  @StateObject private var viewModel = KullaniciViewModel()   // View tarafından yaratılır ve sahiplenilir</pre><pre>  var body: some View {  <br>    AltEkran(viewModel: viewModel)  <br>  }  <br>}</pre><pre>struct AltEkran: View {  <br>  @ObservedObject var viewModel: KullaniciViewModel            // dışarıdan geçirilir, sahiplik burada değil  </pre><pre>  var body: some View {  <br>    Text(viewModel.isim)  <br>  }  <br>}</pre><h3>11. Environment ve EnvironmentObject</h3><ul><li><strong>@Environment</strong>: Sistem veya özel bir değeri View ağacında parametre geçmeden dolaylı olarak okuma</li><li><strong>@EnvironmentObject</strong>: Bir ObservableObject&#39;i ağaç boyunca örtük olarak paylaşma</li><li><strong>Kullanım Alanı</strong>: Tema, kullanıcı oturumu gibi geniş kapsamlı bağımlılıklar</li></ul><pre>struct Uygulama: View {  <br>  @StateObject private var oturum = KullaniciOturumu()</pre><pre>  var body: some View {  <br>    IcerikEkrani()  <br>      .environmentObject(oturum)          // alt ağaçtaki tüm View&#39;lar erişebilir  <br>  }  <br>}</pre><pre>struct IcerikEkrani: View {  <br>  @EnvironmentObject var oturum: KullaniciOturumu   // parametre geçmeden erişim  </pre><pre>  var body: some View {  <br>    Text(oturum.kullaniciAdi)  <br>  }  <br>}</pre><h3>12. ViewBuilder ve Composable Design Patterns</h3><ul><li><strong>@ViewBuilder</strong>: Birden fazla View ifadesini tek bir some View haline getiren derleyici özelliği</li><li><strong>Custom Container Views</strong>: content: () -&gt; Content parametresiyle esnek, yeniden kullanılabilir View&#39;lar oluşturma</li></ul><pre>struct Kart&lt;Icerik: View&gt;: View {  <br>  @ViewBuilder let icerik: () -&gt; Icerik</pre><pre>  var body: some View {  <br>    VStack {  <br>      icerik()                            // çağıran, kendi içeriğini enjekte eder  <br>    }  <br>    .padding()  <br>    .background(Color(.systemGray6))  <br>    .cornerRadius(12)  <br>  }  <br>}</pre><pre>Kart {  <br>  Text(&quot;Başlık&quot;)  <br>  Text(&quot;Alt metin&quot;)  <br>}</pre><h3>13. Custom Layout Protocol (iOS 16+)</h3><ul><li><strong>Layout Protokolü</strong>: View’ların ölçüm ve yerleşim mantığını tamamen özelleştirme</li><li><strong>sizeThatFits/placeSubviews</strong>: Alt View’ları ölçüp, hesaplanan konuma yerleştirme metodları</li></ul><pre>struct AkisLayout: Layout {  <br>  func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -&gt; CGSize {  <br>    CGSize(width: proposal.width ?? 0, height: 200)  <br>  }</pre><pre>  func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {  <br>    var x = bounds.minX  <br>    for subview in subviews {  <br>      let boyut = subview.sizeThatFits(.unspecified)  <br>      subview.place(at: CGPoint(x: x, y: bounds.minY), proposal: .unspecified)  <br>      x += boyut.width  <br>    }  <br>  }  <br>}</pre><h3>14. Animation: withAnimation, matchedGeometryEffect</h3><ul><li><strong>withAnimation</strong>: Bir state değişikliğini belirli bir animasyon eğrisiyle sarmalama</li><li><strong>animation Modifier</strong>: Bir değere bağlı otomatik animasyon tanımlama</li><li><strong>matchedGeometryEffect</strong>: İki farklı View arasında akıcı geçiş (hero animation) oluşturma</li></ul><pre>struct GenislesenKart: View {  <br>  @State private var genisletildi = false</pre><pre>  var body: some View {  <br>    RoundedRectangle(cornerRadius: 12)  <br>      .frame(height: genisletildi ? 200 : 80)  <br>      .onTapGesture {  <br>        withAnimation(.spring()) {  <br>          genisletildi.toggle()          // değişim animasyonlu şekilde gerçekleşir  <br>        }  <br>      }  <br>  }  <br>}</pre><h3>15. @Observable ile ViewModel Entegrasyonu (iOS 17+)</h3><ul><li><strong>@Observable Macro</strong>: ObservableObject/@Published çiftinin yerini alan, daha performanslı yeni gözlemlenebilirlik sistemi</li><li><strong>Granüler Takip</strong>: SwiftUI’ın artık sadece View’ın gerçekten okuduğu property’lerdeki değişimi izlemesi</li></ul><pre>@Observable  <br>class KullaniciViewModel {  <br>  var isim: String = &quot;&quot;  <br>  var yukleniyor: Bool = false  <br>}</pre><pre>struct Ekran: View {  <br>  @State private var viewModel = KullaniciViewModel()   // @StateObject yerine @State yeterli</pre><pre>  var body: some View {  <br>    Text(viewModel.isim)                                 // sadece &#39;isim&#39; değişince yeniden çizilir  <br>  }  <br>}</pre><h3>16. Gesture Handling</h3><ul><li><strong>DragGesture</strong>: Sürükleme hareketlerini yakalayan yerleşik gesture tipi</li><li><strong>TapGesture/LongPressGesture</strong>: Tıklama ve uzun basma davranışları</li><li><strong>Gesture Composition</strong>: simultaneously/sequenced ile birden fazla gesture&#39;ı birleştirme</li></ul><pre>struct SurukleneblirKutu: View {  <br>  @State private var ofset = CGSize.zero</pre><pre>  var body: some View {  <br>    Circle()  <br>      .frame(width: 50, height: 50)  <br>      .offset(ofset)  <br>      .gesture(  <br>        DragGesture()  <br>          .onChanged { deger in ofset = deger.translation }  <br>          .onEnded { _ in withAnimation { ofset = .zero } }  <br>      )  <br>  }  <br>}</pre><h3>17. Canvas ve Custom Drawing</h3><ul><li><strong>Canvas View</strong>: Doğrudan çizim yapmak için düşük seviyeli, immediate-mode çizim API’si</li><li><strong>Path</strong>: move(to:), addLine(to:), addArc gibi vektörel çizim komutları</li></ul><pre>struct BasitGrafik: View {  <br>  let yuzde: Double</pre><pre>  var body: some View {  <br>    Canvas { context, boyut in  <br>      var path = Path()  <br>      path.addArc(  <br>        center: CGPoint(x: boyut.width/2, y: boyut.height/2),  <br>        radius: boyut.width/2,  <br>        startAngle: .degrees(-90),  <br>        endAngle: .degrees(-90 + 360 * yuzde),  <br>        clockwise: false  <br>      )  <br>      context.stroke(path, with: .color(.blue), lineWidth: 8)  <br>    }  <br>  }  <br>}</pre><h3>18. Preview: #Preview Macro</h3><ul><li><strong>#Preview</strong>: Xcode 15+ ile gelen, PreviewProvider yazmaya gerek bırakmayan makro</li><li><strong>Traits</strong>: #Preview(traits: .sizeThatFitsLayout) gibi önizlemeyi özelleştiren parametreler</li></ul><pre>#Preview(&quot;Açık Tema&quot;) {  <br>  ProfilKarti()  <br>}</pre><pre>#Preview(&quot;Koyu Tema&quot;) {  <br>  ProfilKarti()  <br>    .preferredColorScheme(.dark)  <br>}</pre><h3>19. Testing: XCTest ve Swift Testing</h3><ul><li><strong>XCTest</strong>: Klasik, Apple’ın uzun süredir kullanılan test framework’ü</li><li><strong>Swift Testing (iOS 18+)</strong>: @Test makrosuyla daha modern, ifade gücü yüksek yeni test framework&#39;ü</li><li><strong>ViewInspector</strong>: SwiftUI View’larının içeriğini programatik olarak doğrulamaya yarayan popüler açık kaynak kütüphane</li></ul><pre>import Testing</pre><pre>struct HesapMakinesiTestleri {  <br>  @Test func ikiSayiToplanmali() {  <br>    let sonuc = HesapMakinesi().topla(2, 3)  <br>    #expect(sonuc == 5)  <br>  }</pre><pre>  @Test func kullaniciGetirilmeliAsync() async throws {  <br>    let kullanici = try await Servis().kullaniciGetir(id: &quot;1&quot;)  <br>    #expect(kullanici.isim == &quot;Ali&quot;)  <br>  }  <br>}</pre><h3>20. Performans İyi Pratikleri</h3><ul><li><strong>State Kapsamını Daraltma</strong>: @State&#39;i mümkün olduğunca küçük, alt View&#39;larda tutarak gereksiz yeniden çizimi azaltma</li><li><strong>Equatable Conformance</strong>: Karmaşık View’ları Equatable yaparak SwiftUI&#39;a &quot;değişmedi&quot; diyebilme imkanı verme</li><li><strong>LazyVStack/LazyHStack</strong>: Büyük listelerde tüm View’ları anında oluşturmaktan kaçınma</li></ul><pre>struct SatirGorunumu: View, Equatable {  <br>  let kullanici: Kullanici  </pre><pre>  static func == (lhs: Self, rhs: Self) -&gt; Bool {  <br>    lhs.kullanici.id == rhs.kullanici.id            // sadece id değişince yeniden çizilir  <br>  }</pre><pre>  var body: some View {  <br>    Text(kullanici.isim)  <br>  }  <br>}</pre><h3>21. Interop: UIViewRepresentable</h3><ul><li><strong>UIViewRepresentable</strong>: Klasik UIKit View’unu SwiftUI ağacına gömme protokolü</li><li><strong>UIViewControllerRepresentable</strong>: Bir UIViewController’ı SwiftUI içine gömme karşılığı</li><li><strong>Coordinator</strong>: UIKit delegate/callback’lerini SwiftUI’a köprüleyen yardımcı nesne</li></ul><pre>struct HaritaGorunumu: UIViewRepresentable {  <br>  func makeUIView(context: Context) -&gt; MKMapView {  <br>    MKMapView()  <br>  }</pre><pre>  func updateUIView(_ uiView: MKMapView, context: Context) {  <br>    // state değiştiğinde harita güncellenir  <br>  }  <br>}</pre><h3>22. Erişilebilirlik</h3><ul><li><strong>accessibilityLabel</strong>: Görsel öğelerin ekran okuyucu tarafından okunacak açıklaması</li><li><strong>accessibilityElement(children:)</strong>: Birden fazla alt elemanı tek bir erişilebilirlik birimi olarak birleştirme</li><li><strong>Dynamic Type</strong>: Kullanıcının sistem genelinde seçtiği yazı boyutuna otomatik uyum sağlama</li></ul><pre>struct DurumIkonu: View {  <br>  let aktif: Bool</pre><pre>  var body: some View {  <br>    Image(systemName: aktif ? &quot;checkmark.circle&quot; : &quot;xmark.circle&quot;)  <br>      .accessibilityLabel(aktif ? &quot;Aktif durum&quot; : &quot;Pasif durum&quot;)   // ekran okuyucu için  <br>  }  <br>}</pre><h3>23. Platformlar Arası SwiftUI</h3><ul><li><strong>Tek Kod Tabanı</strong>: Aynı SwiftUI View’larının iOS, iPadOS, macOS, watchOS ve visionOS’ta çalışabilmesi</li><li><strong>Platform-Specific Modifiers</strong>: #if os(iOS) gibi koşullu derleme ile platforma özgü davranış ekleme</li><li><strong>ViewThatFits</strong>: Farklı ekran boyutlarına göre otomatik olarak en uygun layout’u seçen konteyner</li></ul><pre>struct AdaptifEkran: View {  <br>  var body: some View {  <br>    ViewThatFits {  <br>      GenisEkranGorunumu()      // sığarsa bu kullanılır  <br>      DarEkranGorunumu()        // sığmazsa buna düşer  <br>    }  <br>  }  <br>}</pre><h3>24. State Restoration ve App Lifecycle</h3><ul><li><strong>@SceneStorage</strong>: Bir View’ın state’ini scene bazında otomatik olarak saklayıp geri yükleme</li><li><strong>ScenePhase</strong>: Uygulamanın active, inactive, background durumlarını @Environment üzerinden izleme</li></ul><pre>struct Ekran: View {  <br>  @SceneStorage(&quot;aramaMetni&quot;) private var aramaMetni = &quot;&quot;  <br>  @Environment(\.scenePhase) private var sahneDurumu</pre><pre>  var body: some View {  <br>    TextField(&quot;Ara&quot;, text: $aramaMetni)  <br>      .onChange(of: sahneDurumu) { _, yeni in  <br>        if yeni == .background { veriyiKaydet() }  <br>      }  <br>  }  <br>}</pre><h3>25. Production’da Bilinmesi Gereken Diğer Konular</h3><ul><li><strong>redacted(reason:)</strong>: Yükleme durumunda içeriği placeholder görünümüne çevirme</li><li><strong>Instruments ile SwiftUI Profiling</strong>: “SwiftUI” şablonuyla gereksiz body hesaplamalarını tespit etme</li><li><strong>App Lifecycle (SwiftUI App Protocol)</strong>: @main ile AppDelegate&#39;siz uygulama başlatma</li><li><strong>Self._printChanges()</strong>: Bir View’ın neden yeniden çizildiğini debug etmek için kullanılan iç API</li></ul><pre>@main  <br>struct UygulamaGirisi: App {  <br>  var body: some Scene {  <br>    WindowGroup {  <br>      IcerikEkrani()  <br>        .redacted(reason: yukleniyor ? .placeholder : [])  <br>    }  <br>  }  <br>}</pre><h3>Terimler Sözlüğü</h3><h3>Temel Kavramlar</h3><ul><li><strong>View Protokolü</strong>: Bir struct’ı UI üretebilen bir yapı taşına dönüştüren temel protokol.</li><li><strong>body</strong>: Her View’ın uyması gereken, some View döndüren zorunlu property.</li><li><strong>Diffing</strong>: SwiftUI’ın state değiştiğinde sadece etkilenen View’ları yeniden hesaplaması.</li><li><strong>Modifier</strong>: View’ın görünüm ve davranışını yapılandıran zincirlenebilir fonksiyon.</li></ul><h3>State Yönetimi</h3><ul><li><strong>@State</strong>: View’a ait, value type’lar için yerel state.</li><li><strong>@Binding</strong>: State’in sahipliğini almadan okuma/yazma erişimi sağlayan property wrapper.</li><li><strong>@StateObject / @ObservedObject</strong>: Bir ObservableObject&#39;in sahiplenilme ve referans alınma biçimleri.</li><li><strong>@Observable</strong>: iOS 17 ile gelen, daha granüler ve performanslı gözlemlenebilirlik sistemi.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>VStack/HStack/ZStack</strong>: SwiftUI’ın temel layout View’ları.</li><li><strong>List</strong>: Performanslı, kaydırılabilir liste oluşturan yerleşik View.</li><li><strong>ViewBuilder</strong>: Birden fazla View ifadesini tek bir some View haline getiren derleyici özelliği.</li><li><strong>Canvas</strong>: Düşük seviyeli, immediate-mode çizim API’si.</li></ul><h3>Side Effects</h3><ul><li><strong>onAppear/onDisappear</strong>: View ekrana geldiğinde/kalktığında tetiklenen effect’ler.</li><li><strong>task</strong>: View’ın yaşam döngüsüne bağlı, otomatik iptal edilen async iş başlatma modifier’ı.</li><li><strong>onChange</strong>: Bir değer değiştiğinde çalışan callback.</li></ul><h3>Ekosistem</h3><ul><li><strong>@Environment / @EnvironmentObject</strong>: Bir değeri ağaç boyunca parametre geçmeden paylaşma mekanizmaları.</li><li><strong>UIViewRepresentable</strong>: UIKit bileşenlerini SwiftUI’a köprüleyen protokol.</li><li><strong>ViewThatFits</strong>: Ekran boyutuna göre otomatik layout seçen konteyner.</li></ul><h3>Kaynaklar</h3><h3>Temel Kavramlar</h3><ul><li><strong>SwiftUI Resmi Dokümantasyon</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui">https://developer.apple.com/documentation/swiftui</a></li><li><strong>SwiftUI Tutorials</strong> =&gt; <a href="https://developer.apple.com/tutorials/swiftui">https://developer.apple.com/tutorials/swiftui</a></li><li><strong>Human Interface Guidelines</strong> =&gt; <a href="https://developer.apple.com/design/human-interface-guidelines">https://developer.apple.com/design/human-interface-guidelines</a></li></ul><h3>State Yönetimi</h3><ul><li><strong>Managing Model Data in Your App</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/managing-model-data-in-your-app">https://developer.apple.com/documentation/swiftui/managing-model-data-in-your-app</a></li><li><strong>Observation Framework</strong> =&gt; <a href="https://developer.apple.com/documentation/observation">https://developer.apple.com/documentation/observation</a></li></ul><h3>Navigation</h3><ul><li><strong>NavigationStack</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/navigationstack">https://developer.apple.com/documentation/swiftui/navigationstack</a></li></ul><h3>Animation</h3><ul><li><strong>Animations</strong> =&gt; <a href="https://developer.apple.com/documentation/swiftui/animations">https://developer.apple.com/documentation/swiftui/animations</a></li></ul><h3>Testing</h3><ul><li><strong>Swift Testing</strong> =&gt; <a href="https://developer.apple.com/documentation/testing">https://developer.apple.com/documentation/testing</a></li><li><strong>XCTest</strong> =&gt; <a href="https://developer.apple.com/documentation/xctest">https://developer.apple.com/documentation/xctest</a></li></ul><h3>Performans</h3><ul><li><strong>SwiftUI Performance (WWDC)</strong> =&gt; <a href="https://developer.apple.com/videos/play/wwdc2021/10022/">https://developer.apple.com/videos/play/wwdc2021/10022/</a></li></ul><h3>Platformlar Arası</h3><ul><li><strong>SwiftUI için Platformlar</strong> =&gt; <a href="https://developer.apple.com/xcode/swiftui/">https://developer.apple.com/xcode/swiftui/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f73dd227222e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Compose (English)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-compose-english-0772079ecd1f?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0772079ecd1f</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 11:33:27 GMT</pubDate>
            <atom:updated>2026-07-23T11:33:27.925Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFTt48yfmcsKo9tdo7f1Jw.png" /></figure><p>“This is a roadmap — you need to dive deep into each topic on your own”</p><h3>1. Composable Function Basics</h3><ul><li><strong>@Composable</strong>: an annotation that turns a function into a UI-emitting building block</li><li><strong>Declarative Approach</strong>: describing “what the UI should look like now” instead of step-by-step instructions</li><li><strong>Composable Function Rules</strong>: must be idempotent, side-effect-free, and able to run in any order/thread</li></ul><pre>@Composable  <br>fun Greeting(name: String) {  <br>  Text(text = &quot;Hello, $name!&quot;)  <br>}</pre><pre>@Composable  <br>fun App() {  <br>  Greeting(name = &quot;World&quot;)             // a composable builds the UI tree by calling other composables  <br>}</pre><h3>2. State Management: remember &amp; mutableStateOf</h3><ul><li><strong>State</strong>: data that changes over time and triggers a UI redraw in Compose</li><li><strong>remember</strong>: keeping a value in memory across recompositions</li><li><strong>mutableStateOf</strong>: an observable state holder that notifies Compose when it changes</li></ul><pre>@Composable  <br>fun Counter() {  <br>  var count by remember { mutableStateOf(0) }   // survives across recompositions</pre><pre>  Button(onClick = { count++ }) {  <br>    Text(&quot;Click count: $count&quot;)                 // redraws automatically when count changes  <br>  }  <br>}</pre><h3>3. State Hoisting</h3><ul><li><strong>State Hoisting</strong>: moving state from a child composable to its parent, making the composable stateless</li><li><strong>Purpose</strong>: reusability, testability, and a single source of truth</li></ul><pre>@Composable  <br>fun CounterScreen() {  <br>  var count by remember { mutableStateOf(0) }  <br>  Counter(value = count, onIncrement = { count++ })    // state lives in the parent  <br>}</pre><pre>@Composable  <br>fun Counter(value: Int, onIncrement: () -&gt; Unit) {     // stateless, only takes parameters  <br>  Button(onClick = onIncrement) {  <br>    Text(&quot;Value: $value&quot;)  <br>  }  <br>}</pre><h3>4. Recomposition &amp; Performance</h3><ul><li><strong>Recomposition</strong>: only the composables affected by a state change are re-run</li><li><strong>Skippability</strong>: composables whose parameters haven’t changed can skip recomposition</li><li><strong>Stable Types</strong>: types must be “stable” for the Compose compiler to know nothing has changed</li></ul><pre>@Composable  <br>fun UserList(users: List&lt;User&gt;) {  <br>  // this composable skips recomposition if the users list hasn&#39;t changed  <br>  LazyColumn {  <br>    items(users) { user -&gt;  <br>      Text(user.name)  <br>    }  <br>  }  <br>}</pre><h3>5. The Modifier System</h3><ul><li><strong>Modifier</strong>: a chainable construct that configures a composable’s size, position, behavior, and appearance from the outside</li><li><strong>Order Matters</strong>: the order of modifiers in the chain directly affects the result</li></ul><pre>@Composable  <br>fun Card() {  <br>  Box(  <br>    modifier = Modifier  <br>      .padding(16.dp)          // outer spacing first  <br>      .background(Color.Gray)  // then the background  <br>      .padding(8.dp)           // then inner spacing  <br>      .clickable { }  <br>  ) {  <br>    Text(&quot;Content&quot;)  <br>  }  <br>}</pre><h3>6. Layout Basics: Column, Row, Box</h3><ul><li><strong>Column</strong>: the core layout that arranges elements vertically</li><li><strong>Row</strong>: the core layout that arranges elements horizontally</li><li><strong>Box</strong>: a layout that stacks elements on top of each other, similar to z-index layering</li></ul><pre>@Composable  <br>fun ProfileCard() {  <br>  Column(horizontalAlignment = Alignment.CenterHorizontally) {  <br>    Box {  <br>      Image(painter = ..., contentDescription = null)  <br>      Icon(Icons.Default.Verified, contentDescription = null,  <br>        modifier = Modifier.align(Alignment.BottomEnd))  <br>    }  <br>    Row {  <br>      Text(&quot;John Doe&quot;)  <br>      Text(&quot;• Active&quot;)  <br>    }  <br>  }  <br>}</pre><h3>7. LazyColumn / LazyRow</h3><ul><li><strong>LazyColumn</strong>: a performant vertical list that only builds the elements currently visible on screen</li><li><strong>items / itemsIndexed</strong>: functions that convert list data into composables</li><li><strong>key Parameter</strong>: pinning an item’s identity to prevent unnecessary recomposition</li></ul><pre>@Composable  <br>fun UserList(users: List&lt;User&gt;) {  <br>  LazyColumn {  <br>    items(  <br>      items = users,  <br>      key = { it.id }                    // a stable identity, important for animation and performance  <br>    ) { user -&gt;  <br>      Text(user.name, modifier = Modifier.padding(8.dp))  <br>    }  <br>  }  <br>}</pre><h3>8. Navigation Compose</h3><ul><li><strong>NavController</strong>: the central controller managing transitions between screens (destinations)</li><li><strong>NavHost</strong>: the container mapping routes to their corresponding composables</li><li><strong>Type-Safe Navigation</strong>: passing arguments through serializable types in a type-safe way</li></ul><pre>@Serializable  <br>object Home</pre><pre>@Serializable  <br>data class Detail(val id: String)</pre><pre>@Composable  <br>fun AppNavigation() {  <br>  val navController = rememberNavController()  </pre><pre>  NavHost(navController = navController, startDestination = Home) {  <br>    composable&lt;Home&gt; {  <br>      HomeScreen(onClick = { id -&gt; navController.navigate(Detail(id)) })  <br>    }  <br>    composable&lt;Detail&gt; { backStackEntry -&gt;  <br>      val detail: Detail = backStackEntry.toRoute()  <br>      DetailScreen(id = detail.id)  <br>    }  <br>  }  <br>}</pre><h3>9. Side Effects: LaunchedEffect, DisposableEffect, SideEffect</h3><ul><li><strong>LaunchedEffect</strong>: an effect that launches a coroutine inside a composable, re-running when its key changes</li><li><strong>DisposableEffect</strong>: for side effects requiring cleanup when the composable leaves the screen</li><li><strong>SideEffect</strong>: an effect that runs on every successful recomposition, syncing state to non-Compose systems</li></ul><pre>@Composable  <br>fun UserScreen(id: String, viewModel: UserViewModel) {  <br>  LaunchedEffect(id) {                     // re-triggers when id changes  <br>    viewModel.loadUser(id)  <br>  }</pre><pre>  DisposableEffect(Unit) {  <br>    val listener = AnalyticsListener()  <br>    Analytics.register(listener)  <br>    onDispose { Analytics.unregister(listener) }   // cleaned up when the composable is removed  <br>  }  <br>}</pre><h3>10. remember vs rememberSaveable</h3><ul><li><strong>remember</strong>: only preserves a value across recompositions, lost on configuration change (rotation)</li><li><strong>rememberSaveable</strong>: preserves the value through configuration changes and process death by storing it in a Bundle</li></ul><pre>@Composable  <br>fun FormScreen() {  <br>  var temporary by remember { mutableStateOf(&quot;&quot;) }              // resets on rotation  <br>  var persistent by rememberSaveable { mutableStateOf(&quot;&quot;) }     // survives rotation  </pre><pre>  TextField(value = persistent, onValueChange = { persistent = it })  <br>}</pre><h3>11. CompositionLocal</h3><ul><li><strong>CompositionLocal</strong>: a mechanism for sharing a value implicitly across the composable tree without passing it as a parameter</li><li><strong>Use Case</strong>: broad, implicit dependencies like theme, locale, or density</li></ul><pre>val LocalUserTheme = compositionLocalOf { UserTheme.Default }</pre><pre>@Composable  <br>fun App() {  <br>  CompositionLocalProvider(LocalUserTheme provides UserTheme.Dark) {  <br>    ContentScreen()                         // any composable in the subtree can access it  <br>  }  <br>}</pre><pre>@Composable  <br>fun ContentScreen() {  <br>  val theme = LocalUserTheme.current        // accessed without passing a parameter  <br>}</pre><h3>12. Theming: MaterialTheme</h3><ul><li><strong>MaterialTheme</strong>: the root composable that propagates color, typography, and shape systems across the app</li><li><strong>ColorScheme</strong>: Material 3’s semantic color palette (primary, surface, onPrimary, etc.)</li><li><strong>Dynamic Color</strong>: on Android 12+, a color scheme derived from the user’s wallpaper</li></ul><pre>@Composable  <br>fun AppTheme(content: @Composable () -&gt; Unit) {  <br>  val colorScheme = if (isSystemInDarkTheme()) DarkColors else LightColors  </pre><pre>  MaterialTheme(  <br>    colorScheme = colorScheme,  <br>    typography = AppTypography,  <br>    content = content  <br>  )  <br>}</pre><h3>13. Custom Layouts</h3><ul><li><strong>Layout Composable</strong>: fully customizing the measurement and placement logic of child elements</li><li><strong>measure/placeable</strong>: measuring child elements and placing them at a calculated position</li></ul><pre>@Composable  <br>fun CustomLayout(  <br>  modifier: Modifier = Modifier,  <br>  content: @Composable () -&gt; Unit  <br>) {  <br>  Layout(modifier = modifier, content = content) { measurables, constraints -&gt;  <br>    val placeables = measurables.map { it.measure(constraints) }  <br>    layout(constraints.maxWidth, constraints.maxHeight) {  <br>      var yOffset = 0  <br>      placeables.forEach {  <br>        it.placeRelative(x = 0, y = yOffset)  <br>        yOffset += it.height  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>14. Animation: animate*AsState, AnimatedVisibility</h3><ul><li><strong>animate*AsState</strong>: an API that automatically interpolates a value’s change into an animation</li><li><strong>AnimatedVisibility</strong>: changing a composable’s visibility with enter/exit animations</li><li><strong>Transition</strong>: coordinating multiple values to manage animated state transitions</li></ul><pre>@Composable  <br>fun ExpandableCard(expanded: Boolean) {  <br>  val height by animateDpAsState(  <br>    targetValue = if (expanded) 200.dp else 80.dp,  <br>    label = &quot;height&quot;  <br>  )</pre><pre>  Box(modifier = Modifier.height(height).fillMaxWidth())  <br>}</pre><pre>@Composable  <br>fun NotificationBubble(visible: Boolean) {  <br>  AnimatedVisibility(  <br>    visible = visible,  <br>    enter = fadeIn() + slideInVertically(),  <br>    exit = fadeOut()  <br>  ) {  <br>    Text(&quot;New notification!&quot;)  <br>  }  <br>}</pre><h3>15. ViewModel Integration with Compose</h3><ul><li><strong>hiltViewModel() / viewModel()</strong>: obtaining a ViewModel instance inside a composable</li><li><strong>Collecting StateFlow</strong>: binding the ViewModel’s state to Compose state via collectAsStateWithLifecycle()</li></ul><pre>@Composable  <br>fun UserScreen(viewModel: UserViewModel = hiltViewModel()) {  <br>  val uiState by viewModel.uiState.collectAsStateWithLifecycle()</pre><pre>  when (uiState) {  <br>    is UiState.Loading -&gt; CircularProgressIndicator()  <br>    is UiState.Success -&gt; Text(uiState.user.name)  <br>    is UiState.Error -&gt; Text(&quot;Error: ${uiState.message}&quot;)  <br>  }  <br>}</pre><h3>16. Gesture Handling</h3><ul><li><strong>clickable/combinedClickable</strong>: simple click and long-press behaviors</li><li><strong>pointerInput</strong>: low-level access to touch events</li><li><strong>draggable/detectDragGestures</strong>: capturing drag gestures</li></ul><pre>@Composable  <br>fun DraggableBox() {  <br>  var offset by remember { mutableStateOf(Offset.Zero) }  </pre><pre>  Box(  <br>    modifier = Modifier  <br>      .offset { IntOffset(offset.x.roundToInt(), offset.y.roundToInt()) }  <br>      .pointerInput(Unit) {  <br>        detectDragGestures { change, drag -&gt;  <br>          change.consume()  <br>          offset += drag  <br>        }  <br>      }  <br>      .size(50.dp)  <br>      .background(Color.Blue)  <br>  )  <br>}</pre><h3>17. Canvas &amp; Custom Drawing</h3><ul><li><strong>Canvas Composable</strong>: a low-level, declarative drawing API for drawing directly</li><li><strong>DrawScope</strong>: the scope containing drawing functions like drawCircle, drawLine, drawPath</li></ul><pre>@Composable  <br>fun SimpleChart(percentage: Float) {  <br>  Canvas(modifier = Modifier.size(100.dp)) {  <br>    drawArc(  <br>      color = Color.Blue,  <br>      startAngle = -90f,  <br>      sweepAngle = 360 * percentage,  <br>      useCenter = false,  <br>      style = Stroke(width = 8.dp.toPx())  <br>    )  <br>  }  <br>}</pre><h3>18. Slot API &amp; Composable Design Patterns</h3><ul><li><strong>Slot API</strong>: making a composable’s content flexible via @Composable () -&gt; Unit lambda parameters</li><li><strong>Scaffold</strong>: the most typical example of the Slot API — defines “slots” like topBar, bottomBar, floatingActionButton</li></ul><pre>@Composable  <br>fun ScreenSkeleton(  <br>  title: @Composable () -&gt; Unit,  <br>  content: @Composable (PaddingValues) -&gt; Unit  <br>) {  <br>  Scaffold(  <br>    topBar = { TopAppBar(title = title) }  <br>  ) { padding -&gt;  <br>    content(padding)                       // the caller injects its own content  <br>  }  <br>}</pre><h3>19. Preview &amp; Tooling</h3><ul><li><strong>@Preview</strong>: an instant preview of a composable inside Android Studio without running the app</li><li><strong>PreviewParameterProvider</strong>: supplying sample data to preview the same composable with different inputs</li></ul><pre>@Preview(showBackground = true, name = &quot;Light Theme&quot;)<br>@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES, name = &quot;Dark Theme&quot;)<br>@Composable  <br>private fun CardPreview() {  <br>  AppTheme {  <br>    ProfileCard()  <br>  }  <br>}</pre><h3>20. Testing: Compose Test Rule</h3><ul><li><strong>createComposeRule</strong>: a JUnit rule class for testing composables in isolation</li><li><strong>Semantics Tree</strong>: the accessibility tree the test framework uses to find composables</li><li><strong>onNodeWithText/onNodeWithTag</strong>: locating composables by their semantic properties</li></ul><pre>class CounterTest {  <br>  @get:Rule  <br>  val composeTestRule = createComposeRule()</pre><pre>  @Test  <br>  fun counter_incrementsOnClick() {  <br>    composeTestRule.setContent { Counter() }</pre><pre>    composeTestRule.onNodeWithText(&quot;Click count: 0&quot;).assertExists()  <br>    composeTestRule.onNodeWithTag(&quot;increment_button&quot;).performClick()  <br>    composeTestRule.onNodeWithText(&quot;Click count: 1&quot;).assertExists()  <br>  }  <br>}</pre><h3>21. Performance Best Practices</h3><ul><li><strong>derivedStateOf</strong>: computing a value derived from state so recomposition only triggers when it actually changes</li><li><strong>key()</strong>: explicitly setting a composable block’s identity to control recomposition behavior</li><li><strong>Immutable/Stable Annotations</strong>: guaranteeing to the Compose compiler that a type is stable</li></ul><pre>@Composable  <br>fun ListScreen(listState: LazyListState) {  <br>  val isAtTop by remember {  <br>    derivedStateOf { listState.firstVisibleItemIndex == 0 }   // recomposes only when the boolean changes  <br>  }</pre><pre>  if (!isAtTop) {  <br>    ScrollToTopButton()  <br>  }  <br>}</pre><h3>22. Interop: AndroidView &amp; ComposeView</h3><ul><li><strong>AndroidView</strong>: embedding a classic View system component into the Compose tree</li><li><strong>ComposeView</strong>: embedding Compose UI into a classic XML-based View hierarchy</li><li><strong>Gradual Migration</strong>: adding Compose to an existing View-based app, screen by screen</li></ul><pre>@Composable  <br>fun MapView() {  <br>  AndroidView(  <br>    factory = { context -&gt; MapView(context).apply { onCreate(null) } },  <br>    update = { mapView -&gt; mapView.getMapAsync { /* map configuration */ } }  <br>  )  <br>}</pre><h3>23. Compose Multiplatform</h3><ul><li><strong>Compose Multiplatform</strong>: JetBrains’ solution bringing Compose beyond Android to iOS, Desktop, and Web</li><li><strong>Shared UI Code</strong>: the same composable code can be compiled for multiple platforms</li><li><strong>Relationship to KMP</strong>: Compose Multiplatform positions itself as Kotlin Multiplatform’s UI layer</li></ul><pre>// commonMain — compiles on all platforms<br>@Composable  <br>fun SharedScreen() {  <br>  MaterialTheme {  <br>    Text(&quot;This screen runs on Android, iOS, and Desktop&quot;)  <br>  }  <br>}</pre><h3>24. Semantics &amp; Accessibility</h3><ul><li><strong>Semantics Modifier</strong>: giving composables meaning for screen readers</li><li><strong>contentDescription</strong>: the spoken description of visual elements</li><li><strong>mergeDescendants</strong>: combining multiple child elements into a single accessibility unit</li></ul><pre>@Composable  <br>fun StatusIcon(active: Boolean) {  <br>  Icon(  <br>    imageVector = if (active) Icons.Default.Check else Icons.Default.Close,  <br>    contentDescription = if (active) &quot;Active status&quot; else &quot;Inactive status&quot;   // for screen readers  <br>  )  <br>}</pre><h3>25. Other Things You Should Know in Production</h3><ul><li><strong>Baseline Profiles</strong>: precompiling an app’s critical paths to improve startup performance</li><li><strong>Compose Compiler Metrics</strong>: compiler output reporting which composables are stable/unstable</li><li><strong>Strong Skipping Mode</strong>: a mode letting the Compose compiler skip more composables by default</li><li><strong>Layout Inspector</strong>: an Android Studio tool for live-inspecting the Compose tree and recomposition counts</li></ul><pre>// build.gradle.kts — generating compose compiler metrics reports<br>composeCompiler {  <br>  reportsDestination = layout.buildDirectory.dir(&quot;compose_compiler&quot;)  <br>  stabilityConfigurationFile = rootProject.layout.projectDirectory.file(&quot;stability_config.conf&quot;)  <br>}</pre><h3>Glossary of Terms</h3><h3>Core Concepts</h3><ul><li><strong>@Composable</strong>: an annotation that turns a function into a UI-emitting building block.</li><li><strong>Recomposition</strong>: re-running composables affected by a state change.</li><li><strong>State Hoisting</strong>: moving state from child to parent to make a composable stateless.</li><li><strong>Modifier</strong>: a chainable construct configuring a composable’s appearance and behavior.</li></ul><h3>State Management</h3><ul><li><strong>remember</strong>: keeping a value in memory across recompositions.</li><li><strong>rememberSaveable</strong>: preserving a value through configuration changes as well.</li><li><strong>derivedStateOf</strong>: computing a state-derived value in an optimized way.</li><li><strong>CompositionLocal</strong>: a mechanism for sharing a value across the tree without passing it as a parameter.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>Column/Row/Box</strong>: Compose’s core layout composables.</li><li><strong>LazyColumn</strong>: a performant list that only builds visible elements.</li><li><strong>Scaffold</strong>: the typical example of the Slot API, defining a screen’s skeleton.</li><li><strong>Canvas</strong>: a low-level, declarative drawing API.</li></ul><h3>Side Effects</h3><ul><li><strong>LaunchedEffect</strong>: an effect that launches a coroutine when its key changes.</li><li><strong>DisposableEffect</strong>: an effect performing cleanup when a composable is removed.</li><li><strong>SideEffect</strong>: an effect running on every recomposition, syncing to external systems.</li></ul><h3>Ecosystem</h3><ul><li><strong>Compose Multiplatform</strong>: JetBrains’ solution bringing Compose beyond Android.</li><li><strong>Baseline Profiles</strong>: a precompilation mechanism improving startup performance.</li><li><strong>Layout Inspector</strong>: an Android Studio tool for live-inspecting the Compose tree.</li></ul><h3>Resources</h3><h3>Core Concepts</h3><ul><li><strong>Compose Official Documentation</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/documentation">https://developer.android.com/jetpack/compose/documentation</a></li><li><strong>Thinking in Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/mental-model">https://developer.android.com/jetpack/compose/mental-model</a></li><li><strong>Compose Pathway</strong> =&gt; <a href="https://developer.android.com/courses/pathways/compose">https://developer.android.com/courses/pathways/compose</a></li></ul><h3>State Management</h3><ul><li><strong>State in Jetpack Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/state">https://developer.android.com/jetpack/compose/state</a></li><li><strong>Side Effects</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/side-effects">https://developer.android.com/jetpack/compose/side-effects</a></li></ul><h3>Navigation</h3><ul><li><strong>Navigation Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/navigation">https://developer.android.com/jetpack/compose/navigation</a></li></ul><h3>Animation</h3><ul><li><strong>Compose Animation</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/animation">https://developer.android.com/jetpack/compose/animation</a></li></ul><h3>Testing</h3><ul><li><strong>Compose Testing</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/testing">https://developer.android.com/jetpack/compose/testing</a></li></ul><h3>Performance</h3><ul><li><strong>Compose Performance</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/performance">https://developer.android.com/jetpack/compose/performance</a></li><li><strong>Baseline Profiles</strong> =&gt; <a href="https://developer.android.com/topic/performance/baselineprofiles/overview">https://developer.android.com/topic/performance/baselineprofiles/overview</a></li></ul><h3>Multiplatform</h3><ul><li><strong>Compose Multiplatform</strong> =&gt; <a href="https://www.jetbrains.com/lp/compose-multiplatform/">https://www.jetbrains.com/lp/compose-multiplatform/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0772079ecd1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Compose (Türkçe)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-compose-t%C3%BCrk%C3%A7e-fd6f8204d3af?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd6f8204d3af</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 11:33:19 GMT</pubDate>
            <atom:updated>2026-07-23T11:33:19.365Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50KSAPIMEeDAlRNqiU_a-Q.png" /></figure><p>“Bu bir yol haritasıdır, her başlığı ayrı ayrı derinlemesine çalışman gerekir”</p><h3>1. Composable Fonksiyonlar Temelleri</h3><ul><li><strong>@Composable</strong>: Bir fonksiyonu UI üretebilen bir yapı taşına dönüştüren anotasyon</li><li><strong>Deklaratif Yaklaşım</strong>: UI’ı adım adım değil, “şu anda nasıl görünmeli” şeklinde tanımlama</li><li><strong>Composable Fonksiyon Kuralları</strong>: Idempotent olmalı, side-effect’siz olmalı, herhangi bir sırada/thread’de çalışabilmeli</li></ul><pre>@Composable  <br>fun Selamla(isim: String) {  <br>  Text(text = &quot;Merhaba, $isim!&quot;)  <br>}</pre><pre>@Composable  <br>fun Uygulama() {  <br>  Selamla(isim = &quot;Dünya&quot;)             // composable, başka composable&#39;ları çağırarak UI ağacı kurar  <br>}</pre><h3>2. State Yönetimi: remember ve mutableStateOf</h3><ul><li><strong>State</strong>: Compose’da UI’ı yeniden çizdiren, zamanla değişen veri</li><li><strong>remember</strong>: Bir değeri recomposition’lar arasında hafızada tutma</li><li><strong>mutableStateOf</strong>: Değiştiğinde Compose’a haber veren gözlemlenebilir state kabı</li></ul><pre>@Composable  <br>fun Sayac() {  <br>  var sayi by remember { mutableStateOf(0) }   // recomposition&#39;lar arasında korunur</pre><pre>  Button(onClick = { sayi++ }) {  <br>    Text(&quot;Tıklama sayısı: $sayi&quot;)              // sayi değişince otomatik yeniden çizilir  <br>  }  <br>}</pre><h3>3. State Hoisting</h3><ul><li><strong>State Hoisting</strong>: State’i child composable’dan parent’a taşıyarak composable’ı stateless hale getirme</li><li><strong>Amaç</strong>: Yeniden kullanılabilirlik, test edilebilirlik ve tek kaynak (single source of truth) sağlama</li></ul><pre>@Composable  <br>fun SayacEkrani() {  <br>  var sayi by remember { mutableStateOf(0) }  <br>  Sayac(deger = sayi, onArtir = { sayi++ })    // state parent&#39;ta tutulur  <br>}</pre><pre>@Composable  <br>fun Sayac(deger: Int, onArtir: () -&gt; Unit) {   // stateless, sadece parametre alır  <br>  Button(onClick = onArtir) {  <br>    Text(&quot;Değer: $deger&quot;)  <br>  }  <br>}</pre><h3>4. Recomposition ve Performans</h3><ul><li><strong>Recomposition</strong>: State değiştiğinde sadece etkilenen composable’ların yeniden çalıştırılması</li><li><strong>Skippability</strong>: Parametreleri değişmeyen composable’ların recomposition’ı atlayabilmesi</li><li><strong>Stable Types</strong>: Compose derleyicisinin “değişmedi” diyebilmesi için tiplerin kararlı (stable) olması gerekliliği</li></ul><pre>@Composable  <br>fun Liste(kullanicilar: List&lt;Kullanici&gt;) {  <br>  // kullanicilar listesi değişmediyse bu composable recomposition&#39;ı atlar  <br>  LazyColumn {  <br>    items(kullanicilar) { kullanici -&gt;  <br>      Text(kullanici.isim)  <br>    }  <br>  }  <br>}</pre><h3>5. Modifier Sistemi</h3><ul><li><strong>Modifier</strong>: Bir composable’ın boyutunu, konumunu, davranışını ve görünümünü dışarıdan yapılandıran zincirlenebilir yapı</li><li><strong>Sıra Önemlidir</strong>: Modifier zincirindeki sıranın sonucu doğrudan etkilemesi</li></ul><pre>@Composable  <br>fun Kart() {  <br>  Box(  <br>    modifier = Modifier  <br>      .padding(16.dp)          // önce dış boşluk  <br>      .background(Color.Gray)  // sonra arkaplan  <br>      .padding(8.dp)           // sonra iç boşluk  <br>      .clickable { }  <br>  ) {  <br>    Text(&quot;İçerik&quot;)  <br>  }  <br>}</pre><h3>6. Layout Temelleri: Column, Row, Box</h3><ul><li><strong>Column</strong>: Elemanları dikey sırayla dizen temel layout</li><li><strong>Row</strong>: Elemanları yatay sırayla dizen temel layout</li><li><strong>Box</strong>: Elemanları üst üste bindiren, z-index benzeri katmanlama sağlayan layout</li></ul><pre>@Composable  <br>fun ProfilKarti() {  <br>  Column(horizontalAlignment = Alignment.CenterHorizontally) {  <br>    Box {  <br>      Image(painter = ..., contentDescription = null)  <br>      Icon(Icons.Default.Verified, contentDescription = null,  <br>        modifier = Modifier.align(Alignment.BottomEnd))  <br>    }  <br>    Row {  <br>      Text(&quot;Ali Veli&quot;)  <br>      Text(&quot;• Aktif&quot;)  <br>    }  <br>  }  <br>}</pre><h3>7. LazyColumn / LazyRow</h3><ul><li><strong>LazyColumn</strong>: Sadece ekranda görünen elemanları oluşturan, performanslı dikey liste</li><li><strong>items / itemsIndexed</strong>: Liste verisini composable’lara dönüştüren fonksiyonlar</li><li><strong>key Parametresi</strong>: Öğelerin kimliğini sabitleyerek gereksiz recomposition’ı önleme</li></ul><pre>@Composable  <br>fun KullaniciListesi(kullanicilar: List&lt;Kullanici&gt;) {  <br>  LazyColumn {  <br>    items(  <br>      items = kullanicilar,  <br>      key = { it.id }                    // stabil kimlik, animasyon ve performans için önemli  <br>    ) { kullanici -&gt;  <br>      Text(kullanici.isim, modifier = Modifier.padding(8.dp))  <br>    }  <br>  }  <br>}</pre><h3>8. Navigation Compose</h3><ul><li><strong>NavController</strong>: Ekranlar (destination) arası geçişi yöneten merkezi kontrolcü</li><li><strong>NavHost</strong>: Rotaları ve karşılık gelen composable’ları eşleştiren konteyner</li><li><strong>Type-Safe Navigation</strong>: Argümanları serialize edilebilir tiplerle tip güvenli şekilde geçme</li></ul><pre>@Serializable  <br>object AnaSayfa</pre><pre>@Serializable  <br>data class Detay(val id: String)</pre><pre>@Composable  <br>fun UygulamaNavigasyonu() {  <br>  val navController = rememberNavController()  </pre><pre>  NavHost(navController = navController, startDestination = AnaSayfa) {  <br>    composable&lt;AnaSayfa&gt; {  <br>      AnaSayfaEkrani(onTikla = { id -&gt; navController.navigate(Detay(id)) })  <br>    }  <br>    composable&lt;Detay&gt; { backStackEntry -&gt;  <br>      val detay: Detay = backStackEntry.toRoute()  <br>      DetayEkrani(id = detay.id)  <br>    }  <br>  }  <br>}</pre><h3>9. Side Effects: LaunchedEffect, DisposableEffect, SideEffect</h3><ul><li><strong>LaunchedEffect</strong>: Composable içinde coroutine başlatan, anahtar değiştiğinde yeniden çalışan effect</li><li><strong>DisposableEffect</strong>: Composable ekrandan kaldırıldığında temizlik (cleanup) gerektiren yan etkiler için</li><li><strong>SideEffect</strong>: Her başarılı recomposition’da çalışan, Compose dışı sistemlere state senkronize eden effect</li></ul><pre>@Composable  <br>fun KullaniciEkrani(id: String, viewModel: KullaniciViewModel) {  <br>  LaunchedEffect(id) {                     // id değiştiğinde yeniden tetiklenir  <br>    viewModel.kullaniciGetir(id)  <br>  }</pre><pre>  DisposableEffect(Unit) {  <br>    val listener = AnalyticsListener()  <br>    Analytics.kaydet(listener)  <br>    onDispose { Analytics.kaldir(listener) }   // composable kaldırılınca temizlenir  <br>  }  <br>}</pre><h3>10. remember vs rememberSaveable</h3><ul><li><strong>remember</strong>: Değeri sadece recomposition’lar arasında korur, configuration change’de (döndürme) kaybolur</li><li><strong>rememberSaveable</strong>: Değeri Bundle içinde saklayarak configuration change ve process death&#39;te de korur</li></ul><pre>@Composable  <br>fun FormEkrani() {  <br>  var gecici by remember { mutableStateOf(&quot;&quot;) }              // ekran döndürülünce sıfırlanır  <br>  var kalici by rememberSaveable { mutableStateOf(&quot;&quot;) }      // ekran döndürülünce korunur  </pre><pre>  TextField(value = kalici, onValueChange = { kalici = it })  <br>}</pre><h3>11. CompositionLocal</h3><ul><li><strong>CompositionLocal</strong>: Bir değeri composable ağacında parametre geçmeden dolaylı olarak paylaşma mekanizması</li><li><strong>Kullanım Alanı</strong>: Tema, yerel ayar (locale), yoğunluk (density) gibi geniş kapsamlı, örtük bağımlılıklar</li></ul><pre>val LocalKullaniciTemasi = compositionLocalOf { KullaniciTemasi.Varsayilan }</pre><pre>@Composable  <br>fun Uygulama() {  <br>  CompositionLocalProvider(LocalKullaniciTemasi provides KullaniciTemasi.Koyu) {  <br>    IcerikEkrani()                         // alt ağaçtaki tüm composable&#39;lar erişebilir  <br>  }  <br>}</pre><pre>@Composable  <br>fun IcerikEkrani() {  <br>  val tema = LocalKullaniciTemasi.current   // parametre geçmeden erişim  <br>}</pre><h3>12. Theming: MaterialTheme</h3><ul><li><strong>MaterialTheme</strong>: Renk, tipografi ve şekil sistemini tüm uygulamaya yayan kök composable</li><li><strong>ColorScheme</strong>: Material 3&#39;ün semantik renk paleti (primary, surface, onPrimary vb.)</li><li><strong>Dynamic Color</strong>: Android 12+’ta kullanıcının duvar kağıdından türetilen renk şeması</li></ul><pre>@Composable  <br>fun UygulamaTemasi(icerik: @Composable () -&gt; Unit) {  <br>  val renkSemasi = if (isSystemInDarkTheme()) KoyuRenkler else AcikRenkler  </pre><pre>  MaterialTheme(  <br>    colorScheme = renkSemasi,  <br>    typography = UygulamaTipografisi,  <br>    content = icerik  <br>  )  <br>}</pre><h3>13. Custom Layouts</h3><ul><li><strong>Layout Composable</strong>: Elemanların ölçüm ve yerleşim mantığını tamamen özelleştirme</li><li><strong>measure/placeable</strong>: Çocuk elemanları ölçüp, hesaplanan konuma yerleştirme</li></ul><pre>@Composable  <br>fun OzelLayout(  <br>  modifier: Modifier = Modifier,  <br>  content: @Composable () -&gt; Unit  <br>) {  <br>  Layout(modifier = modifier, content = content) { olculebilirler, kisitlar -&gt;  <br>    val yerlestirilebilirler = olculebilirler.map { it.measure(kisitlar) }  <br>    layout(kisitlar.maxWidth, kisitlar.maxHeight) {  <br>      var yOfset = 0  <br>      yerlestirilebilirler.forEach {  <br>        it.placeRelative(x = 0, y = yOfset)  <br>        yOfset += it.height  <br>      }  <br>    }  <br>  }  <br>}</pre><h3>14. Animation: animate*AsState, AnimatedVisibility</h3><ul><li><strong>animate*AsState</strong>: Bir değerin değişimini otomatik olarak animasyonlu şekilde interpolate eden API</li><li><strong>AnimatedVisibility</strong>: Bir composable’ın görünürlüğünü enter/exit animasyonlarıyla değiştirme</li><li><strong>Transition</strong>: Birden fazla değeri koordine ederek animasyonlu state geçişleri yönetme</li></ul><pre>@Composable  <br>fun GenislesenKart(genisletildi: Boolean) {  <br>  val yukseklik by animateDpAsState(  <br>    targetValue = if (genisletildi) 200.dp else 80.dp,  <br>    label = &quot;yukseklik&quot;  <br>  )</pre><pre>  Box(modifier = Modifier.height(yukseklik).fillMaxWidth())  <br>}</pre><pre>@Composable  <br>fun BildirimBaloncugu(gorunur: Boolean) {  <br>  AnimatedVisibility(  <br>    visible = gorunur,  <br>    enter = fadeIn() + slideInVertically(),  <br>    exit = fadeOut()  <br>  ) {  <br>    Text(&quot;Yeni bildirim!&quot;)  <br>  }  <br>}</pre><h3>15. ViewModel ile Compose Entegrasyonu</h3><ul><li><strong>hiltViewModel() / viewModel()</strong>: Bir composable içinde ViewModel örneği alma</li><li><strong>StateFlow ile Collect</strong>: ViewModel’deki state’i collectAsStateWithLifecycle() ile Compose state&#39;ine bağlama</li></ul><pre>@Composable  <br>fun KullaniciEkrani(viewModel: KullaniciViewModel = hiltViewModel()) {  <br>  val uiState by viewModel.uiState.collectAsStateWithLifecycle()</pre><pre>  when (uiState) {  <br>    is UiState.Yukleniyor -&gt; CircularProgressIndicator()  <br>    is UiState.Basarili -&gt; Text(uiState.kullanici.isim)  <br>    is UiState.Hata -&gt; Text(&quot;Hata: ${uiState.mesaj}&quot;)  <br>  }  <br>}</pre><h3>16. Gesture Handling</h3><ul><li><strong>clickable/combinedClickable</strong>: Basit tıklama ve uzun basma davranışları</li><li><strong>pointerInput</strong>: Dokunma olaylarına düşük seviyeli erişim</li><li><strong>draggable/detectDragGestures</strong>: Sürükleme hareketlerini yakalama</li></ul><pre>@Composable  <br>fun SurukleneblirKutu() {  <br>  var ofset by remember { mutableStateOf(Offset.Zero) }  </pre><pre>  Box(  <br>    modifier = Modifier  <br>      .offset { IntOffset(ofset.x.roundToInt(), ofset.y.roundToInt()) }  <br>      .pointerInput(Unit) {  <br>        detectDragGestures { change, surukleme -&gt;  <br>          change.consume()  <br>          ofset += surukleme  <br>        }  <br>      }  <br>      .size(50.dp)  <br>      .background(Color.Blue)  <br>  )  <br>}</pre><h3>17. Canvas ve Custom Drawing</h3><ul><li><strong>Canvas Composable</strong>: Doğrudan çizim yapmak için düşük seviyeli, deklaratif çizim API’si</li><li><strong>DrawScope</strong>: drawCircle, drawLine, drawPath gibi çizim fonksiyonlarının bulunduğu kapsam</li></ul><pre>@Composable  <br>fun BasitGrafik(yuzde: Float) {  <br>  Canvas(modifier = Modifier.size(100.dp)) {  <br>    drawArc(  <br>      color = Color.Blue,  <br>      startAngle = -90f,  <br>      sweepAngle = 360 * yuzde,  <br>      useCenter = false,  <br>      style = Stroke(width = 8.dp.toPx())  <br>    )  <br>  }  <br>}</pre><h3>18. Slot API ve Composable Design Patterns</h3><ul><li><strong>Slot API</strong>: Bir composable’ın içeriğini @Composable () -&gt; Unit lambda parametreleriyle esnek hale getirme</li><li><strong>Scaffold</strong>: Slot API’nin en tipik örneği — topBar, bottomBar, floatingActionButton gibi “boşluklar” tanımlar</li></ul><pre>@Composable  <br>fun EkranIskeleti(  <br>  baslik: @Composable () -&gt; Unit,  <br>  icerik: @Composable (PaddingValues) -&gt; Unit  <br>) {  <br>  Scaffold(  <br>    topBar = { TopAppBar(title = baslik) }  <br>  ) { padding -&gt;  <br>    icerik(padding)                       // çağıran, kendi içeriğini enjekte eder  <br>  }  <br>}</pre><h3>19. Preview ve Tooling</h3><ul><li><strong>@Preview</strong>: Composable’ı çalıştırmadan Android Studio içinde anlık önizleme</li><li><strong>PreviewParameterProvider</strong>: Aynı composable’ı farklı verilerle önizlemek için örnek veri sağlama</li></ul><pre>@Preview(showBackground = true, name = &quot;Açık Tema&quot;)<br>@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES, name = &quot;Koyu Tema&quot;)<br>@Composable  <br>private fun KartOnizleme() {  <br>  UygulamaTemasi {  <br>    ProfilKarti()  <br>  }  <br>}</pre><h3>20. Testing: Compose Test Rule</h3><ul><li><strong>createComposeRule</strong>: Composable’ları izole şekilde test etmeye yarayan JUnit kural sınıfı</li><li><strong>Semantics Tree</strong>: Test framework’ünün composable’ları bulmak için kullandığı erişilebilirlik ağacı</li><li><strong>onNodeWithText/onNodeWithTag</strong>: Composable’ları semantic özelliklerine göre bulma</li></ul><pre>class SayacTest {  <br>  @get:Rule  <br>  val composeTestRule = createComposeRule()</pre><pre>  @Test  <br>  fun sayacTiklaninca_artmali() {  <br>    composeTestRule.setContent { Sayac() }</pre><pre>    composeTestRule.onNodeWithText(&quot;Tıklama sayısı: 0&quot;).assertExists()  <br>    composeTestRule.onNodeWithTag(&quot;artir_butonu&quot;).performClick()  <br>    composeTestRule.onNodeWithText(&quot;Tıklama sayısı: 1&quot;).assertExists()  <br>  }  <br>}</pre><h3>21. Performans İyi Pratikleri</h3><ul><li><strong>derivedStateOf</strong>: Bir state’ten türetilen değeri, sadece gerçekten değiştiğinde recomposition tetikleyecek şekilde hesaplama</li><li><strong>key()</strong>: Bir composable bloğunun kimliğini açıkça belirterek recomposition davranışını kontrol etme</li><li><strong>Immutable/Stable Anotasyonları</strong>: Compose derleyicisine bir tipin kararlı olduğunu garanti etme</li></ul><pre>@Composable  <br>fun ListeEkrani(listState: LazyListState) {  <br>  val enUsteGorunurMu by remember {  <br>    derivedStateOf { listState.firstVisibleItemIndex == 0 }   // sadece boolean değişince recomposition  <br>  }</pre><pre>  if (!enUsteGorunurMu) {  <br>    YukariCikButonu()  <br>  }  <br>}</pre><h3>22. Interop: AndroidView ve ComposeView</h3><ul><li><strong>AndroidView</strong>: Klasik View sistemindeki bir bileşeni Compose ağacına gömme</li><li><strong>ComposeView</strong>: Compose UI’ı klasik XML tabanlı bir View hiyerarşisine gömme</li><li><strong>Kademeli Geçiş</strong>: Mevcut bir View tabanlı uygulamaya ekran ekran Compose ekleyebilme</li></ul><pre>@Composable  <br>fun HaritaGorunumu() {  <br>  AndroidView(  <br>    factory = { context -&gt; MapView(context).apply { onCreate(null) } },  <br>    update = { mapView -&gt; mapView.getMapAsync { /* harita yapılandırma */ } }  <br>  )  <br>}</pre><h3>23. Compose Multiplatform</h3><ul><li><strong>Compose Multiplatform</strong>: JetBrains’in Compose’u Android dışında iOS, Desktop ve Web’e taşıyan çözümü</li><li><strong>Ortak UI Kod Paylaşımı</strong>: Aynı composable kodunun birden fazla platformda derlenebilmesi</li><li><strong>KMP ile İlişki</strong>: Compose Multiplatform’un, Kotlin Multiplatform’un UI katmanı olarak konumlanması</li></ul><pre>// commonMain — tüm platformlarda derlenir<br>@Composable  <br>fun OrtakEkran() {  <br>  MaterialTheme {  <br>    Text(&quot;Bu ekran Android, iOS ve Desktop&#39;ta çalışır&quot;)  <br>  }  <br>}</pre><h3>24. Semantics ve Erişilebilirlik</h3><ul><li><strong>Semantics Modifier</strong>: Composable’lara ekran okuyucular için anlam kazandırma</li><li><strong>contentDescription</strong>: Görsel öğelerin sesli okunacak açıklaması</li><li><strong>mergeDescendants</strong>: Birden fazla alt elemanı tek bir erişilebilirlik birimi olarak birleştirme</li></ul><pre>@Composable  <br>fun DurumIkonu(aktif: Boolean) {  <br>  Icon(  <br>    imageVector = if (aktif) Icons.Default.Check else Icons.Default.Close,  <br>    contentDescription = if (aktif) &quot;Aktif durum&quot; else &quot;Pasif durum&quot;   // ekran okuyucu için  <br>  )  <br>}</pre><h3>25. Production’da Bilinmesi Gereken Diğer Konular</h3><ul><li><strong>Baseline Profiles</strong>: Uygulamanın kritik yollarını önceden derleyerek başlangıç performansını iyileştirme</li><li><strong>Compose Compiler Metrics</strong>: Hangi composable’ların stable/unstable olduğunu raporlayan derleyici çıktıları</li><li><strong>Strong Skipping Mode</strong>: Compose derleyicisinin varsayılan olarak daha fazla composable’ı atlayabilmesini sağlayan mod</li><li><strong>Layout Inspector</strong>: Compose ağacını ve recomposition sayaçlarını canlı inceleyen Android Studio aracı</li></ul><pre>// build.gradle.kts — compose compiler metrics raporu üretme<br>composeCompiler {  <br>  reportsDestination = layout.buildDirectory.dir(&quot;compose_compiler&quot;)  <br>  stabilityConfigurationFile = rootProject.layout.projectDirectory.file(&quot;stability_config.conf&quot;)  <br>}</pre><h3>Terimler Sözlüğü</h3><h3>Temel Kavramlar</h3><ul><li><strong>@Composable</strong>: Bir fonksiyonu UI üretebilen bir yapı taşına dönüştüren anotasyon.</li><li><strong>Recomposition</strong>: State değiştiğinde etkilenen composable’ların yeniden çalıştırılması.</li><li><strong>State Hoisting</strong>: State’i child’dan parent’a taşıyarak composable’ı stateless hale getirme.</li><li><strong>Modifier</strong>: Composable’ın görünüm ve davranışını yapılandıran zincirlenebilir yapı.</li></ul><h3>State Yönetimi</h3><ul><li><strong>remember</strong>: Bir değeri recomposition’lar arasında hafızada tutma.</li><li><strong>rememberSaveable</strong>: Değeri configuration change’de de koruma.</li><li><strong>derivedStateOf</strong>: Bir state’ten türetilen değeri optimize edilmiş şekilde hesaplama.</li><li><strong>CompositionLocal</strong>: Bir değeri ağaç boyunca parametre geçmeden paylaşma mekanizması.</li></ul><h3>Layout &amp; UI</h3><ul><li><strong>Column/Row/Box</strong>: Compose’un temel layout composable’ları.</li><li><strong>LazyColumn</strong>: Sadece görünen elemanları oluşturan performanslı liste.</li><li><strong>Scaffold</strong>: Slot API’nin tipik örneği, ekran iskeletini tanımlar.</li><li><strong>Canvas</strong>: Düşük seviyeli, deklaratif çizim API’si.</li></ul><h3>Side Effects</h3><ul><li><strong>LaunchedEffect</strong>: Anahtar değiştiğinde coroutine başlatan effect.</li><li><strong>DisposableEffect</strong>: Composable kaldırıldığında temizlik yapan effect.</li><li><strong>SideEffect</strong>: Her recomposition’da çalışan, dış sistemlere senkronize eden effect.</li></ul><h3>Ekosistem</h3><ul><li><strong>Compose Multiplatform</strong>: Compose’u Android dışına taşıyan JetBrains çözümü.</li><li><strong>Baseline Profiles</strong>: Başlangıç performansını iyileştiren önceden derleme mekanizması.</li><li><strong>Layout Inspector</strong>: Compose ağacını canlı inceleyen Android Studio aracı.</li></ul><h3>Kaynaklar</h3><h3>Temel Kavramlar</h3><ul><li><strong>Compose Resmi Dokümantasyon</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/documentation">https://developer.android.com/jetpack/compose/documentation</a></li><li><strong>Thinking in Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/mental-model">https://developer.android.com/jetpack/compose/mental-model</a></li><li><strong>Compose Pathway</strong> =&gt; <a href="https://developer.android.com/courses/pathways/compose">https://developer.android.com/courses/pathways/compose</a></li></ul><h3>State Yönetimi</h3><ul><li><strong>State ve Jetpack Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/state">https://developer.android.com/jetpack/compose/state</a></li><li><strong>Side Effects</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/side-effects">https://developer.android.com/jetpack/compose/side-effects</a></li></ul><h3>Navigation</h3><ul><li><strong>Navigation Compose</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/navigation">https://developer.android.com/jetpack/compose/navigation</a></li></ul><h3>Animation</h3><ul><li><strong>Compose Animation</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/animation">https://developer.android.com/jetpack/compose/animation</a></li></ul><h3>Testing</h3><ul><li><strong>Compose Testing</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/testing">https://developer.android.com/jetpack/compose/testing</a></li></ul><h3>Performans</h3><ul><li><strong>Compose Performance</strong> =&gt; <a href="https://developer.android.com/jetpack/compose/performance">https://developer.android.com/jetpack/compose/performance</a></li><li><strong>Baseline Profiles</strong> =&gt; <a href="https://developer.android.com/topic/performance/baselineprofiles/overview">https://developer.android.com/topic/performance/baselineprofiles/overview</a></li></ul><h3>Multiplatform</h3><ul><li><strong>Compose Multiplatform</strong> =&gt; <a href="https://www.jetbrains.com/lp/compose-multiplatform/">https://www.jetbrains.com/lp/compose-multiplatform/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd6f8204d3af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Dart (Türkçe)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-dart-t%C3%BCrk%C3%A7e-e4292fb5df1c?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4292fb5df1c</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 13:34:57 GMT</pubDate>
            <atom:updated>2026-07-20T13:34:57.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-MLBz9p3iMjV7NlpdII2A.png" /></figure><p>“Bu bir yol haritasıdır, her başlığı ayrı ayrı derinlemesine çalışman gerekir”</p><h3>1. Temel Söz Dizimi ve Tip Sistemi</h3><ul><li><strong>var vs final vs const</strong>: var çıkarımlı ve değiştirilebilir, final bir kez atanan, const derleme zamanı sabiti</li><li><strong>Type Inference</strong>: Dart’ın çoğu durumda tipi otomatik çıkarması</li><li><strong>Sound Type System</strong>: Dart’ın çalışma zamanında da garanti edilen, “sound” statik tip sistemi</li></ul><pre>var isim = &quot;Ahmet&quot;;              // çıkarımlı tip (String)<br>final yas = 28;                  // bir kez atanır, sonra değiştirilemez<br>const pi = 3.14159;               // derleme zamanı sabiti</pre><pre>int sayac = 0;                    // açık tip belirtimi</pre><h3>2. Null Safety</h3><ul><li><strong>?</strong>: Bir değişkenin null olabileceğini belirten nullable tip</li><li><strong>!</strong>: Non-null assertion — null ise runtime&#39;da hata fırlatır</li><li><strong>?? ve </strong><strong>??=</strong>: Null durumunda varsayılan değer atama/verme</li><li><strong>late</strong>: Geç başlatılan ama non-null olarak işaretlenen değişkenler</li></ul><pre>String? isim;</pre><pre>int uzunluk = isim?.length ?? 0;      // null ise 0<br>int kesin = isim!.length;             // null ise hata</pre><pre>isim ??= &quot;Varsayılan İsim&quot;;           // sadece null ise ata</pre><pre>late String apiKey;                   // sonradan atanacak, non-null garantisi<br>apiKey = &quot;gizli-anahtar&quot;;</pre><h3>3. Fonksiyonlar</h3><ul><li><strong>Positional/Named/Optional Parameters</strong>: {required this.x}, [opsiyonel] parametre türleri</li><li><strong>Arrow Functions</strong>: =&gt; ile tek ifadeli fonksiyonlar</li><li><strong>Fonksiyonlar Birinci Sınıf Vatandaş</strong>: Değişkene atanabilir, parametre olarak geçilebilir</li></ul><pre>String selamla(String isim, {String mesaj = &quot;Merhaba&quot;}) {  <br>  return &quot;$mesaj, $isim!&quot;;  <br>}</pre><pre>selamla(&quot;Ayşe&quot;);                          // &quot;Merhaba, Ayşe!&quot;<br>selamla(&quot;Ayşe&quot;, mesaj: &quot;Selam&quot;);          // named parameter</pre><pre>int ikiKati(int x) =&gt; x * 2;              // arrow function</pre><pre>void Function(String) logger = (mesaj) =&gt; print(&quot;[LOG] $mesaj&quot;);</pre><h3>4. Kontrol Yapıları</h3><ul><li><strong>switch</strong>: Dart 3 ile pattern matching desteği kazanan, exhaustive kontrol sağlayabilen yapı</li><li><strong>for-in ve Iterable</strong>: Koleksiyonlar üzerinde döngü kurma</li><li><strong>Collection if/for</strong>: Liste/map tanımlarken koşullu ve döngülü eleman ekleme</li></ul><pre>String tanımla(Object x) =&gt; switch (x) {  <br>  int n when n &gt; 0 =&gt; &quot;Pozitif sayı: $n&quot;,  <br>  String s =&gt; &quot;Metin: $s&quot;,  <br>  _ =&gt; &quot;Bilinmiyor&quot;,  <br>};</pre><pre>final liste = [  <br>  1, 2, 3,  <br>  if (true) 4,                            // collection if  <br>  for (var i in [5, 6]) i * 10,           // collection for  <br>];</pre><h3>5. Sınıflar ve Nesneler</h3><ul><li><strong>Property’ler</strong>: Alan tanımlama, getter/setter ile özelleştirme</li><li><strong>this</strong>: Constructor parametrelerinde this.alan kısayolu</li><li><strong>Class Modifiers (Dart 3)</strong>: final, sealed, interface, base gibi sınıf davranışını kısıtlayan anahtar kelimeler</li></ul><pre>class Kullanici {  <br>  final String id;  <br>  String isim;</pre><pre>  Kullanici(this.id, this.isim);          // constructor kısayolu</pre><pre>  String get kisaltilmisIsim =&gt; isim.substring(0, 3);  <br>}</pre><pre>sealed class Sekil {}                     // Dart 3: sınırlı alt sınıf kümesi<br>final class Daire extends Sekil {}        // final: dışarıda extend edilemez</pre><h3>6. Constructor Çeşitleri</h3><ul><li><strong>Named Constructor</strong>: Kullanici.bos() gibi isimli, alternatif oluşturucular</li><li><strong>Factory Constructor</strong>: Her zaman yeni bir örnek dönmek zorunda olmayan, mantık içerebilen constructor</li><li><strong>Redirecting Constructor</strong>: Bir constructor’ın başka bir constructor’a yönlendirmesi</li></ul><pre>class Kullanici {  <br>  final String id;  <br>  final String isim;</pre><pre>  Kullanici(this.id, this.isim);</pre><pre>  Kullanici.bos() : this(&quot;0&quot;, &quot;İsimsiz&quot;);         // redirecting constructor</pre><pre>  factory Kullanici.fromJson(Map&lt;String, dynamic&gt; json) {  <br>    return Kullanici(json[&#39;id&#39;], json[&#39;isim&#39;]);   // koşullu/işlenmiş oluşturma  <br>  }  <br>}</pre><h3>7. Mixins</h3><ul><li><strong>mixin</strong>: Birden fazla sınıftan davranış “karıştırma”, çoklu kalıtımın Dart’taki karşılığı</li><li><strong>with</strong>: Bir sınıfa mixin uygulama anahtar kelimesi</li><li><strong>on</strong>: Mixin’in sadece belirli bir tip üzerinde kullanılabilmesini zorunlu kılma</li></ul><pre>mixin Ucabilen {  <br>  void uc() =&gt; print(&quot;Uçuyorum!&quot;);  <br>}</pre><pre>mixin Yuzebilen {  <br>  void yuz() =&gt; print(&quot;Yüzüyorum!&quot;);  <br>}</pre><pre>class Ordek with Ucabilen, Yuzebilen {}   // her iki davranışı da alır</pre><pre>final ordek = Ordek();<br>ordek.uc();<br>ordek.yuz();</pre><h3>8. Extension Methods</h3><ul><li><strong>extension</strong>: Var olan bir tipe (kendi yazmadığın tipler dahil) dışarıdan yeni fonksiyonellik ekleme</li></ul><pre>extension IntEklentileri on int {  <br>  int get ikiKati =&gt; this * 2;  </pre><pre>  bool get ciftMi =&gt; this % 2 == 0;  <br>}</pre><pre>print(5.ikiKati);      // 10<br>print(4.ciftMi);        // true</pre><h3>9. Abstract Class ve Interface</h3><ul><li><strong>Abstract Class</strong>: Doğrudan örneklenemeyen, ortak davranış taşıyan temel sınıf</li><li><strong>implements</strong>: Dart’ta her sınıf zımnen bir interface’tir, implements ile tüm üyeler yeniden yazılmak zorunda</li><li><strong>abstract interface class (Dart 3)</strong>: Sadece interface amacıyla kullanılacak sınıfları açıkça işaretleme</li></ul><pre>abstract class Depo {  <br>  void kaydet(String veri);  <br>}</pre><pre>class DosyaDeposu implements Depo {  <br>  @override  <br>  void kaydet(String veri) =&gt; print(&quot;Dosyaya kaydedildi: $veri&quot;);  <br>}</pre><pre>abstract interface class Loglanabilir {  <br>  void logAt(String mesaj);  <br>}</pre><h3>10. Kalıtım ve Polimorfizm</h3><ul><li><strong>extends</strong>: Tek bir sınıftan kalıtım alma</li><li><strong>@override</strong>: Üst sınıftaki metodu yeniden tanımlama</li><li><strong>super</strong>: Üst sınıfın implementasyonuna erişim</li></ul><pre>class Sekil {  <br>  double alan() =&gt; 0.0;  <br>}</pre><pre>class Daire extends Sekil {  <br>  final double yaricap;  <br>  Daire(this.yaricap);</pre><pre>  @override  <br>  double alan() =&gt; 3.14159 * yaricap * yaricap;  <br>}</pre><pre>final sekiller = &lt;Sekil&gt;[Sekil(), Daire(3)];<br>for (final s in sekiller) print(s.alan());   // polimorfizm</pre><h3>11. Generics</h3><ul><li><strong>Generic Sınıflar ve Fonksiyonlar</strong>: Tip parametresi alan yapılar</li><li><strong>Bounded Types</strong>: &lt;T extends Comparable&gt; gibi generic tipe sınır koyma</li></ul><pre>class Kutu&lt;T&gt; {  <br>  final T icerik;  <br>  Kutu(this.icerik);  <br>}</pre><pre>T buyukOlani&lt;T extends Comparable&lt;T&gt;&gt;(T a, T b) {  <br>  return a.compareTo(b) &gt; 0 ? a : b;  <br>}</pre><pre>final stringKutu = Kutu&lt;String&gt;(&quot;merhaba&quot;);<br>final intKutu = Kutu&lt;int&gt;(42);</pre><h3>12. Collections ve Functional Operasyonlar</h3><ul><li><strong>List, Set, Map</strong>: Dart’ın temel koleksiyon tipleri</li><li><strong>map, where, reduce</strong>: Zincirleme fonksiyonel dönüşümler</li><li><strong>Spread Operator (</strong><strong>...)</strong>: Bir koleksiyonun elemanlarını başka bir koleksiyona açma</li></ul><pre>final kullanicilar = [  <br>  {&#39;isim&#39;: &#39;Ali&#39;, &#39;aktif&#39;: true},  <br>  {&#39;isim&#39;: &#39;Ayşe&#39;, &#39;aktif&#39;: false},  <br>];</pre><pre>final aktifIsimler = kullanicilar  <br>  .where((k) =&gt; k[&#39;aktif&#39;] == true)  <br>  .map((k) =&gt; k[&#39;isim&#39;])  <br>  .toList();</pre><pre>final liste1 = [1, 2, 3];<br>final liste2 = [0, ...liste1, 4];        // [0, 1, 2, 3, 4]</pre><h3>13. Closures ve Higher-Order Functions</h3><ul><li><strong>Anonymous Function</strong>: (x) { return x * 2; } gibi isimsiz fonksiyon</li><li><strong>Closure</strong>: Bir fonksiyonun tanımlandığı scope’taki değişkenleri “yakalayabilmesi”</li><li><strong>Higher-Order Function</strong>: Fonksiyon alan veya döndüren fonksiyon</li></ul><pre>Function sayacUret() {  <br>  int sayi = 0;  <br>  return () {  <br>    sayi++;                    // dış scope&#39;taki &#39;sayi&#39; değişkenini yakalar  <br>    return sayi;  <br>  };  <br>}</pre><pre>final sayac = sayacUret();<br>print(sayac());   // 1<br>print(sayac());   // 2</pre><pre>int uygula(int x, int Function(int) islem) =&gt; islem(x);<br>print(uygula(5, (x) =&gt; x * x));   // 25</pre><h3>14. Cascade Notation (..) ve Diğer Operatörler</h3><ul><li><strong>Cascade (</strong><strong>..)</strong>: Aynı nesne üzerinde art arda metod çağırma, her seferinde nesneyi tekrar yazmadan</li><li><strong>Null-aware Cascade (</strong><strong>?..)</strong>: Nesne null olabileceğinde güvenli cascade</li><li><strong>Spread ve Null-aware Spread</strong>: Koleksiyon birleştirmede kullanılan operatörler</li></ul><pre>final buffer = StringBuffer()  <br>  ..write(&quot;Merhaba&quot;)  <br>  ..write(&quot;, &quot;)  <br>  ..write(&quot;Dünya!&quot;);             // her satır aynı buffer üzerinde çalışır</pre><pre>print(buffer.toString());        // &quot;Merhaba, Dünya!&quot;</pre><h3>15. late ve static</h3><ul><li><strong>late</strong>: Bir değişkenin geç başlatılacağını ama non-null olacağını garanti etme</li><li><strong>late final</strong>: Sadece bir kez, ama geç atanabilen değişken</li><li><strong>static</strong>: Sınıfa bağlı, örneğe bağlı olmayan üyeler</li></ul><pre>class VeriYoneticisi {  <br>  late final List&lt;int&gt; agirVeri = _hesapla();   // sadece ilk erişimde çalışır</pre><pre>  List&lt;int&gt; _hesapla() {  <br>    print(&quot;Hesaplanıyor...&quot;);  <br>    return List.generate(1000, (i) =&gt; i * i);  <br>  }</pre><pre>  static int ornekSayisi = 0;                    // tüm örnekler arasında paylaşılır  <br>}</pre><h3>16. Enum (Enhanced Enums)</h3><ul><li><strong>Klasik Enum</strong>: Sabit bir değer kümesi</li><li><strong>Enhanced Enum (Dart 2.17+)</strong>: Constructor, metod ve property taşıyabilen zenginleştirilmiş enum’lar</li></ul><pre>enum Yon { kuzey, guney, dogu, bati }</pre><pre>enum Gezegen {  <br>  merkur(kutle: 3.3e23, yaricap: 2439.7),  <br>  dunya(kutle: 5.9e24, yaricap: 6371.0);</pre><pre>  final double kutle;  <br>  final double yaricap;  </pre><pre>  const Gezegen({required this.kutle, required this.yaricap});</pre><pre>  double get yercekimi =&gt; kutle / (yaricap * yaricap);  <br>}</pre><h3>17. Records ve Pattern Matching (Dart 3)</h3><ul><li><strong>Record</strong>: Sınıf tanımlamadan birden fazla değeri bir arada taşıyan, anonim ve immutable yapı</li><li><strong>Destructuring</strong>: Bir record’u veya nesneyi bileşenlerine ayırma</li><li><strong>Pattern Matching</strong>: switch ve if-case ile veri yapılarını çözümleme</li></ul><pre>(String, int) kullaniciBilgisi() =&gt; (&quot;Ali&quot;, 25);</pre><pre>final (isim, yas) = kullaniciBilgisi();     // destructuring<br>print(&quot;$isim, $yas yaşında&quot;);</pre><pre>({String isim, int yas}) namedRecord = (isim: &quot;Ayşe&quot;, yas: 30);</pre><pre>if (kullaniciBilgisi() case (String i, int y) when y &gt;= 18) {  <br>  print(&quot;$i yetişkin&quot;);  <br>}</pre><h3>18. Error Handling</h3><ul><li><strong>try/catch/finally</strong>: Dart’ın hata yönetimi söz dizimi</li><li><strong>throw</strong>: Herhangi bir nesneyi hata olarak fırlatabilme</li><li><strong>Exception vs Error</strong>: Kurtarılabilir durumlar (Exception) ile programlama hataları (Error) ayrımı</li></ul><pre>class AgHatasi implements Exception {  <br>  final String mesaj;  <br>  AgHatasi(this.mesaj);  <br>}</pre><pre>String veriGetir(bool baglantiVar) {  <br>  if (!baglantiVar) {  <br>    throw AgHatasi(&quot;Bağlantı yok&quot;);  <br>  }<br>  return &quot;veri&quot;;  <br>}</pre><pre>try {  <br>  print(veriGetir(false));  <br>} on AgHatasi catch (e) {  <br>  print(&quot;Ağ hatası: ${e.mesaj}&quot;);  <br>} finally {  <br>  print(&quot;İşlem tamamlandı&quot;);  <br>}</pre><h3>19. Async/Await ve Future</h3><ul><li><strong>Future</strong>: İleride tamamlanacak tek bir asenkron işlemi temsil eden tip</li><li><strong>async/await</strong>: Asenkron kodu senkron gibi okunabilir şekilde yazma</li><li><strong>Future.wait</strong>: Birden fazla Future’ı paralel çalıştırıp hepsinin bitmesini bekleme</li></ul><pre>Future&lt;String&gt; kullaniciGetir(String id) async {  <br>  await Future.delayed(Duration(seconds: 1));    // ağ çağrısını simüle eder  <br>  return &quot;Kullanıcı $id&quot;;  <br>}</pre><pre>Future&lt;void&gt; main() async {  <br>  final kullanici = await kullaniciGetir(&quot;1&quot;);  <br>  print(kullanici);</pre><pre>  final sonuclar = await Future.wait([  <br>    kullaniciGetir(&quot;1&quot;),  <br>    kullaniciGetir(&quot;2&quot;),  <br>  ]);                                             // paralel çalışır  <br>}</pre><h3>20. Stream</h3><ul><li><strong>Stream</strong>: Zaman içinde birden fazla değer yayan asenkron veri kaynağı</li><li><strong>StreamController</strong>: Bir stream’e manuel olarak veri ekleme</li><li><strong>Stream Operatörleri</strong>: map, where, listen ile akışı işleme</li></ul><pre>Stream&lt;int&gt; sayilariYay() async* {  <br>  for (var i = 1; i &lt;= 5; i++) {  <br>    await Future.delayed(Duration(milliseconds: 100));  <br>    yield i;                                       // her değer yayınlandığında dinleyiciye ulaşır  <br>  }  <br>}</pre><pre>void main() {  <br>  sayilariYay()  <br>    .where((n) =&gt; n % 2 == 0)  <br>    .listen((n) =&gt; print(n));                       // 2, 4  <br>}</pre><h3>21. Isolates</h3><ul><li><strong>Isolate</strong>: Dart’ın thread benzeri, paylaşılan bellek olmadan çalışan paralel işlem birimi</li><li><strong>compute()</strong>: Flutter’da ağır işleri ayrı bir isolate’te çalıştırmak için kullanılan yardımcı fonksiyon</li><li><strong>Mesajlaşma</strong>: Isolate’ler arası veri paylaşımının, referans değil kopya/mesaj yoluyla yapılması</li></ul><pre>int agirHesaplama(int n) {  <br>  var sonuc = 0;  <br>  for (var i = 0; i &lt; n; i++) sonuc += i;  <br>  return sonuc;  <br>}</pre><pre>Future&lt;void&gt; main() async {  <br>  final sonuc = await Isolate.run(() =&gt; agirHesaplama(1000000000));   // ayrı isolate&#39;te çalışır  <br>  print(sonuc);  <br>}</pre><h3>22. Extension Types (Dart 3.3+)</h3><ul><li><strong>extension type</strong>: Çalışma zamanı maliyeti olmadan bir tipe yeni bir “görünüm” kazandıran hafif wrapper</li><li><strong>Type Safety</strong>: İlkel tipleri (örn. int) anlamlı, birbirinden ayrılabilir tiplere dönüştürme</li></ul><pre>extension type KullaniciId(int deger) {  <br>  bool get gecerliMi =&gt; deger &gt; 0;  <br>}</pre><pre>void kullaniciGetir(KullaniciId id) {  <br>  print(&quot;Kullanıcı getiriliyor: ${id.deger}&quot;);  <br>}</pre><pre>kullaniciGetir(KullaniciId(5));     // int yerine anlamlı bir tip kullanılıyor</pre><h3>23. Testing</h3><ul><li><strong>test paketi</strong>: Dart’ın resmi unit test framework’ü</li><li><strong>group ve setUp</strong>: Testleri gruplama ve ortak hazırlık kodu tanımlama</li><li><strong>Mocking</strong>: mockito veya mocktail ile sahte bağımlılıklar oluşturma</li></ul><pre>import &#39;package:test/test.dart&#39;;</pre><pre>void main() {  <br>  group(&#39;HesapMakinesi&#39;, () {  <br>    late HesapMakinesi hesap;</pre><pre>    setUp(() {  <br>      hesap = HesapMakinesi();  <br>    });</pre><pre>    test(&#39;iki sayı toplanmalı&#39;, () {  <br>      expect(hesap.topla(2, 3), equals(5));  <br>    });  <br>  });  <br>}</pre><h3>24. Package Yönetimi</h3><ul><li><strong>pubspec.yaml</strong>: Bağımlılıkları, SDK sürümünü ve assetleri tanımlayan manifest dosyası</li><li><strong>pub.dev</strong>: Dart/Flutter paketlerinin resmi deposu</li><li><strong>dart pub get / upgrade</strong>: Bağımlılıkları indirme ve güncelleme komutları</li></ul><pre>name: my_package  <br>environment:  <br>  sdk: &#39;&gt;=3.0.0 &lt;4.0.0&#39;</pre><pre>dependencies:  <br>  http: ^1.2.0  <br>  meta: ^1.15.0</pre><pre>dev_dependencies:  <br>  test: ^1.25.0</pre><h3>25. Production’da Bilinmesi Gereken Diğer Konular</h3><ul><li><strong>Sound Null Safety</strong>: Dart 3&#39;ten itibaren tüm dilin null safety’ye tam uyumlu olması</li><li><strong>Tree Shaking</strong>: Kullanılmayan kodun derleme sırasında otomatik olarak elenmesi</li><li><strong>dart compile</strong>: Dart kodunu native executable, JS veya AOT snapshot’a derleme</li><li><strong>Dart DevTools</strong>: Bellek, performans ve widget ağacını inceleyen resmi analiz aracı</li></ul><pre>// dart compile exe main.dart  → native çalıştırılabilir dosya üretir<br>// dart compile js main.dart   → web için JavaScript üretir</pre><pre>void main() {  <br>  print(&quot;Production&#39;a hazır!&quot;);  <br>}</pre><h3>Terimler Sözlüğü</h3><h3>Dil Temelleri</h3><ul><li><strong>var / final / const</strong>: Sırasıyla çıkarımlı, bir kez atanan ve derleme zamanı sabiti tanımlayan anahtar kelimeler.</li><li><strong>Null Safety</strong>: Dart’ın derleme zamanında null hatalarını önleyen, sound tip sistemi özelliği.</li><li><strong>late</strong>: Bir değişkenin geç başlatılacağını ama non-null olacağını garanti eden anahtar kelime.</li><li><strong>Extension</strong>: Var olan bir tipe dışarıdan fonksiyonellik ekleme yeteneği.</li></ul><h3>Sınıflar ve Tipler</h3><ul><li><strong>Mixin</strong>: Birden fazla sınıftan davranış paylaşmayı sağlayan yapı.</li><li><strong>Factory Constructor</strong>: Koşullu veya işlenmiş nesne oluşturmaya izin veren constructor türü.</li><li><strong>Sealed Class</strong>: Sınırlı alt sınıf kümesine sahip, exhaustive switch sağlayan sınıf türü (Dart 3).</li><li><strong>Record</strong>: Sınıf tanımlamadan birden fazla değeri bir arada taşıyan immutable yapı (Dart 3).</li></ul><h3>Fonksiyonel Programlama</h3><ul><li><strong>Closure</strong>: Tanımlandığı scope’taki değişkenleri yakalayabilen fonksiyon.</li><li><strong>Higher-Order Function</strong>: Fonksiyon alan veya döndüren fonksiyon.</li><li><strong>Cascade (</strong><strong>..)</strong>: Aynı nesne üzerinde art arda metod çağırmayı sağlayan operatör.</li><li><strong>Spread (</strong><strong>...)</strong>: Bir koleksiyonun elemanlarını başka bir koleksiyona açan operatör.</li></ul><h3>Asenkron Programlama</h3><ul><li><strong>Future</strong>: Tek bir asenkron işlemi temsil eden veri tipi.</li><li><strong>async/await</strong>: Asenkron kodu senkron gibi yazmayı sağlayan söz dizimi.</li><li><strong>Stream</strong>: Zaman içinde birden fazla değer yayan asenkron veri kaynağı.</li><li><strong>Isolate</strong>: Paylaşımlı bellek olmadan çalışan paralel işlem birimi.</li></ul><h3>Ekosistem</h3><ul><li><strong>pub.dev</strong>: Dart/Flutter paketlerinin resmi deposu.</li><li><strong>pubspec.yaml</strong>: Bağımlılık ve proje yapılandırma dosyası.</li><li><strong>Dart DevTools</strong>: Performans ve bellek analiz aracı.</li><li><strong>dart compile</strong>: Dart kodunu farklı hedeflere derleyen komut.</li></ul><h3>Kaynaklar</h3><h3>Dil Temelleri</h3><ul><li><strong>Dart Resmi Dokümantasyon</strong> =&gt; <a href="https://dart.dev/guides">https://dart.dev/guides</a></li><li><strong>Dart Language Tour</strong> =&gt; <a href="https://dart.dev/language">https://dart.dev/language</a></li><li><strong>Effective Dart</strong> =&gt; <a href="https://dart.dev/effective-dart">https://dart.dev/effective-dart</a></li></ul><h3>Asenkron Programlama</h3><ul><li><strong>Asynchronous Programming</strong> =&gt; <a href="https://dart.dev/language/async">https://dart.dev/language/async</a></li><li><strong>Isolates</strong> =&gt; <a href="https://dart.dev/language/isolates">https://dart.dev/language/isolates</a></li></ul><h3>Dart 3 Özellikleri</h3><ul><li><strong>Patterns</strong> =&gt; <a href="https://dart.dev/language/patterns">https://dart.dev/language/patterns</a></li><li><strong>Records</strong> =&gt; <a href="https://dart.dev/language/records">https://dart.dev/language/records</a></li><li><strong>Class Modifiers</strong> =&gt; <a href="https://dart.dev/language/class-modifiers">https://dart.dev/language/class-modifiers</a></li></ul><h3>Package Yönetimi</h3><ul><li><strong>pub.dev</strong> =&gt; <a href="https://pub.dev/">https://pub.dev/</a></li><li><strong>pubspec Dosyası</strong> =&gt; <a href="https://dart.dev/tools/pub/pubspec">https://dart.dev/tools/pub/pubspec</a></li></ul><h3>Testing</h3><ul><li><strong>test paketi</strong> =&gt; <a href="https://pub.dev/packages/test">https://pub.dev/packages/test</a></li><li><strong>mocktail</strong> =&gt; <a href="https://pub.dev/packages/mocktail">https://pub.dev/packages/mocktail</a></li></ul><h3>Tooling</h3><ul><li><strong>Dart DevTools</strong> =&gt; <a href="https://dart.dev/tools/dart-devtools">https://dart.dev/tools/dart-devtools</a></li><li><strong>dart compile</strong> =&gt; <a href="https://dart.dev/tools/dart-compile">https://dart.dev/tools/dart-compile</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4292fb5df1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Dart (English)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-dart-english-30e2e54ff3fc?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/30e2e54ff3fc</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 13:34:49 GMT</pubDate>
            <atom:updated>2026-07-20T13:34:49.070Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95GvNtkKR160dMGmE7Ws5g.png" /></figure><p>“This is a roadmap — you need to dive deep into each topic on your own”</p><h3>1. Basic Syntax &amp; Type System</h3><ul><li><strong>var vs final vs const</strong>: var is inferred and mutable, final is assigned once, const is a compile-time constant</li><li><strong>Type Inference</strong>: Dart infers the type automatically in most cases</li><li><strong>Sound Type System</strong>: Dart’s static type system is guaranteed at runtime as well</li></ul><pre>var name = &quot;John&quot;;               // inferred type (String)<br>final age = 28;                  // assigned once, then immutable<br>const pi = 3.14159;               // compile-time constant</pre><pre>int counter = 0;                  // explicit type annotation</pre><h3>2. Null Safety</h3><ul><li><strong>?</strong>: a nullable type indicating a variable may be null</li><li><strong>!</strong>: non-null assertion — throws a runtime error if null</li><li><strong>?? and </strong><strong>??=</strong>: providing/assigning a default value when null</li><li><strong>late</strong>: a variable initialized later but marked non-null</li></ul><pre>String? name;</pre><pre>int length = name?.length ?? 0;       // 0 if null<br>int forced = name!.length;            // error if null</pre><pre>name ??= &quot;Default Name&quot;;              // assign only if null</pre><pre>late String apiKey;                   // assigned later, guaranteed non-null<br>apiKey = &quot;secret-key&quot;;</pre><h3>3. Functions</h3><ul><li><strong>Positional/Named/Optional Parameters</strong>: {required this.x}, [optional] parameter types</li><li><strong>Arrow Functions</strong>: single-expression functions using =&gt;</li><li><strong>Functions Are First-Class Citizens</strong>: they can be assigned to variables and passed as parameters</li></ul><pre>String greet(String name, {String message = &quot;Hello&quot;}) {  <br>  return &quot;$message, $name!&quot;;  <br>}</pre><pre>greet(&quot;Jane&quot;);                            // &quot;Hello, Jane!&quot;<br>greet(&quot;Jane&quot;, message: &quot;Hi&quot;);             // named parameter</pre><pre>int double(int x) =&gt; x * 2;               // arrow function</pre><pre>void Function(String) logger = (message) =&gt; print(&quot;[LOG] $message&quot;);</pre><h3>4. Control Flow</h3><ul><li><strong>switch</strong>: gained pattern-matching support in Dart 3, can enforce exhaustive checks</li><li><strong>for-in &amp; Iterable</strong>: looping over collections</li><li><strong>Collection if/for</strong>: adding elements conditionally or with a loop while defining a list/map</li></ul><pre>String describe(Object x) =&gt; switch (x) {  <br>  int n when n &gt; 0 =&gt; &quot;Positive number: $n&quot;,  <br>  String s =&gt; &quot;Text: $s&quot;,  <br>  _ =&gt; &quot;Unknown&quot;,  <br>};</pre><pre>final list = [  <br>  1, 2, 3,  <br>  if (true) 4,                            // collection if  <br>  for (var i in [5, 6]) i * 10,           // collection for  <br>];</pre><h3>5. Classes &amp; Objects</h3><ul><li><strong>Properties</strong>: field definitions, customizable via getters/setters</li><li><strong>this</strong>: the this.field shortcut in constructor parameters</li><li><strong>Class Modifiers (Dart 3)</strong>: keywords like final, sealed, interface, base that constrain class behavior</li></ul><pre>class User {  <br>  final String id;  <br>  String name;</pre><pre>  User(this.id, this.name);               // constructor shortcut</pre><pre>  String get shortName =&gt; name.substring(0, 3);  <br>}</pre><pre>sealed class Shape {}                     // Dart 3: restricted set of subclasses<br>final class Circle extends Shape {}       // final: can&#39;t be extended outside this library</pre><h3>6. Constructor Types</h3><ul><li><strong>Named Constructor</strong>: alternative constructors like User.empty()</li><li><strong>Factory Constructor</strong>: doesn’t always have to return a new instance, can contain logic</li><li><strong>Redirecting Constructor</strong>: a constructor that forwards to another constructor</li></ul><pre>class User {  <br>  final String id;  <br>  final String name;</pre><pre>  User(this.id, this.name);</pre><pre>  User.empty() : this(&quot;0&quot;, &quot;Unnamed&quot;);            // redirecting constructor</pre><pre>  factory User.fromJson(Map&lt;String, dynamic&gt; json) {  <br>    return User(json[&#39;id&#39;], json[&#39;name&#39;]);        // conditional/processed creation  <br>  }  <br>}</pre><h3>7. Mixins</h3><ul><li><strong>mixin</strong>: “mixing” behavior from multiple classes, Dart’s approach to multiple inheritance</li><li><strong>with</strong>: the keyword for applying a mixin to a class</li><li><strong>on</strong>: restricting a mixin to only be usable on a specific type</li></ul><pre>mixin Flyable {  <br>  void fly() =&gt; print(&quot;Flying!&quot;);  <br>}</pre><pre>mixin Swimmable {  <br>  void swim() =&gt; print(&quot;Swimming!&quot;);  <br>}</pre><pre>class Duck with Flyable, Swimmable {}   // gets both behaviors</pre><pre>final duck = Duck();<br>duck.fly();<br>duck.swim();</pre><h3>8. Extension Methods</h3><ul><li><strong>extension</strong>: adding new functionality to an existing type — even ones you didn’t write</li></ul><pre>extension IntExtensions on int {  <br>  int get doubled =&gt; this * 2;  </pre><pre>  bool get isEven2 =&gt; this % 2 == 0;  <br>}</pre><pre>print(5.doubled);      // 10<br>print(4.isEven2);       // true</pre><h3>9. Abstract Class &amp; Interface</h3><ul><li><strong>Abstract Class</strong>: a base class that can’t be instantiated directly, carrying shared behavior</li><li><strong>implements</strong>: in Dart, every class implicitly acts as an interface — implements requires every member to be rewritten</li><li><strong>abstract interface class (Dart 3)</strong>: explicitly marking classes intended only as interfaces</li></ul><pre>abstract class Storage {  <br>  void save(String data);  <br>}</pre><pre>class FileStorage implements Storage {  <br>  @override  <br>  void save(String data) =&gt; print(&quot;Saved to file: $data&quot;);  <br>}</pre><pre>abstract interface class Loggable {  <br>  void log(String message);  <br>}</pre><h3>10. Inheritance &amp; Polymorphism</h3><ul><li><strong>extends</strong>: inheriting from a single class</li><li><strong>@override</strong>: redefining a method from the superclass</li><li><strong>super</strong>: accessing the superclass’s implementation</li></ul><pre>class Shape {  <br>  double area() =&gt; 0.0;  <br>}</pre><pre>class Circle extends Shape {  <br>  final double radius;  <br>  Circle(this.radius);</pre><pre>  @override  <br>  double area() =&gt; 3.14159 * radius * radius;  <br>}</pre><pre>final shapes = &lt;Shape&gt;[Shape(), Circle(3)];<br>for (final s in shapes) print(s.area());   // polymorphism</pre><h3>11. Generics</h3><ul><li><strong>Generic Classes &amp; Functions</strong>: structures that take a type parameter</li><li><strong>Bounded Types</strong>: constraining a generic type, e.g. &lt;T extends Comparable&gt;</li></ul><pre>class Box&lt;T&gt; {  <br>  final T content;  <br>  Box(this.content);  <br>}</pre><pre>T larger&lt;T extends Comparable&lt;T&gt;&gt;(T a, T b) {  <br>  return a.compareTo(b) &gt; 0 ? a : b;  <br>}</pre><pre>final stringBox = Box&lt;String&gt;(&quot;hello&quot;);<br>final intBox = Box&lt;int&gt;(42);</pre><h3>12. Collections &amp; Functional Operations</h3><ul><li><strong>List, Set, Map</strong>: Dart’s core collection types</li><li><strong>map, where, reduce</strong>: chaining functional transformations</li><li><strong>Spread Operator (</strong><strong>...)</strong>: unpacking a collection&#39;s elements into another collection</li></ul><pre>final users = [  <br>  {&#39;name&#39;: &#39;Alice&#39;, &#39;active&#39;: true},  <br>  {&#39;name&#39;: &#39;Bob&#39;, &#39;active&#39;: false},  <br>];</pre><pre>final activeNames = users  <br>  .where((u) =&gt; u[&#39;active&#39;] == true)  <br>  .map((u) =&gt; u[&#39;name&#39;])  <br>  .toList();</pre><pre>final list1 = [1, 2, 3];<br>final list2 = [0, ...list1, 4];        // [0, 1, 2, 3, 4]</pre><h3>13. Closures &amp; Higher-Order Functions</h3><ul><li><strong>Anonymous Function</strong>: an unnamed function like (x) { return x * 2; }</li><li><strong>Closure</strong>: a function’s ability to “capture” variables from the scope where it’s defined</li><li><strong>Higher-Order Function</strong>: a function that takes or returns another function</li></ul><pre>Function makeCounter() {  <br>  int count = 0;  <br>  return () {  <br>    count++;                    // captures &#39;count&#39; from the enclosing scope  <br>    return count;  <br>  };  <br>}</pre><pre>final counter = makeCounter();<br>print(counter());   // 1<br>print(counter());   // 2</pre><pre>int apply(int x, int Function(int) operation) =&gt; operation(x);<br>print(apply(5, (x) =&gt; x * x));   // 25</pre><h3>14. Cascade Notation (..) &amp; Other Operators</h3><ul><li><strong>Cascade (</strong><strong>..)</strong>: chaining multiple method calls on the same object without repeating it</li><li><strong>Null-aware Cascade (</strong><strong>?..)</strong>: a safe cascade when the object may be null</li><li><strong>Spread &amp; Null-aware Spread</strong>: operators used for merging collections</li></ul><pre>final buffer = StringBuffer()  <br>  ..write(&quot;Hello&quot;)  <br>  ..write(&quot;, &quot;)  <br>  ..write(&quot;World!&quot;);             // each line operates on the same buffer</pre><pre>print(buffer.toString());        // &quot;Hello, World!&quot;</pre><h3>15. late &amp; static</h3><ul><li><strong>late</strong>: guarantees a variable is initialized later but will be non-null</li><li><strong>late final</strong>: a variable assigned only once, but lazily</li><li><strong>static</strong>: members tied to the class, not to an instance</li></ul><pre>class DataManager {  <br>  late final List&lt;int&gt; heavyData = _compute();   // runs only on first access</pre><pre>  List&lt;int&gt; _compute() {  <br>    print(&quot;Computing...&quot;);  <br>    return List.generate(1000, (i) =&gt; i * i);  <br>  }</pre><pre>  static int instanceCount = 0;                    // shared across all instances  <br>}</pre><h3>16. Enum (Enhanced Enums)</h3><ul><li><strong>Classic Enum</strong>: a fixed set of values</li><li><strong>Enhanced Enum (Dart 2.17+)</strong>: enums that can carry constructors, methods, and properties</li></ul><pre>enum Direction { north, south, east, west }</pre><pre>enum Planet {  <br>  mercury(mass: 3.3e23, radius: 2439.7),  <br>  earth(mass: 5.9e24, radius: 6371.0);</pre><pre>  final double mass;  <br>  final double radius;  </pre><pre>  const Planet({required this.mass, required this.radius});</pre><pre>  double get gravity =&gt; mass / (radius * radius);  <br>}</pre><h3>17. Records &amp; Pattern Matching (Dart 3)</h3><ul><li><strong>Record</strong>: an anonymous, immutable structure carrying multiple values together without defining a class</li><li><strong>Destructuring</strong>: breaking a record or object into its components</li><li><strong>Pattern Matching</strong>: resolving data structures with switch and if-case</li></ul><pre>(String, int) userInfo() =&gt; (&quot;Alice&quot;, 25);</pre><pre>final (name, age) = userInfo();     // destructuring<br>print(&quot;$name, age $age&quot;);</pre><pre>({String name, int age}) namedRecord = (name: &quot;Bob&quot;, age: 30);</pre><pre>if (userInfo() case (String n, int a) when a &gt;= 18) {  <br>  print(&quot;$n is an adult&quot;);  <br>}</pre><h3>18. Error Handling</h3><ul><li><strong>try/catch/finally</strong>: Dart’s error handling syntax</li><li><strong>throw</strong>: any object can be thrown as an error</li><li><strong>Exception vs Error</strong>: distinguishing recoverable situations (Exception) from programming mistakes (Error)</li></ul><pre>class NetworkError implements Exception {  <br>  final String message;  <br>  NetworkError(this.message);  <br>}</pre><pre>String fetchData(bool hasConnection) {  <br>  if (!hasConnection) {  <br>    throw NetworkError(&quot;No connection&quot;);  <br>  }<br>  return &quot;data&quot;;  <br>}</pre><pre>try {  <br>  print(fetchData(false));  <br>} on NetworkError catch (e) {  <br>  print(&quot;Network error: ${e.message}&quot;);  <br>} finally {  <br>  print(&quot;Operation complete&quot;);  <br>}</pre><h3>19. Async/Await &amp; Future</h3><ul><li><strong>Future</strong>: a data type representing a single asynchronous operation that will complete in the future</li><li><strong>async/await</strong>: writing asynchronous code that reads like synchronous code</li><li><strong>Future.wait</strong>: running multiple Futures in parallel and waiting for all to complete</li></ul><pre>Future&lt;String&gt; getUser(String id) async {  <br>  await Future.delayed(Duration(seconds: 1));    // simulates a network call  <br>  return &quot;User $id&quot;;  <br>}</pre><pre>Future&lt;void&gt; main() async {  <br>  final user = await getUser(&quot;1&quot;);  <br>  print(user);</pre><pre>  final results = await Future.wait([  <br>    getUser(&quot;1&quot;),  <br>    getUser(&quot;2&quot;),  <br>  ]);                                             // runs in parallel  <br>}</pre><h3>20. Stream</h3><ul><li><strong>Stream</strong>: an asynchronous data source that emits multiple values over time</li><li><strong>StreamController</strong>: manually adding data to a stream</li><li><strong>Stream Operators</strong>: processing a stream with map, where, listen</li></ul><pre>Stream&lt;int&gt; emitNumbers() async* {  <br>  for (var i = 1; i &lt;= 5; i++) {  <br>    await Future.delayed(Duration(milliseconds: 100));  <br>    yield i;                                       // each value reaches the listener when emitted  <br>  }  <br>}</pre><pre>void main() {  <br>  emitNumbers()  <br>    .where((n) =&gt; n % 2 == 0)  <br>    .listen((n) =&gt; print(n));                       // 2, 4  <br>}</pre><h3>21. Isolates</h3><ul><li><strong>Isolate</strong>: Dart’s thread-like unit of parallel execution with no shared memory</li><li><strong>compute()</strong>: a Flutter helper function for running heavy work on a separate isolate</li><li><strong>Messaging</strong>: data between isolates is shared via copying/messages rather than references</li></ul><pre>int heavyComputation(int n) {  <br>  var result = 0;  <br>  for (var i = 0; i &lt; n; i++) result += i;  <br>  return result;  <br>}</pre><pre>Future&lt;void&gt; main() async {  <br>  final result = await Isolate.run(() =&gt; heavyComputation(1000000000));   // runs on a separate isolate  <br>  print(result);  <br>}</pre><h3>22. Extension Types (Dart 3.3+)</h3><ul><li><strong>extension type</strong>: a lightweight wrapper giving a type a new “view” with no runtime cost</li><li><strong>Type Safety</strong>: turning primitive types (e.g. int) into meaningful, distinguishable types</li></ul><pre>extension type UserId(int value) {  <br>  bool get isValid =&gt; value &gt; 0;  <br>}</pre><pre>void getUser(UserId id) {  <br>  print(&quot;Fetching user: ${id.value}&quot;);  <br>}</pre><pre>getUser(UserId(5));     // a meaningful type is used instead of a plain int</pre><h3>23. Testing</h3><ul><li><strong>test package</strong>: Dart’s official unit testing framework</li><li><strong>group and setUp</strong>: grouping tests and defining shared setup code</li><li><strong>Mocking</strong>: creating fake dependencies with mockito or mocktail</li></ul><pre>import &#39;package:test/test.dart&#39;;</pre><pre>void main() {  <br>  group(&#39;Calculator&#39;, () {  <br>    late Calculator calc;</pre><pre>    setUp(() {  <br>      calc = Calculator();  <br>    });</pre><pre>    test(&#39;two numbers should add up&#39;, () {  <br>      expect(calc.add(2, 3), equals(5));  <br>    });  <br>  });  <br>}</pre><h3>24. Package Management</h3><ul><li><strong>pubspec.yaml</strong>: the manifest file defining dependencies, SDK version, and assets</li><li><strong>pub.dev</strong>: the official repository for Dart/Flutter packages</li><li><strong>dart pub get / upgrade</strong>: commands for downloading and updating dependencies</li></ul><pre>name: my_package  <br>environment:  <br>  sdk: &#39;&gt;=3.0.0 &lt;4.0.0&#39;</pre><pre>dependencies:  <br>  http: ^1.2.0  <br>  meta: ^1.15.0</pre><pre>dev_dependencies:  <br>  test: ^1.25.0</pre><h3>25. Other Things You Should Know in Production</h3><ul><li><strong>Sound Null Safety</strong>: as of Dart 3, the entire language is fully compliant with null safety</li><li><strong>Tree Shaking</strong>: unused code is automatically eliminated during compilation</li><li><strong>dart compile</strong>: compiling Dart code to a native executable, JS, or an AOT snapshot</li><li><strong>Dart DevTools</strong>: the official analysis tool for inspecting memory, performance, and the widget tree</li></ul><pre>// dart compile exe main.dart  → produces a native executable<br>// dart compile js main.dart   → produces JavaScript for the web</pre><pre>void main() {  <br>  print(&quot;Ready for production!&quot;);  <br>}</pre><h3>Glossary of Terms</h3><h3>Language Fundamentals</h3><ul><li><strong>var / final / const</strong>: keywords defining inferred, once-assigned, and compile-time constant variables, respectively.</li><li><strong>Null Safety</strong>: Dart’s sound type system feature that prevents null errors at compile time.</li><li><strong>late</strong>: a keyword guaranteeing a variable is initialized later but will be non-null.</li><li><strong>Extension</strong>: the ability to add functionality to an existing type from the outside.</li></ul><h3>Classes &amp; Types</h3><ul><li><strong>Mixin</strong>: a construct enabling behavior sharing across multiple classes.</li><li><strong>Factory Constructor</strong>: a constructor type allowing conditional or processed object creation.</li><li><strong>Sealed Class</strong>: a class type with a restricted set of subclasses, enabling exhaustive switch (Dart 3).</li><li><strong>Record</strong>: an immutable structure carrying multiple values together without defining a class (Dart 3).</li></ul><h3>Functional Programming</h3><ul><li><strong>Closure</strong>: a function that can capture variables from the scope where it’s defined.</li><li><strong>Higher-Order Function</strong>: a function that takes or returns another function.</li><li><strong>Cascade (</strong><strong>..)</strong>: an operator that chains method calls on the same object.</li><li><strong>Spread (</strong><strong>...)</strong>: an operator that unpacks a collection&#39;s elements into another collection.</li></ul><h3>Asynchronous Programming</h3><ul><li><strong>Future</strong>: a data type representing a single asynchronous operation.</li><li><strong>async/await</strong>: syntax that lets asynchronous code be written like synchronous code.</li><li><strong>Stream</strong>: an asynchronous data source that emits multiple values over time.</li><li><strong>Isolate</strong>: a unit of parallel execution with no shared memory.</li></ul><h3>Ecosystem</h3><ul><li><strong>pub.dev</strong>: the official repository for Dart/Flutter packages.</li><li><strong>pubspec.yaml</strong>: the dependency and project configuration file.</li><li><strong>Dart DevTools</strong>: a performance and memory analysis tool.</li><li><strong>dart compile</strong>: the command for compiling Dart code to different targets.</li></ul><h3>Resources</h3><h3>Language Fundamentals</h3><ul><li><strong>Dart Official Documentation</strong> =&gt; <a href="https://dart.dev/guides">https://dart.dev/guides</a></li><li><strong>Dart Language Tour</strong> =&gt; <a href="https://dart.dev/language">https://dart.dev/language</a></li><li><strong>Effective Dart</strong> =&gt; <a href="https://dart.dev/effective-dart">https://dart.dev/effective-dart</a></li></ul><h3>Asynchronous Programming</h3><ul><li><strong>Asynchronous Programming</strong> =&gt; <a href="https://dart.dev/language/async">https://dart.dev/language/async</a></li><li><strong>Isolates</strong> =&gt; <a href="https://dart.dev/language/isolates">https://dart.dev/language/isolates</a></li></ul><h3>Dart 3 Features</h3><ul><li><strong>Patterns</strong> =&gt; <a href="https://dart.dev/language/patterns">https://dart.dev/language/patterns</a></li><li><strong>Records</strong> =&gt; <a href="https://dart.dev/language/records">https://dart.dev/language/records</a></li><li><strong>Class Modifiers</strong> =&gt; <a href="https://dart.dev/language/class-modifiers">https://dart.dev/language/class-modifiers</a></li></ul><h3>Package Management</h3><ul><li><strong>pub.dev</strong> =&gt; <a href="https://pub.dev/">https://pub.dev/</a></li><li><strong>The pubspec File</strong> =&gt; <a href="https://dart.dev/tools/pub/pubspec">https://dart.dev/tools/pub/pubspec</a></li></ul><h3>Testing</h3><ul><li><strong>test package</strong> =&gt; <a href="https://pub.dev/packages/test">https://pub.dev/packages/test</a></li><li><strong>mocktail</strong> =&gt; <a href="https://pub.dev/packages/mocktail">https://pub.dev/packages/mocktail</a></li></ul><h3>Tooling</h3><ul><li><strong>Dart DevTools</strong> =&gt; <a href="https://dart.dev/tools/dart-devtools">https://dart.dev/tools/dart-devtools</a></li><li><strong>dart compile</strong> =&gt; <a href="https://dart.dev/tools/dart-compile">https://dart.dev/tools/dart-compile</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30e2e54ff3fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Swift (Türkçe)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-swift-t%C3%BCrk%C3%A7e-3ea6d85ce713?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ea6d85ce713</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 11:22:29 GMT</pubDate>
            <atom:updated>2026-07-19T11:22:29.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNXU9J0FNcfSbYz3Ok47XQ.png" /></figure><p>“Bu bir yol haritasıdır, her başlığı ayrı ayrı derinlemesine çalışman gerekir”</p><h3>1. Temel Söz Dizimi ve Tip Sistemi</h3><ul><li><strong>let vs var</strong>: let değiştirilemez, var değiştirilebilir referans/değer tanımlar</li><li><strong>Type Inference</strong>: Swift çoğu durumda tipi otomatik çıkarır</li><li><strong>Statik Tipleme</strong>: Derleme zamanında tip güvenliği sağlanır</li></ul><pre>let isim: String = &quot;Ahmet&quot;      // açık tip<br>let yas = 28                    // çıkarımlı tip (Int)<br>var sayac = 0                   // değiştirilebilir</pre><pre>let durum = yas &gt;= 18 ? &quot;yetişkin&quot; : &quot;reşit değil&quot;   // ternary expression</pre><h3>2. Optionals: Null Safety</h3><ul><li><strong>?</strong>: Bir değerin olabilir ya da olmayabilir olduğunu belirten opsiyonel tip</li><li><strong>if let / </strong><strong>guard let</strong>: Optional&#39;ı güvenli şekilde unwrap etme</li><li><strong>??</strong>: Nil durumunda varsayılan değer (nil coalescing operatörü)</li><li><strong>!</strong>: Force unwrap — nil ise runtime&#39;da çökme riski</li></ul><pre>var isim: String? = nil</pre><pre>if let kesinIsim = isim {  <br>  print(&quot;İsim: \(kesinIsim)&quot;)           // sadece nil değilse çalışır  <br>}</pre><pre>guard let kesinIsim = isim else {  <br>  print(&quot;İsim yok, fonksiyondan çık&quot;)  <br>  return  <br>}</pre><pre>let uzunluk = isim?.count ?? 0          // nil ise 0<br>let riskli = isim!.count                // nil ise crash</pre><h3>3. Fonksiyonlar</h3><ul><li><strong>Parameter Labels</strong>: Dış isim ile iç isim ayrımı, okunabilir çağrılar</li><li><strong>Default Values</strong>: Parametrelere varsayılan değer tanımlama</li><li><strong>inout Parametreler</strong>: Fonksiyon içinde parametreyi doğrudan değiştirebilme</li><li><strong>Variadic Parameters</strong>: Değişken sayıda parametre alabilme</li></ul><pre>func selamla(isim: String, mesaj mesajMetni: String = &quot;Merhaba&quot;) -&gt; String {  <br>  return &quot;\(mesajMetni), \(isim)!&quot;  <br>}</pre><pre>selamla(isim: &quot;Ayşe&quot;)                          // &quot;Merhaba, Ayşe!&quot;<br>selamla(isim: &quot;Ayşe&quot;, mesaj: &quot;Selam&quot;)          // dış isim: mesaj</pre><pre>func degistir(_ sayi: inout Int) {  <br>  sayi *= 2  <br>}<br>var x = 5<br>degistir(&amp;x)                                   // x artık 10</pre><h3>4. Kontrol Yapıları</h3><ul><li><strong>switch</strong>: Exhaustive kontrol zorunluluğu olan, pattern matching destekli yapı</li><li><strong>guard</strong>: Erken çıkış (early return) için kullanılan, kodun “happy path”ini düz tutan yapı</li><li><strong>Ranges</strong>: 1...10, 0..&lt;10, stride(from:to:by:)</li></ul><pre>func tanımla(_ x: Any) -&gt; String {  <br>  switch x {  <br>  case let sayi as Int where sayi &gt; 0:  <br>    return &quot;Pozitif sayı: \(sayi)&quot;  <br>  case let metin as String:  <br>    return &quot;Metin: \(metin)&quot;  <br>  default:  <br>    return &quot;Bilinmiyor&quot;  <br>  }  <br>}</pre><pre>for i in stride(from: 10, to: 0, by: -2) { print(i, terminator: &quot; &quot;) }   // 10 8 6 4 2</pre><h3>5. Struct vs Class (Value Type vs Reference Type)</h3><ul><li><strong>Struct</strong>: Kopyalandığında yeni bir örnek oluşturan value type, Swift’te varsayılan tercih</li><li><strong>Class</strong>: Referans paylaşan reference type, kalıtım ve ARC ile bellek yönetimi gerektirir</li><li><strong>Ne Zaman Hangisi</strong>: Basit veri modelleri için struct, kimlik (identity) ve paylaşılan state için class</li></ul><pre>struct Nokta {  <br>  var x: Int  <br>  var y: Int  <br>}</pre><pre>var p1 = Nokta(x: 0, y: 0)<br>var p2 = p1                    // kopyalanır, p1&#39;den bağımsız<br>p2.x = 10<br>print(p1.x, p2.x)              // 0 10 — value type davranışı</pre><pre>class Kullanici {  <br>  var isim: String  <br>  init(isim: String) { self.isim = isim }  <br>}</pre><pre>let k1 = Kullanici(isim: &quot;Ali&quot;)<br>let k2 = k1                    // aynı referans<br>k2.isim = &quot;Veli&quot;<br>print(k1.isim)                 // &quot;Veli&quot; — reference type davranışı</pre><h3>6. Enum ve Associated Values</h3><ul><li><strong>Enum</strong>: Sabit bir değer kümesini temsil eder, Swift’te metod ve computed property de taşıyabilir</li><li><strong>Associated Values</strong>: Her case’in kendine özgü ek veri taşıyabilmesi</li><li><strong>Pattern Matching</strong>: switch ile associated value&#39;ları çözümleme</li></ul><pre>enum Sonuc&lt;T&gt; {  <br>  case basarili(T)  <br>  case hata(String)  <br>}</pre><pre>func goster(_ sonuc: Sonuc&lt;String&gt;) {  <br>  switch sonuc {  <br>  case .basarili(let veri):  <br>    print(&quot;Veri: \(veri)&quot;)  <br>  case .hata(let mesaj):  <br>    print(&quot;Hata: \(mesaj)&quot;)  <br>  }  <br>}</pre><pre>enum Yon: String, CaseIterable {  <br>  case kuzey, guney, dogu, bati  <br>}</pre><h3>7. Static Üyeler ve Singleton</h3><ul><li><strong>static let/var</strong>: Sınıfa bağlı, örneğe bağlı olmayan üyeler — Kotlin’deki companion object’in karşılığı</li><li><strong>Singleton Deseni</strong>: static let shared ile tek bir paylaşılan örnek oluşturma</li></ul><pre>class AyarYoneticisi {  <br>  static let shared = AyarYoneticisi()   // tek örnek  <br>  private init() {}                       // dışarıdan başka örnek oluşturulamaz</pre><pre>  var temaKoyu: Bool = false  <br>}</pre><pre>AyarYoneticisi.shared.temaKoyu = true    // her yerden aynı örneğe erişim</pre><h3>8. Protocols</h3><ul><li><strong>Protocol</strong>: Java/Kotlin’deki interface’in karşılığı, uyulması gereken bir sözleşme tanımlar</li><li><strong>Protocol Conformance</strong>: Bir struct/class/enum’un bir protokole uyması</li><li><strong>Protocol Composition</strong>: Birden fazla protokolü &amp; ile birleştirme</li></ul><pre>protocol Loglanabilir {  <br>  func logAt(_ mesaj: String)  <br>}</pre><pre>struct Servis: Loglanabilir {  <br>  func logAt(_ mesaj: String) {  <br>    print(&quot;[LOG] \(mesaj)&quot;)  <br>  }  <br>}</pre><pre>func islemYap(_ nesne: Loglanabilir &amp; CustomStringConvertible) {  <br>  nesne.logAt(&quot;işlem başladı&quot;)  <br>}</pre><h3>9. Protocol-Oriented Programming ve Protocol Extensions</h3><ul><li><strong>Protocol Extension</strong>: Bir protokole varsayılan implementasyon ekleme</li><li><strong>POP vs OOP</strong>: Swift’in kalıtım yerine protokol tabanlı kompozisyonu teşvik etmesi</li></ul><pre>protocol Loglanabilir {  <br>  func logAt(_ mesaj: String)  <br>}</pre><pre>extension Loglanabilir {  <br>  func logAt(_ mesaj: String) {           // varsayılan implementasyon  <br>    print(&quot;[LOG] \(mesaj)&quot;)  <br>  }  <br>}</pre><pre>struct Servis: Loglanabilir {}            // implementasyonu bedavaya alır<br>Servis().logAt(&quot;merhaba&quot;)</pre><h3>10. Extensions</h3><ul><li><strong>Extension</strong>: Var olan bir tipe (kendi yazmadığın tipler dahil) yeni fonksiyonellik ekleme</li><li><strong>Computed Property Ekleme</strong>: Extension içinde stored property olmadan hesaplanan property tanımlama</li></ul><pre>extension Int {  <br>  var ikiKati: Int { self * 2 }  </pre><pre>  func kareAl() -&gt; Int {  <br>    return self * self  <br>  }  <br>}</pre><pre>print(5.ikiKati)      // 10<br>print(5.kareAl())     // 25</pre><h3>11. Kalıtım ve Polimorfizm</h3><ul><li><strong>Kalıtım Sadece Class’larda</strong>: Struct ve enum’lar kalıtım alamaz, sadece protokole uyabilir</li><li><strong>override</strong>: Üst sınıftaki metodu yeniden tanımlama zorunluluğu</li><li><strong>final</strong>: Bir sınıfın veya metodun override edilmesini engelleme</li></ul><pre>class Sekil {  <br>  func alan() -&gt; Double { 0.0 }  <br>}</pre><pre>class Daire: Sekil {  <br>  let yaricap: Double  <br>  init(yaricap: Double) { self.yaricap = yaricap }  </pre><pre>  override func alan() -&gt; Double {  <br>    return Double.pi * yaricap * yaricap  <br>  }  <br>}</pre><pre>let sekiller: [Sekil] = [Sekil(), Daire(yaricap: 3)]<br>sekiller.forEach { print($0.alan()) }    // polimorfizm: her biri kendi alan()&#39;ını çalıştırır</pre><h3>12. Generics</h3><ul><li><strong>Generic Fonksiyonlar ve Tipler</strong>: Tip parametresi alan yapılar</li><li><strong>Type Constraints</strong>: &lt;T: Comparable&gt; gibi generic tipe sınır koyma</li><li><strong>Associated Types</strong>: Protokollerde generic’e benzer, kullanılana kadar belirsiz kalan tip</li></ul><pre>struct Kutu&lt;T&gt; {  <br>  let icerik: T  <br>}</pre><pre>func buyukOlani&lt;T: Comparable&gt;(_ a: T, _ b: T) -&gt; T {  <br>  return a &gt; b ? a : b  <br>}</pre><pre>protocol Depo {  <br>  associatedtype Eleman  <br>  func ekle(_ eleman: Eleman)  <br>}</pre><h3>13. Collections ve Functional Operasyonlar</h3><ul><li><strong>Array, Set, Dictionary</strong>: Swift’in temel koleksiyon tipleri</li><li><strong>map, filter, reduce</strong>: Zincirleme fonksiyonel dönüşümler</li><li><strong>compactMap</strong>: nil değerleri eleyerek dönüştürme</li></ul><pre>struct Kullanici {  <br>  let isim: String  <br>  let yas: Int  <br>  let aktif: Bool  <br>}</pre><pre>let kullanicilar = [  <br>  Kullanici(isim: &quot;Ali&quot;, yas: 25, aktif: true),  <br>  Kullanici(isim: &quot;Ayşe&quot;, yas: 17, aktif: true),  <br>  Kullanici(isim: &quot;Can&quot;, yas: 30, aktif: false)  <br>]</pre><pre>let sonuc = kullanicilar  <br>  .filter { $0.aktif }  <br>  .map { $0.isim.uppercased() }  <br>  .sorted()<br>// [&quot;ALİ&quot;, &quot;AYŞE&quot;]</pre><pre>let sayilar = [&quot;1&quot;, &quot;iki&quot;, &quot;3&quot;]<br>let gecerliSayilar = sayilar.compactMap { Int($0) }   // [1, 3], &quot;iki&quot; elenir</pre><h3>14. Closures ve Higher-Order Functions</h3><ul><li><strong>Closure</strong>: { (x: Int) -&gt; Int in x * 2 } gibi anonim fonksiyon bloğu</li><li><strong>Trailing Closure Syntax</strong>: Son parametre closure ise parantez dışına yazılabilmesi</li><li><strong>Capturing Values</strong>: Closure’ların tanımlandıkları scope’taki değişkenleri “yakalayabilmesi”</li></ul><pre>func islemYap(_ a: Int, _ b: Int, islem: (Int, Int) -&gt; Int) -&gt; Int {  <br>  return islem(a, b)  <br>}</pre><pre>let toplam = islemYap(3, 4) { x, y in x + y }    // trailing closure syntax</pre><pre>func sayacUret() -&gt; () -&gt; Int {  <br>  var sayi = 0  <br>  return {  <br>    sayi += 1                  // dış scope&#39;taki &#39;sayi&#39; değişkenini yakalar  <br>    return sayi  <br>  }  <br>}<br>let sayac = sayacUret()<br>print(sayac(), sayac(), sayac())    // 1 2 3</pre><h3>15. Property Wrappers</h3><ul><li><strong>@propertyWrapper</strong>: Bir property’nin get/set davranışını yeniden kullanılabilir hale getiren yapı</li><li><strong>@State, @Published, @AppStorage</strong>: SwiftUI ve Combine’da sık kullanılan hazır property wrapper’lar</li></ul><pre>@propertyWrapper  <br>struct Kirpilmis {  <br>  private var deger: Int  <br>  private let aralik: ClosedRange&lt;Int&gt;</pre><pre>  init(wrappedValue: Int, _ aralik: ClosedRange&lt;Int&gt;) {  <br>    self.aralik = aralik  <br>    self.deger = min(max(wrappedValue, aralik.lowerBound), aralik.upperBound)  <br>  }</pre><pre>  var wrappedValue: Int {  <br>    get { deger }  <br>    set { deger = min(max(newValue, aralik.lowerBound), aralik.upperBound) }  <br>  }  <br>}</pre><pre>struct Ayarlar {  <br>  @Kirpilmis(0...100) var sesSeviyesi: Int = 50  <br>}<br>var ayarlar = Ayarlar()<br>ayarlar.sesSeviyesi = 150<br>print(ayarlar.sesSeviyesi)      // 100, otomatik sınırlandı</pre><h3>16. Computed Properties, Lazy ve Property Observers</h3><ul><li><strong>Computed Property</strong>: Değeri saklamak yerine her erişimde hesaplanan property</li><li><strong>lazy</strong>: İlk erişimde hesaplanıp cache’lenen property</li><li><strong>didSet/willSet</strong>: Property değiştiğinde/değişmeden önce tetiklenen observer’lar</li></ul><pre>struct Dikdortgen {  <br>  var genislik: Double  <br>  var yukseklik: Double</pre><pre>  var alan: Double {                     // computed property  <br>    genislik * yukseklik  <br>  }  <br>}</pre><pre>class VeriYoneticisi {  <br>  lazy var agirVeri: [Int] = {  <br>    print(&quot;Hesaplanıyor...&quot;)  <br>    return (1...1000).map { $0 * $0 }    // sadece ilk erişimde çalışır  <br>  }()</pre><pre>  var sayac: Int = 0 {  <br>    didSet {  <br>      print(&quot;\(oldValue) -&gt; \(sayac) olarak değişti&quot;)  <br>    }  <br>  }  <br>}</pre><h3>17. Error Handling</h3><ul><li><strong>do/catch/try</strong>: Swift’in hata yönetimi söz dizimi</li><li><strong>throws</strong>: Hata fırlatabilen fonksiyonları işaretleme</li><li><strong>Error Protocol</strong>: Özel hata tiplerinin uyması gereken temel protokol</li></ul><pre>enum AgHatasi: Error {  <br>  case baglantiYok  <br>  case sunucuHatasi(kod: Int)  <br>}</pre><pre>func veriGetir() throws -&gt; String {  <br>  guard baglantiVar else {  <br>    throw AgHatasi.baglantiYok  <br>  }<br>  return &quot;veri&quot;  <br>}</pre><pre>do {  <br>  let veri = try veriGetir()  <br>  print(veri)  <br>} catch AgHatasi.baglantiYok {  <br>  print(&quot;Bağlantı yok&quot;)  <br>} catch {  <br>  print(&quot;Bilinmeyen hata: \(error)&quot;)  <br>}</pre><h3>18. Memory Management: ARC</h3><ul><li><strong>ARC (Automatic Reference Counting)</strong>: Class örneklerinin bellekte ne zaman serbest bırakılacağını otomatik yöneten sistem</li><li><strong>Retain Cycle</strong>: İki nesnenin birbirini güçlü referansla tutup bellek sızıntısına yol açması</li><li><strong>weak / unowned</strong>: Retain cycle’ı kırmak için kullanılan zayıf referans türleri</li></ul><pre>class Kullanici {  <br>  var isim: String  <br>  var kart: KrediKarti?  <br>  init(isim: String) { self.isim = isim }  <br>}</pre><pre>class KrediKarti {  <br>  weak var sahip: Kullanici?     // weak: retain cycle&#39;ı kırar, opsiyonel olmalı  <br>  init(sahip: Kullanici) { self.sahip = sahip }  <br>}</pre><pre>let kullanici = Kullanici(isim: &quot;Ali&quot;)<br>let kart = KrediKarti(sahip: kullanici)<br>kullanici.kart = kart           // weak sayesinde döngüsel güçlü referans oluşmuyor</pre><h3>19. Concurrency: async/await ve Task</h3><ul><li><strong>async/await</strong>: Asenkron kodu senkron gibi okunabilir şekilde yazma</li><li><strong>Task</strong>: Asenkron bir iş birimini başlatan yapı</li><li><strong>Structured Concurrency</strong>: Task’ların parent-child ilişkisiyle güvenli şekilde yönetilmesi</li></ul><pre>func kullaniciGetir(id: String) async throws -&gt; Kullanici {  <br>  let (data, _) = try await URLSession.shared.data(from: url)  <br>  return try JSONDecoder().decode(Kullanici.self, from: data)  <br>}</pre><pre>Task {  <br>  do {  <br>    let kullanici = try await kullaniciGetir(id: &quot;1&quot;)  <br>    print(kullanici)  <br>  } catch {  <br>    print(&quot;Hata: \(error)&quot;)  <br>  }  <br>}</pre><pre>func hepsiniGetir() async throws -&gt; [Kullanici] {  <br>  async let k1 = kullaniciGetir(id: &quot;1&quot;)   // paralel başlatılır  <br>  async let k2 = kullaniciGetir(id: &quot;2&quot;)  <br>  return try await [k1, k2]  <br>}</pre><h3>20. Actors</h3><ul><li><strong>actor</strong>: Veri yarışlarını (data race) derleme zamanında önleyen, thread-safe referans tipi</li><li><strong>Actor Isolation</strong>: Bir actor’ün state’ine sadece await ile, sıralı şekilde erişilebilmesi</li></ul><pre>actor SayacDeposu {  <br>  private var deger = 0</pre><pre>  func artir() {  <br>    deger += 1  <br>  }</pre><pre>  func mevcutDeger() -&gt; Int {  <br>    return deger  <br>  }  <br>}</pre><pre>let depo = SayacDeposu()<br>Task {  <br>  await depo.artir()               // actor dışından erişim await gerektirir  <br>  print(await depo.mevcutDeger())  <br>}</pre><h3>21. Combine: Reaktif Programlama</h3><ul><li><strong>Publisher/Subscriber</strong>: Combine’ın veri akışını modelleyen temel yapı taşları</li><li><strong>@Published</strong>: Bir property’nin değişimini otomatik olarak yayınlayan property wrapper</li><li><strong>Operators</strong>: map, filter, combineLatest gibi akış üzerinde çalışan operatörler</li></ul><pre>import Combine</pre><pre>class ViewModel: ObservableObject {  <br>  @Published var arananMetin: String = &quot;&quot;  <br>  private var iptaller = Set&lt;AnyCancellable&gt;()</pre><pre>  init() {  <br>    $arananMetin  <br>      .debounce(for: .milliseconds(300), scheduler: RunLoop.main)  <br>      .sink { deger in  <br>        print(&quot;Aranan: \(deger)&quot;)  <br>      }  <br>      .store(in: &amp;iptaller)  <br>  }  <br>}</pre><h3>22. Access Control</h3><ul><li><strong>private/fileprivate</strong>: Aynı sınıf/dosya dışına kapalı erişim seviyeleri</li><li><strong>internal</strong>: Varsayılan seviye, aynı modül içinde erişilebilir</li><li><strong>public/open</strong>: Modül dışından erişilebilen, open ayrıca override/kalıtıma da açık</li></ul><pre>public class Servis {  <br>  private var apiKey: String = &quot;gizli&quot;     // sadece Servis içinde erişilebilir  <br>  internal var timeout: Int = 30           // aynı modül içinde erişilebilir  <br>  public func calistir() { }               // modül dışından çağrılabilir  <br>  open func override edilebilir() { }      // başka modüllerde override edilebilir  <br>}</pre><h3>23. Swift Package Manager</h3><ul><li><strong>Package.swift</strong>: Bağımlılıkları ve modül yapısını tanımlayan manifest dosyası</li><li><strong>Local &amp; Remote Packages</strong>: Hem yerel modülleri hem GitHub üzerindeki paketleri ekleyebilme</li><li><strong>Target</strong>: Bir paket içindeki bağımsız derlenebilir birim</li></ul><pre>// Package.swift<br>let package = Package(  <br>  name: &quot;MyLibrary&quot;,  <br>  products: [.library(name: &quot;MyLibrary&quot;, targets: [&quot;MyLibrary&quot;])],  <br>  dependencies: [  <br>    .package(url: &quot;https://github.com/apple/swift-collections&quot;, from: &quot;1.0.0&quot;)  <br>  ],  <br>  targets: [.target(name: &quot;MyLibrary&quot;, dependencies: [&quot;swift-collections&quot;])]  <br>)</pre><h3>24. Testing: XCTest</h3><ul><li><strong>XCTest</strong>: Apple’ın resmi unit ve UI test framework’ü</li><li><strong>XCTAssert Ailesi</strong>: XCTAssertEqual, XCTAssertTrue, XCTAssertThrowsError gibi doğrulama fonksiyonları</li><li><strong>Async Testleri</strong>: async fonksiyonları doğrudan test metodunda await ile çağırabilme</li></ul><pre>import XCTest</pre><pre>final class HesapMakinesiTests: XCTestCase {  <br>  func testToplama() {  <br>    let sonuc = HesapMakinesi().topla(2, 3)  <br>    XCTAssertEqual(sonuc, 5)  <br>  }</pre><pre>  func testKullaniciGetirme() async throws {  <br>    let kullanici = try await Servis().kullaniciGetir(id: &quot;1&quot;)  <br>    XCTAssertEqual(kullanici.isim, &quot;Ali&quot;)  <br>  }  <br>}</pre><h3>25. Production’da Bilinmesi Gereken Diğer Konular</h3><ul><li><strong>Swift 6 Strict Concurrency</strong>: Derleme zamanında veri yarışlarını tamamen engelleyen yeni concurrency modeli</li><li><strong>Swift Macros</strong>: Tekrarlayan kodu derleme zamanında otomatik üreten yeni dil özelliği</li><li><strong>@MainActor</strong>: Bir tipin veya fonksiyonun her zaman ana thread’de çalışmasını garanti eden anotasyon</li><li><strong>Codable</strong>: JSON gibi formatlarla Swift tipleri arasında otomatik dönüşüm sağlayan protokol</li></ul><pre>@MainActor  <br>class UIYoneticisi: ObservableObject {  <br>  @Published var yukleniyor: Bool = false   // her zaman ana thread&#39;de güncellenir  <br>}</pre><pre>struct Kullanici: Codable {  <br>  let id: String  <br>  let isim: String  <br>}<br>let json = try JSONEncoder().encode(kullanici)<br>let geri = try JSONDecoder().decode(Kullanici.self, from: json)</pre><h3>Terimler Sözlüğü</h3><h3>Dil Temelleri</h3><ul><li><strong>let / var</strong>: Sırasıyla değiştirilemez ve değiştirilebilir referans/değer tanımlayan anahtar kelimeler.</li><li><strong>Optional</strong>: Bir değerin olabilir ya da olmayabilir olduğunu ifade eden tip sistemi özelliği.</li><li><strong>guard</strong>: Erken çıkış için kullanılan, happy path’i düz tutan kontrol yapısı.</li><li><strong>Extension</strong>: Var olan bir tipe dışarıdan fonksiyonellik ekleme yeteneği.</li></ul><h3>Tip Sistemi</h3><ul><li><strong>Struct</strong>: Kopyalandığında yeni örnek oluşturan value type.</li><li><strong>Class</strong>: Referans paylaşan, kalıtım destekleyen reference type.</li><li><strong>Enum</strong>: Associated value taşıyabilen, sabit değer kümesini temsil eden tip.</li><li><strong>Protocol</strong>: Uyulması gereken bir sözleşme tanımlayan, interface benzeri yapı.</li></ul><h3>Fonksiyonel Programlama</h3><ul><li><strong>Closure</strong>: Anonim fonksiyon bloğu.</li><li><strong>Higher-Order Function</strong>: Fonksiyon alan veya döndüren fonksiyon.</li><li><strong>map / filter / reduce</strong>: Koleksiyonlar üzerinde fonksiyonel dönüşüm operatörleri.</li><li><strong>Trailing Closure</strong>: Son parametrenin closure olduğu durumda parantez dışı yazım.</li></ul><h3>Concurrency</h3><ul><li><strong>async/await</strong>: Asenkron kodu senkron gibi yazmayı sağlayan söz dizimi.</li><li><strong>Task</strong>: Asenkron bir iş birimini başlatan yapı.</li><li><strong>Actor</strong>: Veri yarışlarını derleme zamanında önleyen thread-safe referans tipi.</li><li><strong>@MainActor</strong>: Ana thread’de çalışmayı garanti eden anotasyon.</li></ul><h3>Bellek Yönetimi</h3><ul><li><strong>ARC</strong>: Class örneklerinin bellek yönetimini otomatikleştiren sistem.</li><li><strong>Retain Cycle</strong>: İki nesnenin birbirini tutarak yarattığı bellek sızıntısı.</li><li><strong>weak / unowned</strong>: Retain cycle’ı kıran zayıf referans türleri.</li></ul><h3>Kaynaklar</h3><h3>Dil Temelleri</h3><ul><li><strong>Swift Resmi Dokümantasyon</strong> =&gt; <a href="https://www.swift.org/documentation/">https://www.swift.org/documentation/</a></li><li><strong>The Swift Programming Language (Kitap)</strong> =&gt; <a href="https://docs.swift.org/swift-book/">https://docs.swift.org/swift-book/</a></li><li><strong>Swift API Design Guidelines</strong> =&gt; <a href="https://www.swift.org/documentation/api-design-guidelines/">https://www.swift.org/documentation/api-design-guidelines/</a></li></ul><h3>Concurrency</h3><ul><li><strong>Swift Concurrency</strong> =&gt; <a href="https://developer.apple.com/documentation/swift/concurrency">https://developer.apple.com/documentation/swift/concurrency</a></li><li><strong>Swift Evolution: Structured Concurrency</strong> =&gt; <a href="https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md">https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md</a></li></ul><h3>Reaktif Programlama</h3><ul><li><strong>Combine</strong> =&gt; <a href="https://developer.apple.com/documentation/combine">https://developer.apple.com/documentation/combine</a></li></ul><h3>Package Yönetimi</h3><ul><li><strong>Swift Package Manager</strong> =&gt; <a href="https://www.swift.org/documentation/package-manager/">https://www.swift.org/documentation/package-manager/</a></li></ul><h3>Testing</h3><ul><li><strong>XCTest</strong> =&gt; <a href="https://developer.apple.com/documentation/xctest">https://developer.apple.com/documentation/xctest</a></li></ul><h3>Diğer / Genel</h3><ul><li><strong>Codable</strong> =&gt; <a href="https://developer.apple.com/documentation/swift/codable">https://developer.apple.com/documentation/swift/codable</a></li><li><strong>Swift Macros</strong> =&gt; <a href="https://www.swift.org/documentation/swift-macros/">https://www.swift.org/documentation/swift-macros/</a></li><li><strong>Memory Safety</strong> =&gt; <a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/memorysafety/">https://docs.swift.org/swift-book/documentation/the-swift-programming-language/memorysafety/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ea6d85ce713" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Terse | Swift (English)]]></title>
            <link>https://medium.com/@zbiyikli1/mobile-terse-swift-english-29863e82b9c6?source=rss-2a49201a428e------2</link>
            <guid isPermaLink="false">https://medium.com/p/29863e82b9c6</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Zekibiyikli]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 11:22:15 GMT</pubDate>
            <atom:updated>2026-07-19T11:22:15.041Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4dspxBxnGFhUTPlMN45ew.png" /></figure><p>“This is a roadmap — you need to dive deep into each topic on your own”</p><h3>1. Basic Syntax &amp; Type System</h3><ul><li><strong>let vs var</strong>: let defines an immutable reference/value, var a mutable one</li><li><strong>Type Inference</strong>: Swift infers the type automatically in most cases</li><li><strong>Static Typing</strong>: type safety is enforced at compile time</li></ul><pre>let name: String = &quot;John&quot;       // explicit type<br>let age = 28                    // inferred type (Int)<br>var counter = 0                 // mutable</pre><pre>let status = age &gt;= 18 ? &quot;adult&quot; : &quot;minor&quot;   // ternary expression</pre><h3>2. Optionals: Null Safety</h3><ul><li><strong>?</strong>: an optional type indicating a value may or may not be present</li><li><strong>if let / </strong><strong>guard let</strong>: safely unwrapping an optional</li><li><strong>??</strong>: the nil-coalescing operator, a default value when nil</li><li><strong>!</strong>: force unwrap — risks a runtime crash if nil</li></ul><pre>var name: String? = nil</pre><pre>if let unwrappedName = name {  <br>  print(&quot;Name: \(unwrappedName)&quot;)       // only runs if not nil  <br>}</pre><pre>guard let unwrappedName = name else {  <br>  print(&quot;No name, exiting the function&quot;)  <br>  return  <br>}</pre><pre>let length = name?.count ?? 0           // 0 if nil<br>let risky = name!.count                 // crashes if nil</pre><h3>3. Functions</h3><ul><li><strong>Parameter Labels</strong>: separating external and internal names for readable calls</li><li><strong>Default Values</strong>: defining default values for parameters</li><li><strong>inout Parameters</strong>: modifying a parameter directly inside the function</li><li><strong>Variadic Parameters</strong>: accepting a variable number of parameters</li></ul><pre>func greet(name: String, message customMessage: String = &quot;Hello&quot;) -&gt; String {  <br>  return &quot;\(customMessage), \(name)!&quot;  <br>}</pre><pre>greet(name: &quot;Jane&quot;)                          // &quot;Hello, Jane!&quot;<br>greet(name: &quot;Jane&quot;, message: &quot;Hi&quot;)           // external name: message</pre><pre>func double(_ number: inout Int) {  <br>  number *= 2  <br>}<br>var x = 5<br>double(&amp;x)                                   // x is now 10</pre><h3>4. Control Flow</h3><ul><li><strong>switch</strong>: a pattern-matching construct requiring exhaustive coverage</li><li><strong>guard</strong>: used for early exits, keeping the “happy path” flat</li><li><strong>Ranges</strong>: 1...10, 0..&lt;10, stride(from:to:by:)</li></ul><pre>func describe(_ x: Any) -&gt; String {  <br>  switch x {  <br>  case let number as Int where number &gt; 0:  <br>    return &quot;Positive number: \(number)&quot;  <br>  case let text as String:  <br>    return &quot;Text: \(text)&quot;  <br>  default:  <br>    return &quot;Unknown&quot;  <br>  }  <br>}</pre><pre>for i in stride(from: 10, to: 0, by: -2) { print(i, terminator: &quot; &quot;) }   // 10 8 6 4 2</pre><h3>5. Struct vs Class (Value Type vs Reference Type)</h3><ul><li><strong>Struct</strong>: a value type that creates a new instance when copied — Swift’s default preference</li><li><strong>Class</strong>: a reference type that shares references, requires inheritance and ARC memory management</li><li><strong>Which to Use</strong>: struct for simple data models, class for identity and shared state</li></ul><pre>struct Point {  <br>  var x: Int  <br>  var y: Int  <br>}</pre><pre>var p1 = Point(x: 0, y: 0)<br>var p2 = p1                    // copied, independent from p1<br>p2.x = 10<br>print(p1.x, p2.x)              // 0 10 — value type behavior</pre><pre>class User {  <br>  var name: String  <br>  init(name: String) { self.name = name }  <br>}</pre><pre>let u1 = User(name: &quot;Alice&quot;)<br>let u2 = u1                    // same reference<br>u2.name = &quot;Bob&quot;<br>print(u1.name)                 // &quot;Bob&quot; — reference type behavior</pre><h3>6. Enum &amp; Associated Values</h3><ul><li><strong>Enum</strong>: represents a fixed set of values, can also carry methods and computed properties in Swift</li><li><strong>Associated Values</strong>: each case can carry its own additional data</li><li><strong>Pattern Matching</strong>: resolving associated values with switch</li></ul><pre>enum Result&lt;T&gt; {  <br>  case success(T)  <br>  case failure(String)  <br>}</pre><pre>func show(_ result: Result&lt;String&gt;) {  <br>  switch result {  <br>  case .success(let data):  <br>    print(&quot;Data: \(data)&quot;)  <br>  case .failure(let message):  <br>    print(&quot;Error: \(message)&quot;)  <br>  }  <br>}</pre><pre>enum Direction: String, CaseIterable {  <br>  case north, south, east, west  <br>}</pre><h3>7. Static Members &amp; Singleton</h3><ul><li><strong>static let/var</strong>: members tied to the type, not to an instance — Swift’s counterpart to Kotlin’s companion object</li><li><strong>Singleton Pattern</strong>: creating a single shared instance with static let shared</li></ul><pre>class SettingsManager {  <br>  static let shared = SettingsManager()   // single instance  <br>  private init() {}                        // no other instance can be created</pre><pre>  var darkTheme: Bool = false  <br>}</pre><pre>SettingsManager.shared.darkTheme = true   // accessed as the same instance everywhere</pre><h3>8. Protocols</h3><ul><li><strong>Protocol</strong>: Swift’s counterpart to an interface, defining a contract that must be conformed to</li><li><strong>Protocol Conformance</strong>: a struct/class/enum conforming to a protocol</li><li><strong>Protocol Composition</strong>: combining multiple protocols with &amp;</li></ul><pre>protocol Loggable {  <br>  func log(_ message: String)  <br>}</pre><pre>struct Service: Loggable {  <br>  func log(_ message: String) {  <br>    print(&quot;[LOG] \(message)&quot;)  <br>  }  <br>}</pre><pre>func process(_ object: Loggable &amp; CustomStringConvertible) {  <br>  object.log(&quot;processing started&quot;)  <br>}</pre><h3>9. Protocol-Oriented Programming &amp; Protocol Extensions</h3><ul><li><strong>Protocol Extension</strong>: adding a default implementation to a protocol</li><li><strong>POP vs OOP</strong>: Swift encourages protocol-based composition over inheritance</li></ul><pre>protocol Loggable {  <br>  func log(_ message: String)  <br>}</pre><pre>extension Loggable {  <br>  func log(_ message: String) {           // default implementation  <br>    print(&quot;[LOG] \(message)&quot;)  <br>  }  <br>}</pre><pre>struct Service: Loggable {}               // gets the implementation for free<br>Service().log(&quot;hello&quot;)</pre><h3>10. Extensions</h3><ul><li><strong>Extension</strong>: adding new functionality to an existing type — even ones you didn’t write</li><li><strong>Adding Computed Properties</strong>: defining a computed property in an extension without stored state</li></ul><pre>extension Int {  <br>  var doubled: Int { self * 2 }  </pre><pre>  func squared() -&gt; Int {  <br>    return self * self  <br>  }  <br>}</pre><pre>print(5.doubled)      // 10<br>print(5.squared())    // 25</pre><h3>11. Inheritance &amp; Polymorphism</h3><ul><li><strong>Inheritance Is Class-Only</strong>: structs and enums can’t inherit, only conform to protocols</li><li><strong>override</strong>: mandatory keyword to redefine a method from a superclass</li><li><strong>final</strong>: prevents a class or method from being overridden</li></ul><pre>class Shape {  <br>  func area() -&gt; Double { 0.0 }  <br>}</pre><pre>class Circle: Shape {  <br>  let radius: Double  <br>  init(radius: Double) { self.radius = radius }  </pre><pre>  override func area() -&gt; Double {  <br>    return Double.pi * radius * radius  <br>  }  <br>}</pre><pre>let shapes: [Shape] = [Shape(), Circle(radius: 3)]<br>shapes.forEach { print($0.area()) }    // polymorphism: each runs its own area()</pre><h3>12. Generics</h3><ul><li><strong>Generic Functions &amp; Types</strong>: structures that take a type parameter</li><li><strong>Type Constraints</strong>: constraining a generic type, e.g. &lt;T: Comparable&gt;</li><li><strong>Associated Types</strong>: a generic-like type in protocols that stays abstract until used</li></ul><pre>struct Box&lt;T&gt; {  <br>  let content: T  <br>}</pre><pre>func larger&lt;T: Comparable&gt;(_ a: T, _ b: T) -&gt; T {  <br>  return a &gt; b ? a : b  <br>}</pre><pre>protocol Storage {  <br>  associatedtype Element  <br>  func add(_ element: Element)  <br>}</pre><h3>13. Collections &amp; Functional Operations</h3><ul><li><strong>Array, Set, Dictionary</strong>: Swift’s core collection types</li><li><strong>map, filter, reduce</strong>: chaining functional transformations</li><li><strong>compactMap</strong>: transforming while dropping nil values</li></ul><pre>struct User {  <br>  let name: String  <br>  let age: Int  <br>  let active: Bool  <br>}</pre><pre>let users = [  <br>  User(name: &quot;Alice&quot;, age: 25, active: true),  <br>  User(name: &quot;Bob&quot;, age: 17, active: true),  <br>  User(name: &quot;Carl&quot;, age: 30, active: false)  <br>]</pre><pre>let result = users  <br>  .filter { $0.active }  <br>  .map { $0.name.uppercased() }  <br>  .sorted()<br>// [&quot;ALICE&quot;, &quot;BOB&quot;]</pre><pre>let strings = [&quot;1&quot;, &quot;two&quot;, &quot;3&quot;]<br>let validNumbers = strings.compactMap { Int($0) }   // [1, 3], &quot;two&quot; is dropped</pre><h3>14. Closures &amp; Higher-Order Functions</h3><ul><li><strong>Closure</strong>: an anonymous function block like { (x: Int) -&gt; Int in x * 2 }</li><li><strong>Trailing Closure Syntax</strong>: if the last parameter is a closure, it can be written outside the parentheses</li><li><strong>Capturing Values</strong>: closures can “capture” variables from the scope where they’re defined</li></ul><pre>func compute(_ a: Int, _ b: Int, operation: (Int, Int) -&gt; Int) -&gt; Int {  <br>  return operation(a, b)  <br>}</pre><pre>let sum = compute(3, 4) { x, y in x + y }    // trailing closure syntax</pre><pre>func makeCounter() -&gt; () -&gt; Int {  <br>  var count = 0  <br>  return {  <br>    count += 1                 // captures &#39;count&#39; from the enclosing scope  <br>    return count  <br>  }  <br>}<br>let counter = makeCounter()<br>print(counter(), counter(), counter())    // 1 2 3</pre><h3>15. Property Wrappers</h3><ul><li><strong>@propertyWrapper</strong>: a construct that makes a property’s get/set behavior reusable</li><li><strong>@State, @Published, @AppStorage</strong>: commonly used built-in property wrappers in SwiftUI and Combine</li></ul><pre>@propertyWrapper  <br>struct Clamped {  <br>  private var value: Int  <br>  private let range: ClosedRange&lt;Int&gt;</pre><pre>  init(wrappedValue: Int, _ range: ClosedRange&lt;Int&gt;) {  <br>    self.range = range  <br>    self.value = min(max(wrappedValue, range.lowerBound), range.upperBound)  <br>  }</pre><pre>  var wrappedValue: Int {  <br>    get { value }  <br>    set { value = min(max(newValue, range.lowerBound), range.upperBound) }  <br>  }  <br>}</pre><pre>struct Settings {  <br>  @Clamped(0...100) var volume: Int = 50  <br>}<br>var settings = Settings()<br>settings.volume = 150<br>print(settings.volume)      // 100, automatically clamped</pre><h3>16. Computed Properties, Lazy &amp; Property Observers</h3><ul><li><strong>Computed Property</strong>: a property recalculated on every access instead of stored</li><li><strong>lazy</strong>: a property computed and cached on first access</li><li><strong>didSet/willSet</strong>: observers triggered before/after a property changes</li></ul><pre>struct Rectangle {  <br>  var width: Double  <br>  var height: Double</pre><pre>  var area: Double {                     // computed property  <br>    width * height  <br>  }  <br>}</pre><pre>class DataManager {  <br>  lazy var heavyData: [Int] = {  <br>    print(&quot;Computing...&quot;)  <br>    return (1...1000).map { $0 * $0 }    // runs only on first access  <br>  }()</pre><pre>  var counter: Int = 0 {  <br>    didSet {  <br>      print(&quot;\(oldValue) changed to \(counter)&quot;)  <br>    }  <br>  }  <br>}</pre><h3>17. Error Handling</h3><ul><li><strong>do/catch/try</strong>: Swift’s error handling syntax</li><li><strong>throws</strong>: marking functions that can throw an error</li><li><strong>Error Protocol</strong>: the base protocol custom error types must conform to</li></ul><pre>enum NetworkError: Error {  <br>  case noConnection  <br>  case serverError(code: Int)  <br>}</pre><pre>func fetchData() throws -&gt; String {  <br>  guard hasConnection else {  <br>    throw NetworkError.noConnection  <br>  }<br>  return &quot;data&quot;  <br>}</pre><pre>do {  <br>  let data = try fetchData()  <br>  print(data)  <br>} catch NetworkError.noConnection {  <br>  print(&quot;No connection&quot;)  <br>} catch {  <br>  print(&quot;Unknown error: \(error)&quot;)  <br>}</pre><h3>18. Memory Management: ARC</h3><ul><li><strong>ARC (Automatic Reference Counting)</strong>: the system that automatically manages when class instances are freed from memory</li><li><strong>Retain Cycle</strong>: two objects holding strong references to each other, causing a memory leak</li><li><strong>weak / unowned</strong>: weak reference types used to break retain cycles</li></ul><pre>class User {  <br>  var name: String  <br>  var card: CreditCard?  <br>  init(name: String) { self.name = name }  <br>}</pre><pre>class CreditCard {  <br>  weak var owner: User?     // weak: breaks the retain cycle, must be optional  <br>  init(owner: User) { self.owner = owner }  <br>}</pre><pre>let user = User(name: &quot;Alice&quot;)<br>let card = CreditCard(owner: user)<br>user.card = card           // no circular strong reference thanks to weak</pre><h3>19. Concurrency: async/await &amp; Task</h3><ul><li><strong>async/await</strong>: writing asynchronous code that reads like synchronous code</li><li><strong>Task</strong>: a construct that launches a unit of asynchronous work</li><li><strong>Structured Concurrency</strong>: safely managing tasks through a parent-child relationship</li></ul><pre>func getUser(id: String) async throws -&gt; User {  <br>  let (data, _) = try await URLSession.shared.data(from: url)  <br>  return try JSONDecoder().decode(User.self, from: data)  <br>}</pre><pre>Task {  <br>  do {  <br>    let user = try await getUser(id: &quot;1&quot;)  <br>    print(user)  <br>  } catch {  <br>    print(&quot;Error: \(error)&quot;)  <br>  }  <br>}</pre><pre>func fetchAll() async throws -&gt; [User] {  <br>  async let u1 = getUser(id: &quot;1&quot;)   // started in parallel  <br>  async let u2 = getUser(id: &quot;2&quot;)  <br>  return try await [u1, u2]  <br>}</pre><h3>20. Actors</h3><ul><li><strong>actor</strong>: a thread-safe reference type that prevents data races at compile time</li><li><strong>Actor Isolation</strong>: an actor’s state can only be accessed sequentially, via await</li></ul><pre>actor CounterStore {  <br>  private var value = 0</pre><pre>  func increment() {  <br>    value += 1  <br>  }</pre><pre>  func currentValue() -&gt; Int {  <br>    return value  <br>  }  <br>}</pre><pre>let store = CounterStore()<br>Task {  <br>  await store.increment()          // access from outside the actor requires await  <br>  print(await store.currentValue())  <br>}</pre><h3>21. Combine: Reactive Programming</h3><ul><li><strong>Publisher/Subscriber</strong>: the core building blocks Combine uses to model data streams</li><li><strong>@Published</strong>: a property wrapper that automatically publishes changes to a property</li><li><strong>Operators</strong>: stream operators like map, filter, combineLatest</li></ul><pre>import Combine</pre><pre>class ViewModel: ObservableObject {  <br>  @Published var searchText: String = &quot;&quot;  <br>  private var cancellables = Set&lt;AnyCancellable&gt;()</pre><pre>  init() {  <br>    $searchText  <br>      .debounce(for: .milliseconds(300), scheduler: RunLoop.main)  <br>      .sink { value in  <br>        print(&quot;Searching: \(value)&quot;)  <br>      }  <br>      .store(in: &amp;cancellables)  <br>  }  <br>}</pre><h3>22. Access Control</h3><ul><li><strong>private/fileprivate</strong>: access levels closed off outside the class/file</li><li><strong>internal</strong>: the default level, accessible within the same module</li><li><strong>public/open</strong>: accessible from outside the module, with open also allowing override/inheritance</li></ul><pre>public class Service {  <br>  private var apiKey: String = &quot;secret&quot;    // only accessible within Service  <br>  internal var timeout: Int = 30           // accessible within the same module  <br>  public func run() { }                    // callable from outside the module  <br>  open func overridable() { }              // can be overridden in other modules  <br>}</pre><h3>23. Swift Package Manager</h3><ul><li><strong>Package.swift</strong>: the manifest file defining dependencies and module structure</li><li><strong>Local &amp; Remote Packages</strong>: adding both local modules and packages hosted on GitHub</li><li><strong>Target</strong>: an independently compilable unit within a package</li></ul><pre>// Package.swift<br>let package = Package(  <br>  name: &quot;MyLibrary&quot;,  <br>  products: [.library(name: &quot;MyLibrary&quot;, targets: [&quot;MyLibrary&quot;])],  <br>  dependencies: [  <br>    .package(url: &quot;https://github.com/apple/swift-collections&quot;, from: &quot;1.0.0&quot;)  <br>  ],  <br>  targets: [.target(name: &quot;MyLibrary&quot;, dependencies: [&quot;swift-collections&quot;])]  <br>)</pre><h3>24. Testing: XCTest</h3><ul><li><strong>XCTest</strong>: Apple’s official unit and UI testing framework</li><li><strong>XCTAssert Family</strong>: assertion functions like XCTAssertEqual, XCTAssertTrue, XCTAssertThrowsError</li><li><strong>Async Tests</strong>: calling async functions directly with await inside a test method</li></ul><pre>import XCTest</pre><pre>final class CalculatorTests: XCTestCase {  <br>  func testAddition() {  <br>    let result = Calculator().add(2, 3)  <br>    XCTAssertEqual(result, 5)  <br>  }</pre><pre>  func testFetchUser() async throws {  <br>    let user = try await Service().getUser(id: &quot;1&quot;)  <br>    XCTAssertEqual(user.name, &quot;Alice&quot;)  <br>  }  <br>}</pre><h3>25. Other Things You Should Know in Production</h3><ul><li><strong>Swift 6 Strict Concurrency</strong>: a new concurrency model that fully prevents data races at compile time</li><li><strong>Swift Macros</strong>: an emerging language feature that auto-generates repetitive code at compile time</li><li><strong>@MainActor</strong>: an annotation guaranteeing a type or function always runs on the main thread</li><li><strong>Codable</strong>: a protocol enabling automatic conversion between Swift types and formats like JSON</li></ul><pre>@MainActor  <br>class UIManager: ObservableObject {  <br>  @Published var isLoading: Bool = false   // always updated on the main thread  <br>}</pre><pre>struct User: Codable {  <br>  let id: String  <br>  let name: String  <br>}<br>let json = try JSONEncoder().encode(user)<br>let decoded = try JSONDecoder().decode(User.self, from: json)</pre><h3>Glossary of Terms</h3><h3>Language Fundamentals</h3><ul><li><strong>let / var</strong>: keywords defining immutable and mutable references/values, respectively.</li><li><strong>Optional</strong>: a type system feature indicating a value may or may not be present.</li><li><strong>guard</strong>: a control-flow construct for early exits, keeping the happy path flat.</li><li><strong>Extension</strong>: the ability to add functionality to an existing type from the outside.</li></ul><h3>Type System</h3><ul><li><strong>Struct</strong>: a value type that creates a new instance when copied.</li><li><strong>Class</strong>: a reference type that shares references and supports inheritance.</li><li><strong>Enum</strong>: a type representing a fixed set of values, capable of carrying associated values.</li><li><strong>Protocol</strong>: an interface-like construct defining a contract to conform to.</li></ul><h3>Functional Programming</h3><ul><li><strong>Closure</strong>: an anonymous function block.</li><li><strong>Higher-Order Function</strong>: a function that takes or returns another function.</li><li><strong>map / filter / reduce</strong>: functional transformation operators on collections.</li><li><strong>Trailing Closure</strong>: writing a closure outside the parentheses when it’s the last parameter.</li></ul><h3>Concurrency</h3><ul><li><strong>async/await</strong>: syntax that lets asynchronous code be written like synchronous code.</li><li><strong>Task</strong>: a construct that launches a unit of asynchronous work.</li><li><strong>Actor</strong>: a thread-safe reference type that prevents data races at compile time.</li><li><strong>@MainActor</strong>: an annotation guaranteeing execution on the main thread.</li></ul><h3>Memory Management</h3><ul><li><strong>ARC</strong>: the system that automates memory management for class instances.</li><li><strong>Retain Cycle</strong>: a memory leak caused by two objects holding each other in memory.</li><li><strong>weak / unowned</strong>: weak reference types that break retain cycles.</li></ul><h3>Resources</h3><h3>Language Fundamentals</h3><ul><li><strong>Swift Official Documentation</strong> =&gt; <a href="https://www.swift.org/documentation/">https://www.swift.org/documentation/</a></li><li><strong>The Swift Programming Language (Book)</strong> =&gt; <a href="https://docs.swift.org/swift-book/">https://docs.swift.org/swift-book/</a></li><li><strong>Swift API Design Guidelines</strong> =&gt; <a href="https://www.swift.org/documentation/api-design-guidelines/">https://www.swift.org/documentation/api-design-guidelines/</a></li></ul><h3>Concurrency</h3><ul><li><strong>Swift Concurrency</strong> =&gt; <a href="https://developer.apple.com/documentation/swift/concurrency">https://developer.apple.com/documentation/swift/concurrency</a></li><li><strong>Swift Evolution: Structured Concurrency</strong> =&gt; <a href="https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md">https://github.com/apple/swift-evolution/blob/main/proposals/0304-structured-concurrency.md</a></li></ul><h3>Reactive Programming</h3><ul><li><strong>Combine</strong> =&gt; <a href="https://developer.apple.com/documentation/combine">https://developer.apple.com/documentation/combine</a></li></ul><h3>Package Management</h3><ul><li><strong>Swift Package Manager</strong> =&gt; <a href="https://www.swift.org/documentation/package-manager/">https://www.swift.org/documentation/package-manager/</a></li></ul><h3>Testing</h3><ul><li><strong>XCTest</strong> =&gt; <a href="https://developer.apple.com/documentation/xctest">https://developer.apple.com/documentation/xctest</a></li></ul><h3>Other / General</h3><ul><li><strong>Codable</strong> =&gt; <a href="https://developer.apple.com/documentation/swift/codable">https://developer.apple.com/documentation/swift/codable</a></li><li><strong>Swift Macros</strong> =&gt; <a href="https://www.swift.org/documentation/swift-macros/">https://www.swift.org/documentation/swift-macros/</a></li><li><strong>Memory Safety</strong> =&gt; <a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/memorysafety/">https://docs.swift.org/swift-book/documentation/the-swift-programming-language/memorysafety/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29863e82b9c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>