AR Persistence Model using Swift 4.2 (Part 1).

Updated 3 July 2023

Save

AR Persistence Model using Swift 4.2

Now a days AR is mostly used in various places like eCommerce or  for study material etc. Today I am going to tell you about how to save the AR session and load on real environment.

It is more use full for custom map which can be used  in house map because google or Apple Map will not work inside the house or mall so here I am taking the example of Shop where the

user will get the path to their product so the user will not get to ask from the shop assistant or shop keeper.

In this Blog We will cover only path draw part & save only other work will cover on next blog .

It will work on Xcode 10 & iOS 12

For Draw the Path Follow this Steps:

1: Create A UIViewController Class name “ARPathRecorderController”.

a: Take all the necessary controller that are shown in the screenshot.

 

Note:

Load : this will load and check it is fine or not (it is just for testing).

Cancel: Cancel the Record.

Save : it will save the AR session to local Document directory.

2: Now Create the Outlet of ARscniew and other UIComponent Outlet.

3: Write the ViewDidload method and Viewwill Appear method :

Note:

First we set the delegate of ARScnview , after that set the light for clear model & add the tap gesture so that when the user will tap on screen it will add image or GIF image on Horizontal Surface for path .

4: On Tap on the screen there will be one delegate method will be called , here we will have to draw the image or GIF on surface.

Note:

Here we are taking the gif image that will draw on surface on every tap .

5: Now its time to save to this model .

You have to save every model by unique ID so that you can identify easily.

a: Now write the outlet function of Save button:

 

Now your model is saved with corresponding Map Id.

 

 

In Next Blog we will cover the Load Part of Model & Complete project Link of GitHub.

If you find any issue or problem to implement this part feel free to ask.

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home