Monday, July 20, 2015

NSTimers

Welcome to a VERY simple blog post, also my first tutorial!

This time, I will be teaching you how to use something called an "NSTimer".

These are the very useful applications of the NSTimer:

- Repeating a block of code over and over
- Checking for updates from a web server
- Creating a timer
- Checking variables, repeatedly
- Executing a block of code after a time delay

etc.

Let's see how to create a function for the Timer (just a simple Swift function, that will print "Hello World"):

func printHelloWorld() {
    print("Hello World")
}

Next, let's see how we can start the timer:

var timer = NSTimer.scheduledTimerWithTimeInterval(2, target: self, selector: "printHelloWorld", userInfo: nil, repeats: true)

The above timer will call the "printHelloWorld" function every 2 seconds.

You can also create a timer, without starting it:

var timer = NSTimer(timeInterval: 2, target: self, selector: "printHelloWorld", userInfo: nil, repeats: true)

The above timer will take all variables into account, but to start it, you must add it to Swift's "Run Loop":

NSRunLoop.currentRunLoop().addTimer(timer, forMode: NSRunLoopCommonModes)
That will start the loop.
No matter what method you choose of starting the timer, you always end it like so:
timer.invalidate()


That's it for this simple tutorial! If you have any more questions or suggestions, please email me at: tajymany@gmail.com

Hope you learned something new and enjoyed it!

Tuesday, July 7, 2015

XCodeToIPA (Part 2) FAQ

Welcome to the FAQ for the "XCodeToIPA (Part 2)" video that I released. Whenever someone asks me a question about this video and I am able to get a working answer for them, I will also be uploading the question and answer here. Here they are:

Q: Can I remove the popup that says "dl.dropboxusercontent would like to install <appname>" after I click on "Install"?
A: Sorry, no you cannot! If you could, it would be a system vulnerability. This is due to the fact that the install button is ACTUALLY a link, and if you were to be automatically redirected to a link like that, someone could install a malicious app right onto your iDevice! If the popup stays, however, then you can just "Deny" the app from being put onto your device. So, Apple decided to keep the popup there with force.

Thursday, July 2, 2015

First Post!

Welcome to my Blog. This is my first post, explaining what I will be writing & sharing in this blog!

1) I will be putting up written, article versions of some of my short videos (on iOS, Mac, and Swift)
2) Basic & Advanced Swift tutorials
3) Information about technology, that were not fit for a video
4) I will even make some posts on how to create games in Swift!

Hope you enjoy!

You can mail me at: tajymany@gmail.com