Xcode Playgrounds - Prototyping UI - Swift
HTML-код
- Опубликовано: 4 сен 2024
- *SPONSOR*
Interested in a dev bootcamp? Check out Dev Mountain
devmountain.co...
Herman Kayy - Dev Mountain Experience Interview:
• How to get your first ...
In this video we walk through how to prototype user interface elements in Swift by using Xcode Playgrounds, and discuss the benefits of doing that. Rapid iteration on designs is very powerful. This tutorial was done in Swift 4.2 and Xcode 10.
Source Code (Xcode 10, Swift 4.2):
www.dropbox.co...
If you like my teaching style, I've released my first iOS dev course which is all about the take-home project job interview for iOS developers.
Course Info - seanallen.teac...
If you want more... Check out my podcast, iOS Dev Discussions:
itunes.apple.c...
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Paul Hudson's Hacking With Swift:
gumroad.com/a/...
Learn Advanced Swift Here:
gumroad.com/a/...
Links to my Developer & RUclips Setup
www.amazon.com...
Personal Links:
Swift News Hoodies & iPhone Case:
teespring.com/...
Twitter:
/ seanallen_dev
Instagram:
@seanallen_dev
Patreon:
/ seanallen
Website:
seanallen.co
My inbox gets flooded with questions. If you want a guaranteed response, use this link:
earn.com/seana...
Watch Next - iOS Take Home Project - Job Interview Practice - Free Preview - ruclips.net/video/MSIe2y6Fee8/видео.html
That's a very good point about testing designs against the iPhone 5 this way.
My practice is to design for the iPhone 5, and adapt upwards for the larger displays. I've found that it's so much harder to design for large phones and then work downwards.
It also helps us avoid the perennial design mistake of only properly designing for the specific size of the device we own, or are comfortable with.
In my opinion, this used to be the way to go. But now that the iPhone 5 size may be phased out, or at the very least is a small % of the user base, I prefer to design for the X form factor, and then adjust down. It's a bit more work, but I prefer to design for the majority, then make tweaks and compromises for the minority. I'd rather have it feel like my app was designed for the X family of iPhones.
This is probably old news to most, and overkill in simple cases, but you can also add external code files to your playground. Let's say that you'd precoded some extensions to UIColor or UIView or whatever, you could put them into the playground and have access to them so you could prototype or experiment with code you'd already done. Just have to add them to the "Sources" folder. Also, "command - zero" brings up the navigator side menu, if anyone wants to use a shortcut.
Great info, thanks Sean!
Nice, didn’t know that. Thanks for sharing, David 😀
The narrating really explains your thought process, thank you
Glad you liked it, Huqiao 👍
Amazing video, man! As a designer learning swift, it really comes in handy!
Happy it helped, Alex 👍
Kudos to you! I've been enjoying the new tutorials you are doing. It's a lot different to the tutorials out there.
Happy to hear you like the new direction, Shiva 👍
This will save a lot of time .. usually I create a new Xcode project to just create and test a UIView subclass but for now I will be using this .. Thank a lot Sean 👍
Oh wow... this will certainly save you time then.
If you haven't seen that video .... come on. what are you doing ?
Made me smile :D
Haha, glad you liked that 😀
I follow your tutorials with pleasure all the way from Belgium. You do a great job and excellent documentation Sean !
Thanks Bart! Glad you enjoy them 😀
Awesome video man!
I love working with the playground.
And awesome tips on the constrains!
Glad it helped, Eugene 😀
I would really love to see a refactoring video of putting this in a subclass etc, as mentioned in 13:33. I haven't found good simple tutorials on how to do that effectively. Would be interesting to see how you do it!
I would also like to see a video about the "Safe Area Insets", and how to use them , IF you use them, programatically.
Thanks for the learning
Recently Graduated from DevMountain!!!!!
Nice!
That was awesome. Never thought of prototyping on Playgrounds. Great video 👍
Glad you got some value out of the video, Kareem!
Great content with a smooth delivery style, well done Sean, keep up the great work. Henry
Thanks Henry!
Hello master thank you for video please talk about tableview pagination or load more thank you
Cool video sean keep the good work up
Thanks Osman!
Even thought i don't like doing thing programatically, i really loved the video and i believe you are right when you said that we need to know both, no matter what feels better to us.
It has it's "charms"....doing stuff programmatically, i might dig a bit more :)
Tnx for sharing!
Happy it was helpful, Emin. It’s best to know both because sometimes one method is clearly better in certain circumstances.
I already tried your skeletal storyboards as a middle ground and it really makes a difference. Fast/easy and works for both worlds :)
Nice!
eniN, if there's one piece of advice I could give you it's this: get comfy with programmatic UI. It will help you out enormously over time. Storyboards and nibs have their place, but they also introduce many problems, particularly with navigation and application flow. And reliance on Storyboards can hinder understanding of what is really going on in an iOS app.
Remember it's not a case of all-or-nothing. You can combine storyboards and code, but knowing how the code works is vital. Cheers.
Jeez dude, keep up the great content. You're helping me a lot and based off the other comments its not just me. Do you plan on writing any books or is your focus mostly on video content?
Happy to help, Leonidas! I have a lot in the works that I'll be releasing over the next few months. My first book will be out in a couple weeks (although not a terribly technical book), and I have courses planned for early 2019.
I really need to do more of this
It's pretty fun and good practice.
Your tutorials are Awesome. Have you considered making a course and putting on your website. I think it may work.
Coming early next year...
Hi, nice video.Most of the time I am doing most tests, trials directly in a project. But as you show here playground is the ground to start with/from. I was thinking about the iPhone/iPad sizes, nice tip b.t.w from you. I would like to create an enum with all the iPhone sizes in there and have that enum in a separated file so that I can 'import' that file into my projects. Then with a chosen enum element with the values ( iDevice name ) and calculate what all other view elements should become. What are your suggestions to add that in a file and how to add that file in a playground project on an iPad?
Oke, just starting with tuples and enum. I guess it could do some thing like this
enum iDeviceType {
case iPhone(String)
case iPad(String)
func screenSize(iDevice: iDeviceType)->(Int,Int){
var myModel: (Int, Int)
switch self {
case .iPhone(let model):
switch model {
case "XR" : myModel = (width: 365, height: 512)
case "6" : myModel = (width: 365, height: 512)
...
default: myModel = (width: 365, height: 512)
}
case .iPad(let model):
switch model {
case "Air1" : myModel = (width: 365, height: 512)
case "Air 2gen" : myModel = (width: 365, height: 512)
...}
return myModel
}
}
var myModel = iDeviceType.iPhone("XR").screenSize()
print(myModel)
Keep these tutorials coming
I plan on it 😀
Love this series, more please
Glad you like it 👍
Man Awesome Video. I love this one. to be honest, my design process was to create a whole new project just for one ViewController prototype 😂 this is going to change now..
Happy to hear that, Lohen 😀. Glad you found it useful.
it's very very useful. Thanks, man hope to see more video like this. And I would love to see the video on refactoring the UI code that you were talking about in this video.
I may do a part 2 that shows that.
Thank you, Sean! Anybody know how to preview my playground prototype on real device (on my iPhone)?
Yes, you can use TestFlight, an app for that specific purpose. However, you could also use the build simulators built into Xcode itself...
Hi Sean, thanks for the tutorial I always wondered if I could do this, and when I saw the title of the video I was like ok you just got your answer lol. Pretty helpful brodaaaa.
Happy to help, Jose. Give it a try 👍
Another excellent video Sean, thank you.
Glad you enjoyed it!
Hey just wanting to try something a bit different with this and make the card view animate in from the right side would I need to change the...let ViewBottomAnchorConstraints : NSLayoutConstraints part? and if so what could I change would it be the trailing anchor?
That downloaded file opens in Xcode but not as a Playground?
14:14 on the other hand if you design for the smallest screen the others will follow.
In my opinion, this used to be the way to go. But now that the iPhone 5 size may be phased out, or at the very least is a small % of the user base, I prefer to design for the X form factor, and then adjust down. It's a bit more work, but I prefer to not compromise an amazing iPhone X design, just to make it fit for the SE. I would rather do the extra work to tweak the SE, than make sacrifices on the X
Especially for touch areas.
Another great video! Thanks!
Thanks Gakkie!
How about giving us a rundown on the equipment you use for your podcasts? I've seen a number of people that wanted to do some tutorials and they were wondering what software/hardware to get and how to set things up. I hear that the video stuff comes free with some video games, which one do you use?
For my podcasts? I have a Blue Yeti mic and record my audio using QuickTime.
Thanks, Sean. Really helpful.
God you enjoyed it, Glenn!
That logo at the end! Why am I just seeing that now
Haha, soft launch. Still tweaking it a bit, but you’ll be seeing a lot more of it soon 😎
I know... I slipped up. It's forever the "ex". 😂
Hi Sean ... NYC tute
Thanks. Glad you liked it!
Thanks for this amazing video!
Glad you liked it, Dayday!
DOPE TUT AS ALWAYS.
HEY SEAN, im in xcode 11 playgroud.. exploring it.. its not allowing me to run my code.. and i dont even have the assistant editor button on mine. do you know how i can fix this? please help if you can, thank you!
Amazing tutorial, thanks a lot
Happy to help, Ali 👍
Nice video. I think computed properties (varget shortcut in Xcode) would have been nicer instead of having a separate function for each view.
I’m not aware of any performance differences, so this may be just stylistic preference. I’m not a fan of having a ton of UI code in the “variables” section of my file, which is usually at the top. I like that to be minimal. I like to have a list of variables, then my view life cycle functions, and then the rest of the logic. Just my organizational preference.
Sean Allen I think it’s the same performance wise. But I personally like to use computer properties when possible so I don’t need a separate function that can get lost in a large view controller file.
I see what your saying. I do by best to keep my ViewController to around 200 lines of code, so things don’t get lost for me too often. But again, all this is stylistic preference.
Sweet video. Amazing content. 👍
Thanks Andres. I appreciate the kind words 😀
Great tutorial!!!
Thanks! Glad you liked it 👍
Nice video. Has anyone ever told you that you looked like Timmy Howard?
Thanks. I've gotten Bill Burr, Tyson Chandler... but this is the first Tim Howard, lol.
How can i make money with ios development part time....?
It’s tough, because more often than not, people are looking to hire full-time...but some development agencies will hire part time devs to help out. Or you could build your own app on the side.
Start bidding for projects on Freelance or Upwork or Fiver. Initially you would have to bid low as you do not have reviews and portfolio. Once you get few projects done and get good reviews that you can start charging a little more. But it's a tough market specially with many small shitty indian companies bidding at very low prices to get the project.