forked from codecat15/Youtube-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
OperationQueue/BasicDemo/Operation_OperationQueue.playground/Contents.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import UIKit | ||
|
||
/* | ||
this was just a small demo of operation and operation queue in the coming days we will see few more examples with operation queue to explore them in details. If the video was helpful then please do like and share with your iOS group and please do support the channel by subscribing to it and sharing it with your iOS group | ||
|
||
Thank you | ||
~ CodeCat15 | ||
|
||
*/ | ||
|
||
|
||
struct Example | ||
{ | ||
func doWork() { | ||
|
||
let blockOperation = BlockOperation() | ||
|
||
blockOperation.addExecutionBlock { | ||
debugPrint("Hello") | ||
} | ||
|
||
blockOperation.addExecutionBlock { | ||
debugPrint("my name is") | ||
} | ||
|
||
blockOperation.addExecutionBlock { | ||
debugPrint("Ravi") | ||
} | ||
|
||
// blockOperation.start() | ||
|
||
let anotherBlockOperation = BlockOperation() | ||
anotherBlockOperation.addExecutionBlock { | ||
debugPrint("I am another block operation") | ||
} | ||
|
||
let operationQueue = OperationQueue() | ||
operationQueue.qualityOfService = .utility | ||
//operationQueue.addOperation(blockOperation) | ||
// operationQueue.addOperation(anotherBlockOperation) | ||
|
||
operationQueue.addOperations([blockOperation, anotherBlockOperation], waitUntilFinished: false) | ||
|
||
} | ||
} | ||
|
||
let obj = Example() | ||
obj.doWork() |
4 changes: 4 additions & 0 deletions
4
OperationQueue/BasicDemo/Operation_OperationQueue.playground/contents.xcplayground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<playground version='5.0' target-platform='ios' buildActiveScheme='true'> | ||
<timeline fileName='timeline.xctimeline'/> | ||
</playground> |
7 changes: 7 additions & 0 deletions
7
...cDemo/Operation_OperationQueue.playground/playground.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+16.8 KB
...d/playground.xcworkspace/xcuserdata/ravirdixit.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.