Adding Progress bar - SwiftHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Using a dispatch_once singleton model in SwiftSwift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?Progress bar not showing whilst retrieving data from web APIs

How long after the last departure shall the airport stay open for an emergency return?

Injection into a proper class and choice without regularity

Negative Resistance

Who's the random kid standing in the gathering at the end?

Zonal Statistics is returning null values in ArcGIS

Island of Knights, Knaves and Spies

Can a stored procedure reference the database in which it is stored?

How can I get rid of an unhelpful parallel branch when unpivoting a single row?

What to do with someone that cheated their way through university and a PhD program?

Older movie/show about humans on derelict alien warship which refuels by passing through a star

What is purpose of DB Browser(dbbrowser.aspx) under admin tool?

A ​Note ​on ​N!

How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?

What is the term for a person whose job is to place products on shelves in stores?

Drawing a german abacus as in the books of Adam Ries

Partitioning values in a sequence

Extracting Dirichlet series coefficients

Contradiction proof for inequality of P and NP?

Why is the underscore command _ useful?

Retract an already submitted recommendation letter (written for an undergrad student)

Don’t seats that recline flat defeat the purpose of having seatbelts?

Multiple options vs single option UI

How do I check if a string is entirely made of the same substring?

Magical attacks and overcoming damage resistance



Adding Progress bar - Swift


How to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Using a dispatch_once singleton model in SwiftSwift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?Progress bar not showing whilst retrieving data from web APIs






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I want to add a Progress bar to a tableViewController.



I have one function called HelpersFunctions which do all the calculation.
The function doCalculation is responsible for the calculation.



So, I add the following notification to doCalculation as follow:



NotificationCenter.default.post(name: .return_progress, object: self)
for i in 1...n1
//Do all the calculation



So, once I reach NotificationCenter.default.post, it will move to a Tableview Controller called CreateNewElementVC



now, inside the ViewDidLoad, I added the following line:



//progress
NotificationCenter.default.addObserver(self, selector: #selector(showProgress), name: .return_progress, object: nil)


In the same swift file, I added the following:



let container_elementProperty: ProgressBarView = 
let view = ProgressBarView()
view.backgroundColor = UIColor(white: 0, alpha: 0.5)
view.translatesAutoresizingMaskIntoConstraints = false
return view
()

@objc func showProgress()
if(progressCounter > 1.0)timer.invalidate()
print("Step 1")
container_elementProperty.frame = CGRect(x: 100, y: 100, width: 200, height: 200)
container_elementProperty.backgroundColor = UIColor(white: 0, alpha: 0.5)
container_elementProperty.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDismiss)))

let queue = DispatchQueue(label: "queue1", qos: .userInteractive)
queue.async
print("Step 2")
self.view.addSubview(self.container_elementProperty)



//view.addSubview(container_elementProperty)
print("Step 3")
container_elementProperty.progress = progressCounter
progressCounter = progressCounter + progressIncrement

let x1: Float = Float(start_Counting)
let x2: Float = Float(End_Counting)

let xx: Float = x1 / x2 * 100

print("Start at: (xx) %)")




So, first I put all the required data in the CreateNewElementVC, then there is a button called run to do all the calculation and then it will move to another TableViewController with all the result.



So while I am inside the function doCalculation, the progress bar should appear .



In fact, the Progress bar container_elementProperty (UIview) appeared just after the calculation is completed which make the progress bar is useless.



Any idea how to make the View called container_elementProperty UIView to be seen ?



I am close to solve this issue as I can see the progress in the stack as below image, I just want to show this on the screen before completing the calculation.



enter image description here



Why I am not able to put the view on the screen while doing the calculation as you can see that step 2 ran first.
The warning related to this issue is: UIView.addSubview(_:) must be used from main thread only.



A Sample Project can be checked on this link at github.
Appreciate any kind of support.










share|improve this question



















  • 2





    Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

    – Maysam
    Mar 9 at 20:31












  • Is there a way to show the progress on the navigationItem.title?

    – Xin Lok
    Mar 11 at 12:49






  • 1





    Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

    – Maysam
    Mar 12 at 7:47






  • 1





    if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

    – Maysam
    Mar 12 at 16:30






  • 1





    Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

    – Maysam
    Mar 15 at 7:40

















2















I want to add a Progress bar to a tableViewController.



I have one function called HelpersFunctions which do all the calculation.
The function doCalculation is responsible for the calculation.



So, I add the following notification to doCalculation as follow:



NotificationCenter.default.post(name: .return_progress, object: self)
for i in 1...n1
//Do all the calculation



So, once I reach NotificationCenter.default.post, it will move to a Tableview Controller called CreateNewElementVC



now, inside the ViewDidLoad, I added the following line:



//progress
NotificationCenter.default.addObserver(self, selector: #selector(showProgress), name: .return_progress, object: nil)


In the same swift file, I added the following:



let container_elementProperty: ProgressBarView = 
let view = ProgressBarView()
view.backgroundColor = UIColor(white: 0, alpha: 0.5)
view.translatesAutoresizingMaskIntoConstraints = false
return view
()

@objc func showProgress()
if(progressCounter > 1.0)timer.invalidate()
print("Step 1")
container_elementProperty.frame = CGRect(x: 100, y: 100, width: 200, height: 200)
container_elementProperty.backgroundColor = UIColor(white: 0, alpha: 0.5)
container_elementProperty.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDismiss)))

let queue = DispatchQueue(label: "queue1", qos: .userInteractive)
queue.async
print("Step 2")
self.view.addSubview(self.container_elementProperty)



//view.addSubview(container_elementProperty)
print("Step 3")
container_elementProperty.progress = progressCounter
progressCounter = progressCounter + progressIncrement

let x1: Float = Float(start_Counting)
let x2: Float = Float(End_Counting)

let xx: Float = x1 / x2 * 100

print("Start at: (xx) %)")




So, first I put all the required data in the CreateNewElementVC, then there is a button called run to do all the calculation and then it will move to another TableViewController with all the result.



So while I am inside the function doCalculation, the progress bar should appear .



In fact, the Progress bar container_elementProperty (UIview) appeared just after the calculation is completed which make the progress bar is useless.



Any idea how to make the View called container_elementProperty UIView to be seen ?



I am close to solve this issue as I can see the progress in the stack as below image, I just want to show this on the screen before completing the calculation.



enter image description here



Why I am not able to put the view on the screen while doing the calculation as you can see that step 2 ran first.
The warning related to this issue is: UIView.addSubview(_:) must be used from main thread only.



A Sample Project can be checked on this link at github.
Appreciate any kind of support.










share|improve this question



















  • 2





    Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

    – Maysam
    Mar 9 at 20:31












  • Is there a way to show the progress on the navigationItem.title?

    – Xin Lok
    Mar 11 at 12:49






  • 1





    Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

    – Maysam
    Mar 12 at 7:47






  • 1





    if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

    – Maysam
    Mar 12 at 16:30






  • 1





    Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

    – Maysam
    Mar 15 at 7:40













2












2








2


1






I want to add a Progress bar to a tableViewController.



I have one function called HelpersFunctions which do all the calculation.
The function doCalculation is responsible for the calculation.



So, I add the following notification to doCalculation as follow:



NotificationCenter.default.post(name: .return_progress, object: self)
for i in 1...n1
//Do all the calculation



So, once I reach NotificationCenter.default.post, it will move to a Tableview Controller called CreateNewElementVC



now, inside the ViewDidLoad, I added the following line:



//progress
NotificationCenter.default.addObserver(self, selector: #selector(showProgress), name: .return_progress, object: nil)


In the same swift file, I added the following:



let container_elementProperty: ProgressBarView = 
let view = ProgressBarView()
view.backgroundColor = UIColor(white: 0, alpha: 0.5)
view.translatesAutoresizingMaskIntoConstraints = false
return view
()

@objc func showProgress()
if(progressCounter > 1.0)timer.invalidate()
print("Step 1")
container_elementProperty.frame = CGRect(x: 100, y: 100, width: 200, height: 200)
container_elementProperty.backgroundColor = UIColor(white: 0, alpha: 0.5)
container_elementProperty.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDismiss)))

let queue = DispatchQueue(label: "queue1", qos: .userInteractive)
queue.async
print("Step 2")
self.view.addSubview(self.container_elementProperty)



//view.addSubview(container_elementProperty)
print("Step 3")
container_elementProperty.progress = progressCounter
progressCounter = progressCounter + progressIncrement

let x1: Float = Float(start_Counting)
let x2: Float = Float(End_Counting)

let xx: Float = x1 / x2 * 100

print("Start at: (xx) %)")




So, first I put all the required data in the CreateNewElementVC, then there is a button called run to do all the calculation and then it will move to another TableViewController with all the result.



So while I am inside the function doCalculation, the progress bar should appear .



In fact, the Progress bar container_elementProperty (UIview) appeared just after the calculation is completed which make the progress bar is useless.



Any idea how to make the View called container_elementProperty UIView to be seen ?



I am close to solve this issue as I can see the progress in the stack as below image, I just want to show this on the screen before completing the calculation.



enter image description here



Why I am not able to put the view on the screen while doing the calculation as you can see that step 2 ran first.
The warning related to this issue is: UIView.addSubview(_:) must be used from main thread only.



A Sample Project can be checked on this link at github.
Appreciate any kind of support.










share|improve this question
















I want to add a Progress bar to a tableViewController.



I have one function called HelpersFunctions which do all the calculation.
The function doCalculation is responsible for the calculation.



So, I add the following notification to doCalculation as follow:



NotificationCenter.default.post(name: .return_progress, object: self)
for i in 1...n1
//Do all the calculation



So, once I reach NotificationCenter.default.post, it will move to a Tableview Controller called CreateNewElementVC



now, inside the ViewDidLoad, I added the following line:



//progress
NotificationCenter.default.addObserver(self, selector: #selector(showProgress), name: .return_progress, object: nil)


In the same swift file, I added the following:



let container_elementProperty: ProgressBarView = 
let view = ProgressBarView()
view.backgroundColor = UIColor(white: 0, alpha: 0.5)
view.translatesAutoresizingMaskIntoConstraints = false
return view
()

@objc func showProgress()
if(progressCounter > 1.0)timer.invalidate()
print("Step 1")
container_elementProperty.frame = CGRect(x: 100, y: 100, width: 200, height: 200)
container_elementProperty.backgroundColor = UIColor(white: 0, alpha: 0.5)
container_elementProperty.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDismiss)))

let queue = DispatchQueue(label: "queue1", qos: .userInteractive)
queue.async
print("Step 2")
self.view.addSubview(self.container_elementProperty)



//view.addSubview(container_elementProperty)
print("Step 3")
container_elementProperty.progress = progressCounter
progressCounter = progressCounter + progressIncrement

let x1: Float = Float(start_Counting)
let x2: Float = Float(End_Counting)

let xx: Float = x1 / x2 * 100

print("Start at: (xx) %)")




So, first I put all the required data in the CreateNewElementVC, then there is a button called run to do all the calculation and then it will move to another TableViewController with all the result.



So while I am inside the function doCalculation, the progress bar should appear .



In fact, the Progress bar container_elementProperty (UIview) appeared just after the calculation is completed which make the progress bar is useless.



Any idea how to make the View called container_elementProperty UIView to be seen ?



I am close to solve this issue as I can see the progress in the stack as below image, I just want to show this on the screen before completing the calculation.



enter image description here



Why I am not able to put the view on the screen while doing the calculation as you can see that step 2 ran first.
The warning related to this issue is: UIView.addSubview(_:) must be used from main thread only.



A Sample Project can be checked on this link at github.
Appreciate any kind of support.







swift progress-bar






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 14 at 15:39







Xin Lok

















asked Mar 9 at 8:02









Xin LokXin Lok

134113




134113







  • 2





    Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

    – Maysam
    Mar 9 at 20:31












  • Is there a way to show the progress on the navigationItem.title?

    – Xin Lok
    Mar 11 at 12:49






  • 1





    Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

    – Maysam
    Mar 12 at 7:47






  • 1





    if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

    – Maysam
    Mar 12 at 16:30






  • 1





    Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

    – Maysam
    Mar 15 at 7:40












  • 2





    Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

    – Maysam
    Mar 9 at 20:31












  • Is there a way to show the progress on the navigationItem.title?

    – Xin Lok
    Mar 11 at 12:49






  • 1





    Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

    – Maysam
    Mar 12 at 7:47






  • 1





    if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

    – Maysam
    Mar 12 at 16:30






  • 1





    Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

    – Maysam
    Mar 15 at 7:40







2




2





Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

– Maysam
Mar 9 at 20:31






Are you calling both of them in the main thread? Probably your calculation is taking place in the main thread and that's why the progress bar appears after your calcs are done. Moreover, for showing a progress in iOS you'd better use delegation method. You might find this helpful medium.com/journey-of-one-thousand-apps/…

– Maysam
Mar 9 at 20:31














Is there a way to show the progress on the navigationItem.title?

– Xin Lok
Mar 11 at 12:49





Is there a way to show the progress on the navigationItem.title?

– Xin Lok
Mar 11 at 12:49




1




1





Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

– Maysam
Mar 12 at 7:47





Are you using a timer? It's up to you but I strongly recommend don't use this method. However, if you insist on doing it this way, instead of printing the value in the main queue set navigationItem.title with that value

– Maysam
Mar 12 at 7:47




1




1





if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

– Maysam
Mar 12 at 16:30





if you can create a new project and share that piece of your code you need help with, i might be able to take a look at it.

– Maysam
Mar 12 at 16:30




1




1





Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

– Maysam
Mar 15 at 7:40





Here you go github.com/maysamsh/swift-circular-loader and I post some tips as an answer below.

– Maysam
Mar 15 at 7:40












1 Answer
1






active

oldest

votes


















2














  • To simulate a progress, such as a network request you cannot simply do a for loop in the main thread, you should use GCD.

  • To update the progress of an ongoing action use Delegation, not KVO.

  • Using global variables makes your code flawed, avoid it!

This is a working version of your code.



enter image description here






share|improve this answer

























  • Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

    – Xin Lok
    Mar 15 at 8:26






  • 1





    Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

    – Maysam
    Mar 15 at 9:35











  • Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

    – Xin Lok
    Mar 15 at 10:00











  • By the way, it worked very well and as expected. thanks a lot

    – Xin Lok
    Mar 15 at 10:09











  • You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

    – Maysam
    Mar 15 at 10:24











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075254%2fadding-progress-bar-swift%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














  • To simulate a progress, such as a network request you cannot simply do a for loop in the main thread, you should use GCD.

  • To update the progress of an ongoing action use Delegation, not KVO.

  • Using global variables makes your code flawed, avoid it!

This is a working version of your code.



enter image description here






share|improve this answer

























  • Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

    – Xin Lok
    Mar 15 at 8:26






  • 1





    Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

    – Maysam
    Mar 15 at 9:35











  • Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

    – Xin Lok
    Mar 15 at 10:00











  • By the way, it worked very well and as expected. thanks a lot

    – Xin Lok
    Mar 15 at 10:09











  • You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

    – Maysam
    Mar 15 at 10:24















2














  • To simulate a progress, such as a network request you cannot simply do a for loop in the main thread, you should use GCD.

  • To update the progress of an ongoing action use Delegation, not KVO.

  • Using global variables makes your code flawed, avoid it!

This is a working version of your code.



enter image description here






share|improve this answer

























  • Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

    – Xin Lok
    Mar 15 at 8:26






  • 1





    Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

    – Maysam
    Mar 15 at 9:35











  • Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

    – Xin Lok
    Mar 15 at 10:00











  • By the way, it worked very well and as expected. thanks a lot

    – Xin Lok
    Mar 15 at 10:09











  • You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

    – Maysam
    Mar 15 at 10:24













2












2








2







  • To simulate a progress, such as a network request you cannot simply do a for loop in the main thread, you should use GCD.

  • To update the progress of an ongoing action use Delegation, not KVO.

  • Using global variables makes your code flawed, avoid it!

This is a working version of your code.



enter image description here






share|improve this answer















  • To simulate a progress, such as a network request you cannot simply do a for loop in the main thread, you should use GCD.

  • To update the progress of an ongoing action use Delegation, not KVO.

  • Using global variables makes your code flawed, avoid it!

This is a working version of your code.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 15 at 7:54

























answered Mar 15 at 7:45









MaysamMaysam

3,787135390




3,787135390












  • Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

    – Xin Lok
    Mar 15 at 8:26






  • 1





    Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

    – Maysam
    Mar 15 at 9:35











  • Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

    – Xin Lok
    Mar 15 at 10:00











  • By the way, it worked very well and as expected. thanks a lot

    – Xin Lok
    Mar 15 at 10:09











  • You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

    – Maysam
    Mar 15 at 10:24

















  • Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

    – Xin Lok
    Mar 15 at 8:26






  • 1





    Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

    – Maysam
    Mar 15 at 9:35











  • Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

    – Xin Lok
    Mar 15 at 10:00











  • By the way, it worked very well and as expected. thanks a lot

    – Xin Lok
    Mar 15 at 10:09











  • You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

    – Maysam
    Mar 15 at 10:24
















Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

– Xin Lok
Mar 15 at 8:26





Big thanks for this piece of code, it is totally new for me. But I have no idea where I must include the calculations? This line for i in 1...Int(End_C) start_C = Float(i); percentage = start_C / End_C was removed from the previous sample project ? how can I control the progress? Where I must include this piece of line?

– Xin Lok
Mar 15 at 8:26




1




1





Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

– Maysam
Mar 15 at 9:35





Well, I don't know where do you get that number, but all you need is calling delegate.update(progress:). in this code: _delegate.update(progress: _counter), replace _counter with your number.

– Maysam
Mar 15 at 9:35













Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

– Xin Lok
Mar 15 at 10:00





Yes, I understood the code. It is very helpfull. I will work on to apply it to my code. Thanks a lot man for your support.

– Xin Lok
Mar 15 at 10:00













By the way, it worked very well and as expected. thanks a lot

– Xin Lok
Mar 15 at 10:09





By the way, it worked very well and as expected. thanks a lot

– Xin Lok
Mar 15 at 10:09













You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

– Maysam
Mar 15 at 10:24





You're welcome. I'd recommend you watching itunes.apple.com/cn/course/developing-ios-11-apps-with-swift/…

– Maysam
Mar 15 at 10:24



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075254%2fadding-progress-bar-swift%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко