|
Hello, I tried for challenge 3 but couldn't figure it out. What to do after I convert the view controller to table view. Thank you for your help. |
|
Hi, It took me quite long to solve this third challenge, I could not finish this challenge without hints from Michele Galvagno and notes from Project 1. In my opinion, this challenge requires so many small steps that the human brain could not remember all. Therefore, writing it down would be the perfect way to learn. Missing only one small step could not make it happen. Here is my writing:
b) Adjust numberOfRowsInSection method with websites.count. For ex:
c) We don’t need numberOfSections method, so erase if it’s there. d) Complete cellForRowAt method, with an identifier of “websiteName” that we used earlier for Table View Cell.
e) A method of didSelectRowAt() should be added as follows:
b) Replace from
to
c) Remove openTapped() method and related buttons inside it since we don’t them anymore. d) Remove the line of “Open” rightBarButtonItem. e) Inside decidePolicyFor(), remove the website loop, and its braces. Replace “website”with “websiteToLoad”, as follows:
|
|
Thanks so much for this, @hannale1892! I now see why I was going about this all wrong, so much appreciated. The only query / issue I have with the above is your decidePolicyFor code seems to only permit url's with the host of the website you specifically clicked from the initial list, whereas if you had two websites in your whitelist that somehow linked to one another, you would possibly get an issue trying to access website 2 through website 1 as you didn't open website 2 directly from the start? Is that right? Either way, for the stage we're at in learning swift, this has been great and I appreciate it. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.