Develop iOS Apps Without a Mac, on Windows with Xamarin Hot Restart

In Mobile App Development


Develop iOS Apps Without a Mac, on Windows with Xamarin Hot Restart - read the full article about ios app development 2022, Mobile App Development and Native and cross-platform solutions from Gerald Versluis on Qualified.One
alt
Gerald Versluis
Youtube Blogger
alt

what if i told you that you could develop an ios app without ever having to own a mac wondering how to do it you only need a physical ios device a windows machine and a cable to connect the two lets find out how to do it but wait before we go any further i need to thank alessandro simonelli and i dont know why this comes out with an italian accent because kind of like the name sounds italian but please alessandro let me know where youre from because im very curious to know alessandro is my latest member in this channel because you can join this channel as a member and it has two tiers junior developer senior developer and as a senior developer you also get a little shout out in my video so here we are thank you so much to all of my members who are supporting me with a small fee a month during this adventure and pay for all this expensive studio equipment amongst other things um thank you so much for that if you are considering yourself dear viewer to become a member and support me a little bit giving back for all the content that im putting out there for you please click that join button and check out what its all about now quickly on to the main event of today building ios apps on a windows machine [Music] so first lets talk a little bit about what xamarin hot restart is um exactly so xamarin hot restart enables you to quickly test changes to your app during development including multi-file code and its resources and references so if you know now about net hot reload this takes it a step further because this also allows you to add resources or add new images that you can use straight away or add new references that you can use straight away which is really cool but this is very limited well very limited it is limited to a certain scenario for now it is very limited to well it says here visual studio 2019 but this also works in visual studio 2022 as im about to show you um and it supports ios apps only using xamarin forms so kind of like the only scenario where you can use this is examined forms when building ios apps what it doesnt say here is that you can also use this to develop your ios apps using just a physical device ios device a cable and a windows machine and i left out one little thing you also need a paid apple developer account but that you need anyway if you want to take your app to the store at some point right so thats also whats listed here the requirements visual this is just the software requirements i see visual studio 2019 or higher itunes well see about that in a little bit and an apple developer account and paid apple developer program enrollment now that is everything you need and here you can see initial setup you need to enable this under preview features technically this is still listed as a preview feature but it works just fine and i wouldnt be surprised if this is turned on by default by now and this docs might be a little bit outdated now lets just quickly switch over to visual studio 2022 and see how all of this works so here we are in visual studio 2022 and i just created a file new xamarin forms application you can see it here in example this is just a template that you will get out of the box nothing fancy here but what you can see is that i set the configuration here at the top to debug and iphone so i only have the ios project in here we go over to our solution explorer i have the shared project here at the top which is your exam reforms project thats where you want to have your code and i have the ios target here with all the ios specific bits now typically if you start a project you can also have the android and uwp projects in here i left them all out im just focusing on the ios one right now which allows me to set the debug configuration right here and also the iphone configuration and then it says local device so make sure that you set it to the local device also of course we have possibilities to do it with a remote device or through a simulator which will connect over the network to a mac but were going to use the local device again im just plugging in this cable into a windows machine there is no mac in the network right here you can see its not connected typically whenever you have the mac connected you can see here its paired to a mac this is not set up this is not working right now so if i set this to local device and i just press the run button it will come up with a wizard that will help me set up the hot restart here we are set up hot restart and this wizard will guide you through the process of setting up deploying to a local ios device so theres something interesting here this feature is designed to be used during app development and will not allow you to publish your app dont worry about that make sure to watch the whole video i will answer a little bit about that as well how you can overcome that problem so okay this is all fine lets click next install itunes i havent set that up here is a little note about how to set it up why you need it etc etc i think you need it because it will give you some libraries it will give you some apis that are used to connect to your ios device on windows and those are used to then deploy your app to that device and run all the things from there so you need to set it up let me do that a little bit quickly so there was will be a little edit cut in the video here um i will go over this really really quickly i assume that you can download and install itunes by yourself so lets just quick uh quickly skip over this and go to the next step okay so itunes is installed ive done that through the microsoft store you can just find it there and when i close this we should be able back here and you can see that this wizard now picked up in itunes has been successfully installed it will automatically see that so we never have to leave this wizard right here we can just wait for itunes to install and then we can click next now its waiting for an ios device to be connected now here is where it got a little bit funky for me when i try to prepare this demo um so i have this ios device right here look it turns on i have a cable i had it already connected let me disconnect and connect it again it you can see here at the corner well actually not because im in the way you can see that it picks up on my iphone so it sees its here but what i actually needed to do is start itunes to actually let it pick up on this phone so let me see this is not going to be the most polished demo that you will ever see but lets go over into itunes and lets see if we can get this device to show up there so it probably has to do with the license agreement lets agree to that and then we have to disconnect and connect our device and it has to show up in kind of like itunes so also here agree to this which is fine let me move this to the side a little bit can i do that itunes no youre not going to let me okay thats cool because its just hanging in general um itunes is well i never really liked itunes but itunes is you know apple made it necessary to do it on windows but it never really has been great okay it seems to be responsive now so let me just disconnect and connect this again and hopefully this will just show up here do you want to allow this computer to access yes continue we might want to set up something here on this device as well you can see it has this little dialog which asks me to trust this device let me trust it you shouldnt have to log in with like oh i see a little icon here you shouldnt have to log in with your account or whatnot so welcome to your new iphone because this is a test device so this is set up as a rather new device sync with itunes get started which is fine okay here you can see all the numbers of my iphone so i assume that is connected by now and you can see again that the wizard has picked up on that so a device has been connected please continue you can see its called iphone lets click next and now you have to log in with your apple id so let me just quickly do that which is here we are and whoops made a little typo there and add my password here all right lets click next and its going to sync my apple device developer info you can see this comes up with a little mac pop-up dialog because im using remote desktop into this windows machine so thats why this pop-up comes up which is in this case pretty handy because i have two factor authentication set up of course so lets do allow you can see this little code coming in here and i can just enter this code and you can see that it will then authenticate me so thats verified lets do this syncing developer teams okay and now its logged in so you can see it syncs the teams and here is the teams that are configured for my account and you can select the the team that you want to use to do this ios development so im going to click this one here its going to create some certificates its going to do some things in the background you can see its very busy you have to wait and now boom automatic provisioning completed successfully and now everything is ready for my app to run from windows on my ios device so lets click finish here and you can see that here at the top it went very fast it went to iphone from local device now the build is successful um you have to have your device unlocked actually i have to redo this again its deploying into device iphone so its just building the final new xamarin forms application and it should show up on my physical device here it might take a little while the first time but the really cool thing is is that you can develop your application while its actually running and that is the the real power of hot restart so you can now add all these things um oh i need to launch the application manually so heres a little icon and whenever i do you can see that um there comes my xamarin forms app running on a physical ios device through visual studio now also the the hot restart hot reload things just work so if i change the the big blue color bar to red right here you can see that that automatically pops up it should whenever we change that maybe i need to save the file here and it should here you go it goes to red now lets make it green just so you can see that there are actually changes going on so green lets do that lets make sure that this doesnt go to sleep save my changes and it changes to green now this is just the color of course but you can change all the things you want and this is literally just a ios device connected to a windows machine running a ios app so how cool is that so you probably have mainly two maybe three maybe a lot more questions right now but im going to try and answer a couple of those that are on the top of my mind so the first one is will this also work for a don at maui application at this time so the answer right now is no i couldnt get it to run in visual studio 2022 with a.net maui project it seems to go a far a long way because it sees my apple device it sees my all the things the designing the certificates it seems to almost work so im not sure if this is due to something in hot restart or maybe the fact that we are not able to deploy down at bowie applications to physical devices yet im not really sure but hopefully in the future we will be able to use this now the other one is is this functionality going to come to like visual studio for mac or maybe other ways or maybe to android as well because this is not just about like running ios apps on a windows machine right so because the functionality is actually about being able to basically create your whole app add resources add references add all the things without having to restart your application so that would be coming uh very handy for android or all the other platforms and on visual studio for mac as well so on the docs page that i showed earlier it said that that is on the roadmap so i hope thats not outdated and its still on the roadmap and its still something thats going to be developed now the last thing is probably the big one that youre asking like the thing that i mentioned in the beginning i cant run this app this debug build on the app store if i want to provide something to the app store im going to still need to compile on a mac now that is kind of an easy one to get around because you have free hosted mac machines on azure devops or on app center and theres probably other solutions that kind of offer this as well you can even do a solution like mac in cloud which allows you to rent a mac machine somewhere in the cloud you could send your code to there you can do the little compilation and you only need to do that last compilation that youre going to send to the app store you have to do on a physical mac machine so if you set up your ci cd pipeline on azure devops you can do that for free i think for 240 build minutes each month and you do all the development on your windows machine you push your code to the repository it starts building on your ci pipeline and it automatically pushes from there to the app store which is completely legitimate it works you can do it and that is how youre able to develop a ios app only through windows and a physical ios device isnt that mind-blowing um thank you so much again for watching one of my videos if youve liked this one please click that like button so more people can join in on this fun and can stop buying expensive mac machines to actually develop their ios applications if you like this channel if youve seen a couple of videos now and you think like that gerald that seemed like a really nice guy who knows this stuff please subscribe to my channel so that i will pop up in your feed automatically and you dont have to come searching for me other than that i only of course have to say only one thing keep coding

Gerald Versluis: Develop iOS Apps Without a Mac, on Windows with Xamarin Hot Restart - Mobile App Development