Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macRumorsUserX

macrumors newbie
Original poster
Feb 2, 2015
8
0
I must be honest. After almost a month of learning swift, I am still baffled everyday when I try to do the most simple things. Many of the written tutorials don't address the more simple things. And Apple's developer Library tells me all of the functions and objects but it gives so little I don't know how to implement them. If anyone knows any good resources for swift implementations let me know.

So, what i'm trying to do today is animate a rectangle. I have a simple UI.animateWithDuration that doubles the size of the rectangle over 1 second.

I want this animation to run whenever the user touches inside the rectangle. Not "tap" or long press. but ANY time they touch. (for example they are touching the ipad screen and moving their finger along and it enters the rectangles bounds. (is it bounds or frame?).

so what is the simple code for triggering this animation when the user touches their? i know it has something to do with touchesBegan(NSSEt) .. whatever... and CGRect contains point.

I get the basic concepts but always fail to implement it because of the many many various syntactical errors that await me on every line.

hope to get some good answers and good ideas on how to learn swift quicker
 
so what is the simple code for triggering this animation when the user touches their? i know it has something to do with touchesBegan(NSSEt) .. whatever... and CGRect contains point.

You should be sure to check out Ubuntu's response to your similar query in your other thread.

I get the basic concepts but always fail to implement it because of the many many various syntactical errors that await me on every line.

Perhaps you should step away from the real coding and spend some time learning how to write syntactically correct code. Then as you become more comfortable and successful with how it all fits together, you can also become more productive. Just a suggestion.
 
thanks for the advice but I already tried LongPressGestureReocognizer and it isn't exactly one im' looking for. GCRectContainsPoint turned out to be closer to what I need.

and as far as "taking a break" to learn code. I read coding books and I'm learning swift as I go along. I've only just started so it isn't helpful when someone says use "This object" with no implementation example.
 
thanks for the advice but I already tried LongPressGestureReocognizer and it isn't exactly one im' looking for. GCRectContainsPoint turned out to be closer to what I need.

Did you look at the rest of UIGestureRecognizer, like UITapGestureRecognizer?

and as far as "taking a break" to learn code. I read coding books and I'm learning swift as I go along. I've only just started so it isn't helpful when someone says use "This object" with no implementation example.

Well, Swift is pretty new so you're going to find much less examples out there. I find it helps to add "example" as a keyword when searching to find sample implementations. For example, I found this Ray Wenderlich tutorial by Googling for "swift programming uigesturerecognizer example".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.