Skip to content

Commit

Permalink
Swift Concurrency v0.2 pushed with more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SensehacK committed Apr 25, 2023
1 parent 67d794c commit 93e639e
Show file tree
Hide file tree
Showing 36 changed files with 680 additions and 244 deletions.
147 changes: 66 additions & 81 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"id": "dd4a158ffe1a15b2",
"type": "tabs",
"dimension": 60.15144344533838,
"dimension": 60.6484893146647,
"children": [
{
"id": "6a25767ea83a46c5",
Expand Down Expand Up @@ -37,109 +37,94 @@
},
"pinned": true
}
}
],
"currentTab": 1
},
{
"id": "50ad62547a03ea1f",
"type": "tabs",
"dimension": 39.84855655466162,
"children": [
{
"id": "5c968719c026c29f",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "ios/swiftUI/MVVM_example.md",
"mode": "source",
"backlinks": true,
"source": false
},
"pinned": true
}
},
{
"id": "b6bf584108a82b1f",
"id": "1e67adc31c056023",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "architecture/composable/input_output.md",
"file": "architecture/ReadMe_architecture.md",
"mode": "source",
"backlinks": true,
"source": false
},
"pinned": true
}
}
},
{
"id": "6a782c6ab1913ba1",
"id": "c0968db086fe71e1",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "architecture/composable/viewStateViewModel.md",
"file": "ios/concurrency/actors.md",
"mode": "source",
"backlinks": true,
"source": false
},
"pinned": true
}
}
},
{
"id": "aa1f21e4ebfe1b65",
"id": "8c976337c384f5ec",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "architecture/composable/usage.md",
"file": "ios/concurrency/thread.md",
"mode": "source",
"backlinks": true,
"source": false
},
"pinned": true
}
},
}
],
"currentTab": 3
},
{
"id": "648c3a2de83639d8",
"type": "tabs",
"dimension": 15.843773028739868,
"children": [
{
"id": "81681080152a7fcf",
"id": "98a986cea358123d",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "ios/library/import.md",
"file": "architecture/concurrency.md",
"mode": "source",
"backlinks": true,
"source": false
}
}
},
}
]
},
{
"id": "50ad62547a03ea1f",
"type": "tabs",
"dimension": 23.50773765659543,
"children": [
{
"id": "e5e089229a91b293",
"id": "1b35c90d4293749d",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "architecture/software_updates.md",
"mode": "source",
"backlinks": true,
"source": false
}
"type": "graph",
"state": {},
"pinned": true
}
},
{
"id": "b09d7b071308fc9a",
"id": "d3abdcf2cf367df4",
"type": "leaf",
"pinned": true,
"state": {
"type": "markdown",
"state": {
"file": "SUMMARY.md",
"file": "ios/concurrency/thread.md",
"mode": "source",
"backlinks": true,
"source": false
Expand All @@ -148,7 +133,7 @@
}
}
],
"currentTab": 5
"currentTab": 1
}
],
"direction": "vertical"
Expand Down Expand Up @@ -177,7 +162,7 @@
"state": {
"type": "search",
"state": {
"query": "dynamic",
"query": "nomenclature",
"matchingCase": true,
"explainSearch": false,
"collapseAll": false,
Expand All @@ -198,7 +183,7 @@
}
],
"direction": "horizontal",
"width": 226.00556182861328
"width": 258.0055618286133
},
"right": {
"id": "13f2ec0339a31543",
Expand All @@ -214,7 +199,7 @@
"state": {
"type": "backlink",
"state": {
"file": "architecture/software_updates.md",
"file": "ios/concurrency/actors.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
Expand All @@ -231,7 +216,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "architecture/software_updates.md",
"file": "ios/concurrency/actors.md",
"linksCollapsed": true,
"unlinkedCollapsed": true
}
Expand All @@ -254,7 +239,7 @@
"state": {
"type": "outline",
"state": {
"file": "architecture/software_updates.md"
"file": "ios/concurrency/actors.md"
}
}
}
Expand All @@ -275,34 +260,34 @@
"command-palette:Open command palette": false
}
},
"active": "e5e089229a91b293",
"active": "c0968db086fe71e1",
"lastOpenFiles": [
"ios/library/framework.md",
"architecture/software_updates.md",
"ios/library/import.md",
"architecture/composable/viewStateViewModel.md",
"ios/library/avkit.md",
"architecture/orchestration.md",
"ios/README_iOS.md",
"architecture/navigationCoordinator.md",
"tools/browsers/developer_network.md",
"ios/config/README_config.md",
"os/mac/fresh_install.md",
"ios/lifecycle/README_lifecycle.md",
"ios/lifecycle/database.md",
"ios/config/secret_keys.md",
"ios/swiftUI/image.md",
"ios/lifecycle/cache.md",
"ios/config/cache.md",
"ios/concurrency/background_tasks.md",
"ios/concurrency/asyncLet.md",
"ios/concurrency/asyncAwait.md",
"ios/concurrency/actors.md",
"ios/concurrency/operations.md",
"ios/concurrency/GCD.md",
"ios/concurrency/dispatch_semaphore.md",
"ios/concurrency/dispatch_queue.md",
"ios/concurrency/dispatch_main.md",
"ios/concurrency/dispatch_group.md",
"ios/concurrency/dispatch_barrier.md",
"ios/concurrency/asyncTaskGroup.md",
"architecture/concurrency.md",
"architecture/coordinator_pattern.md",
"architecture/delegate_pattern.md",
"architecture/facade_pattern.md",
"architecture/mvc_pattern.md",
"architecture/mvvm_c_pattern.md",
"architecture/mvvm_pattern.md",
"architecture/notification_pattern.md",
"architecture/ReadMe_architecture.md",
"ios/config/analytics.md",
"ios/config/app_environment.md",
"ios/config/appConfiguration.md",
"ios/config/app_store _connect.md",
"ios/library/storage.md",
"architecture/singleton_pattern.md",
"architecture/software_updates.md",
"architecture/system_designs.md",
"ios/README_iOS.md",
"ios/concurrency/Readme_concurrency.md",
"ios/combine/ReadMe_combine.md",
"ios/ui/README_ui.md",
"architecture/Untitled",
"architecture/composable",
"architecture",
Expand Down
6 changes: 2 additions & 4 deletions architecture/ReadMe_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Enjoy

[[concurrency]]

[mvvm_pattern](mvvm_pattern.md)

[mvc_pattern](mvc_pattern.md)

[singleton_pattern](singleton_pattern.md)
Expand All @@ -28,8 +30,6 @@ Enjoy

[coordinator_pattern](coordinator_pattern.md)

[mvvm_pattern](mvvm_pattern.md)

[mvvm_c_pattern](mvvm_c_pattern.md)

[notification_pattern](notification_pattern.md)
Expand All @@ -42,8 +42,6 @@ Enjoy

## Resources



[Point Free](https://www.pointfree.co/collections/composable-architecture)

[Point Series](https://www.pointfree.co)
9 changes: 7 additions & 2 deletions architecture/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Basic concepts from my understanding.

If you want to quickly jump into Swift Concurrency or iOS Xcode Swift concurrency examples. Please follow this [Readme_concurrency](Readme_concurrency.md) or folder `iOS/concurrency/readME_concurrency`

## Multi Threading | Multi Processing

Expand All @@ -14,11 +15,11 @@ Side note: You can do multi threading on a single processor or do multi tasking

When a piece of work, process, thread, code, executable (machine code) is meant to execute in a blocking or non blocking way.

### Async:
### Async

For example your heart beats in an async fashion it isn't dependent retrospectively for someone's input in order to make the next heart beat to pump blood in your veins of the human body.

### Sync:
### Sync

On the other hand eyes, brain coordinate with each other to send a neuron signal via synapses in order for the human motor functions to operate. So that is in a way synchronous activity. Hands or other body functions are dependent on some other functions when they give signals to do certain task synchronously and when they are doing certain task they do it in somewhat blocking way. Of course human brain is somewhat more capable of scheduling multiple instances of parallel activities such as your mental intuition is still in the works, your five sensory inputs are still working in the background and more.

Expand All @@ -29,10 +30,14 @@ I should have went with a better example since human body mostly works asynchron

A unit of work to be executed by a processor.
Multiple threads can exist on a single process.
[thread](thread.md)


## Process

A collection of threads or units of work to be executed by the OS scheduler is called a process. It may also include shared resources in order to better communicate with other processes or access low level apis with kernel or I/O devices.
[tasks](tasks.md)


## Scheduler

Expand Down
9 changes: 8 additions & 1 deletion architecture/coordinator_pattern.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## Coordinator pattern
# Coordinator pattern


## Intro

Navigation Coordinator pattern -> Passing around navigationContext to take care of presenting and dismissing logic from one point.



## Code

13 changes: 7 additions & 6 deletions architecture/delegate_pattern.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
## Delegate Pattern
# Delegate Pattern


## Intro
1 : 1 type


https://medium.com/@nimjea/delegation-pattern-in-swift-4-2-f6aca61f4bf5


Pros:
## Pros
- No extra management of state. It is one to one.
- Less side effects.


Cons:
## Cons
- Need to be one to one
-
- Not easy to understand at first glance - isn't intuitive if coming from other languages.
- Lots of bigger name delegate functions - more verbiage.
- need to isolate for cleaner readability in extensions with conformance to `delegate / datasource`
25 changes: 24 additions & 1 deletion architecture/facade_pattern.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
## Facade pattern
# Facade pattern

## Intro

When you have abstraction in place to make sure that certain thing could be carried out but you don't know the general specifics of its implementation under the hood.
So you place a facade in that callsite and just assume work or certain tasks / preparations have been taking place in the background which isn't oblivious to the front consumer or onlooker. Thus the facade pattern. It derives from actual civil architecture nomenclature. Houses having a great facade.
















### Tangent

I usually use this to describe human beings, since they are nicer when things are good ( putting up a facade ) but internally they are who they are.
But that's psychology and I don't practice that legally. :P
My two bits `1 0` advice to everyone.
Loading

0 comments on commit 93e639e

Please sign in to comment.