How to open a URL in Safari in Swift
A step by step tutorial on opening a webpage in Safari from an iOS, iPadOS or MacOS app.
The following tutorial builds on our Open Source Swift starter project, which can be downloaded using the link below, and walks you through how to open up a URL in a native Safari browser when a user presses a custom button on an app using Swift.
We recommend downloading our Open Source project, checking out the main branch and carrying out the steps outlined below. All relevant changes can be found on the tutorial/open-url branch.
git clone [email protected]:delasign/swift-starter-project.git
Step One: Create the button
Create the button that opens the URL.
For a tutorial on how to create a custom button in Swift, please consult the article linked below.
Step Two: Create the URL Constant
In the Constants.swift file under Models / Constants, add your url as a constant.
Please note that this is optional but recommended.
Step Three: Open the URL
In CustomUIView+UI.swift , in the onRelease callback from the custom button - or in the location that your button action takes place - open up the URL using the code below.
Please replace YOUR_URL with the constant created in Step Two.
Step Four: Verify
Run the app in XCode and press the button to confirm that the webpage opens in Safari.
Any Questions?
Book a Free Consultation.
Click here to email us.
Fill in the details below to book a free consultation or to let us know about something else. whatever it is, we are here to help., how can we help you , contact details.
How to open URL in Safari in SwiftUI
In SwiftUI , there are two ways to open a URL in Safari.
- openURL environment value.
Open URL with Link view
We can use a Link view to open a URL in Safari.
Link view is similar to a button, but instead of providing an action, we provide a destination URL that we want to open.
The example below creates a link to my Twitter profile https://twitter.com/sarunw .
The result of a Link view looks like a normal button , but it navigates you to the destination URL when tapped.
Just like other views, you can style link appearance in many ways.
- Modifiers, e.g., font , foregroundColor .
- Use custom view as a label.
- Or put it in other container views , e.g., List , Form .
Customize Link with Modifiers
By default, a Link contains text in its label, so it can be customized using standard view modifiers for text .
Here is an example where we modify the font and its color .
The modifiers you can apply to a Link view depend on the link's label .
It seems like a Link view uses something similar to a button. So you might find some modifiers take no effect , e.g., .underline . (Underline is neither work on a button).
You can overcome this constraint by providing a custom view for a link's label .
Create Link using a custom view as a label
You can provide a custom view for a link's label if you want more control over the appearance.
In this example, we user create a link with an image along side an underline text .
Link in a container view
Some container views can apply a unique style to their child views and controls.
Link view is also a control, so it gets the same treatment.
Here is an example of using Link inside a List view.
Link gets the same style as a list row when putting it inside a List view.
You can easily support sarunw.com by checking out this sponsor.
Tiny OCR: Extract text from image directly from your mac.
Open URL with openURL environment value
Another way to open a URL is by using the openURL environment value .
To open a URL, you specify a destination URL into an openURL , which is OpenURLAction type.
Here is an example where I manually open a URL using openURL when the button is tapped.
1 We declare an openURL environment value. 2 Then, we can call this wherever we want to open a URL.
Check whether the URL can be open
URL that we can use in openURL isn't limited to website URLs. You can use this to open a custom URL scheme, e.g., open the Google map app ( comgooglemaps:// ).
So, there is a chance that the provided URL isn't valid and the system can't open the specified URL, e.g., the Google Map app doesn't install or a wrong URL scheme.
If you want to know the result of the action, whether it was a success or not , you can specify a completion handler when calling openURL .
In the following example, we open a non-existent URL scheme, sarunw://invalid-url-scheme .
If you tap the button, you will see the " Can open false " printout in the debug console.
This indicates that the system can't handle the provided URL .
Set Custom URL Handler
By default, the system provides a default open URL action ( OpenURLAction ) that depends on the passing URL.
It has the following behaviors:
- Open the associated app for a custom URL scheme or Universal Link .
- Open the user's default web browser for a normal URL .
We can opt out of the default behavior by providing a custom handler .
You can do that by setting a new OpenURLAction via environment(_:_:) modifier.
In this example, I am looking for a URL with a sarunw:// scheme and open https://sarunw.com instead.
1 If the open URL has a "sarunw" scheme, I return .systemAction(URL(string: "https://sarunw.com")!) which asks the system to open " https://sarunw.com " URL instead. 2 For other URLs, I rely on the default behavior by returning .systemAction .
With this new URL handler, the same code we used in the previous example is now working.
sarunw://invalid-url-scheme is now handled by our custom handle, which opens the https://sarunw.com URL instead when tapped.
And since the URL can now be opened, the openURL completion handler now returns true .
You may also like
- How to use SFSafariViewController in SwiftUI 27 Apr 2023
- WebView in SwiftUI 17 Apr 2023
- Using ForEach in SwiftUI List 27 Oct 2022
- How to change status bar color in SwiftUI 30 Jun 2022
- How to change SwiftUI list background color 06 Jul 2022
- How to use NSAttributedString in SwiftUI 03 Jul 2023
Enjoy the read?
If you enjoy this article, you can subscribe to the weekly newsletter. Every Friday , you'll get a quick recap of all articles and tips posted on this site . No strings attached. Unsubscribe anytime.
Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.
If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.
Let's learn about the new conditional directive, hasAttribute.
In Xcode 12 and iOS 14, we got a new way to configure an app launch screen without a Storyboard. Let's learn how to do it.
- Sponsorship
- Become a patron
- Buy me a coffee
- Privacy Policy
Dec 13, 2020
Supporting universal links with swiftui.
Imagine you're building a messaging app where you can invite people with a link. Normally, links are opened in Safari, which doesn't give your users the seamless experience you might hope for.
Luckily, you can implement a feature called universal links (often referred to as deep links), so if a user taps on a link associated with your application, the system will open your app in exactly the right context (i.e. a confirmation view to join a chat group).
If your app is not installed, the link will be opened in Safari, which you could use to let potential users know where to download it or provide a web-based experience. This is an advantage over custom URL schemes, which would offer similar functionality, but won't work if your app is not installed.
Before we handle universal links in your iOS application, we need to associate the domain you are going to use for universal links with it. This is done in the following step.
- ↔️ Hosting apple-app-site-association
When a user installs your application, the system will check that the associated domains your application uses serve an apple-app-site-association , which confirms that the domain permits universal links to be used with it. We need this two-way association to make sure that universal links will only be enabled if both your app and the domain support it, otherwise anyone could force potentially destructive actions by redirecting links to other applications.
The association file is encoded as JSON, and can contain multiple sections for different services, we'll focus on applinks for this guide. In the details, you can specify all applications that are authorized to be opened instead of Safari, when the links match specific components.
Supported components include URL path, search query, and fragment, more on this here . You can also exclude specific components, which should always be served via the web.
In our example, all links to our associated domain, starting with /link , will be regarded as universal links, and preferably opened in your application.
To make this information available, you need to host the apple-app-site-association file (without extensions) as a static file available at https://<your domain>/.well-known/apple-app-site-association . If you want to support different sub-domains, you need to host an association for each of those!
The association file also has to be served with the Content-Type application/json , which you might have to set manually (as the file does not have a file ending), depending on your web server, and without any redirects.
With the release of macOS Big Sur and iOS 14, your devices no longer directly fetch the file, instead, requests are sent to Apple's CDN and proxied to your web server. This also means that you cannot use non-public domains without using alternate modes .
To conclude
- host the apple-app-site-association on each of your (sub)-domains you want to use with universal links
- the file has to be hosted at https://<your domain>/.well-known/apple-app-site-association , without redirects, and as application/json
- the application identifiers in the file need to be constructed by combining your team identifier (can be checked in the Apple Developer membership page ) and bundle identifier (usually reversed domain and application name, can be found in Xcode)
- 📱 Supporting universal links in your application
To complete the two-way association, we need to add your previously configured associated domains to your application. This can be done by adding the Associated Domains capability, which will create the Associated Domains Entitlement in your app's entitlements file.
Supporting universal links for example.com would require you to add applinks:example.com to the associated domains. Note the service prefix, which defines the feature to be used with the domain.
With iOS 14, Apple introduced a new view modifier to SwiftUI, onOpenURL . Specifically designed for universal links, it allows to register a handler that will be called whenever your application is opened using a universal link, regardless of its state (foreground, background, force-quit).
This is a relatively simple example, once you tap a universal link, it will open your app and display this link. You can nest the onOpenURL anywhere you'd like, but it will only be triggered if this view is rendered, so only if that specific part of your application would display (e.g. if you show a different view tree to unauthenticated and authenticated users, you need to make sure to add your onOpenURL to the top-level view if it should be handled for both cases).
- 🥲 Debugging Universal Links
Unfortunately, it's not really straightforward to debug universal links. If you're tapping a link and it opens in Safari instead of your application, this could have multiple reasons:
- the association file on your domain was missing or did not get served correctly
- your application did not define the URL domain as an associated domain
Please check that you set up the association file correctly, one small mistake like an incorrect path, not using TLS, redirecting requests, sending the wrong content type, using the wrong team id or bundle identifier, etc. could be causing problems, so everything needs to be just right.
And if this still doesn't work but you're sure everything's set up correctly, there's probably some caching involved with detecting supported domains after installing your application, so it might help to remove the application, restart the device, and install it again. This should at least attempt to fetch the latest association file and reconcile it with the latest build of the app.
It took me a couple of attempts, but after installing the application and tapping on a universal link, it opens the application as expected. I personally think the system uses too much magic, as it's really challenging to comprehend what's happening in the background, and even harder to debug when it's not working, but it is quite a joy seeing the links work.
- 📚 Helpful References
- Apple Developer: Allowing Apps and Websites to Link to Your Content
- Apple Developer: Supporting Associated Domains
- Apple Developer: Supporting Universal Links in Your App
- GitHub: Setting up iOS Universal Links
- StackOverflow: iOS Universal Links are not opening in-app
In this Guide
Recommended
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to copy URL
Taylor Swift fans insist they spot hickey on singer’s neck at Sweden show after PDA-packed trip with Travis Kelce
- View Author Archive
- Get author RSS feed
Thanks for contacting us. We've received your submission.
That’s “So High School.”
Fans are convinced Travis Kelce gave Taylor Swift a hickey after she was spotted with a noticeable red mark on her neck during her Eras Tour stop in Sweden.
The pop star’s alleged love bite was visible as she pulled her hair to one side while performing “Champagne Problems” at the Friends Arena on Saturday night.
The bruise, which was located above the neckline of her blue lace dress, was nearly the same color as Swift’s iconic red lipstick.
“NOW MISS TAYLOR ALISON SWIFT IS THAT A HICKEY ON YOUR NECK OR DID YOU ‘BURN YOURSELF WITH A HAIR STRAIGHTENER’ ???” one fan wrote on X.
“Travis Kelce had big appetite,” another quipped.
“So High School is getting a little too real,” a third added, referring to the romantic track from the singer’s latest album, “The Tortured Poets Department.”
“I’ve been waiting for this,” a fourth chimed in.
The hickey speculation came days after Swift’s romantic Italian getaway with the Kansas City Chiefs tight end.
Last week, the “Lover” songstress and the football player, both 34, stayed three nights at the ritzy $21,000-per-night Villa Sola Cabiati in Lake Como, Italy.
They were spotted taking a romantic stroll at night and enjoying an outdoor candlelit dinner at the Grand Hotel Tremezzo.
Want more celebrity and pop culture news?
Start your day with Page Six Daily.
Thanks for signing up!
Please provide a valid email address.
By clicking above you agree to the Terms of Use and Privacy Policy .
Want celebrity news as it breaks? Hooked on Housewives?
The couple was also photographed taking a boat ride on Lake Como while holding each other close.
They appeared not to mind the rainy weather as they kissed and took photos while cruising around.
The pair’s romantic vacation came after Kelce arrived in Europe to support the 14-time Grammy winner at her 87th tour stop in Paris on May 12.
The “Cruel Summer” singer — who started dating the Super Bowl champion last summer — gave her beau several nods throughout her concert since 87 is also his jersey number.
At one point, she repped the Kansas City Chiefs colors in a bedazzled bustier and skater skirt for the “1989” era of her show.
She also changed the lyrics to “Karma,” singing, “Karma is the guy on the Chiefs coming straight home to me.”
Share this article:
Advertisement
Watch CBS News
Taylor Swift's European Eras Tour leg kicked off in Paris with a new setlist. See which songs are in and out.
May 9, 2024 / 8:24 PM EDT / CBS/AFP
Taylor Swift fever struck Paris on Thursday as the highest-grossing tour in history finally arrived in Europe, with fans treated to the first-ever performance of songs from her latest album.
The Eras Tour began its European leg with four dates at the La Defense Arena in Paris.
"I wish I could have toured Europe more. This is a dream crowd," the 34-year-old megastar told the ecstatic audience.
There were deafening shrieks as images of typewriter sheets indicated that songs off the new album "The Tortured Poets Department" were starting late in the show.
Emerging in a lyrics-covered dress, she ran through several of the darker new tracks starting with "But Daddy I Love Him" and "Fortnight", a particularly furious rendition of "Who's Afraid of Little Old Me?" and an elaborate "I Can Do it with a Broken Heart," with a golden-era Hollywood dance routine.
Other "The Tortured Poets Department" songs performed included "So High School," "Down Bad" and "The Smallest Man Who Ever Lived," according to ETonline .
"You were the first crowd to see songs from 'The Tortured Poets Department'," she said, before adding: "Or, as I like to call it, 'Female Rage: the Musical.'"
That was a dream come true for many in the audience.
"I've been so excited for so long, I can't believe it's actually happening," said 11-year-old Emma, who had flown in with her mother from New York.
Adding songs from "The Tortured Poets Department" wasn't the only change to the show and its 45-song setlist.
Perhaps the biggest change, according to ETonline, is the "Folklore" and "Evermore" setlists were combined, cutting four songs across the two albums: "'Tis the Damn Season," "Tolerate It," "The 1" and "The Last Great American Dynasty."
"On the Eras Tour, we have now reunited the sisters, combined them into one chapter," Swift said, according to video posted to social media. "You can call it "Folklore, Evermore" or you can call it the Sister Albums! You can call it whatever you want as long as you promise to sing 'Champagne Problems' with me."
"The Archer" was removed from the "Lovers" portion of the show and "Long Live" was cut from the "Speak Now" era setlist, according to ETonline.
One of the secret songs was, fittingly, the "Midnights" bonus track "Paris."
Parts of the show were also rearranged to make room for the newest era. The "Red" era was moved from the fifth to the third slot, according to ETonline, and the newest album was introduced following the "1989" set.
The venue said a fifth of the crowd were from the United States — many attracted by Europe's rules against charging huge mark-ups on resale tickets that can save Americans thousands of dollars compared with shows at home.
Georg'Ann Daly decided to celebrate her 23rd birthday with the Paris show. It meant flying from Nashville to Chicago to London and catching the Eurostar to Paris.
"I've always been obsessed with Taylor Swift," she told AFP.
A handful of superfans camped out from Tuesday in Paris to ensure they got a prime spot.
"I didn't plan to, but I came to check it out and I saw the first tents and I panicked a little," said Chris, 30.
Noah, 20, is seeing all four Paris concerts — he used 22 email addresses to get through the lottery system and secure the tickets.
After wrapping up her run in Paris, Swift will head for dates in Sweden, Portugal, Spain, Britain, Ireland, the Netherlands, Switzerland, Italy, Germany, Poland and Austria.
The Eras Tour has worked its way across North and South America and Asia since starting in March 2023.
By the end of the year, it had already become the first to sell more than $1 billion in tickets and is on track to more than double that by the time it concludes in Vancouver this December.
Swift's popularity shows no sign of dimming — the new album sold 1.4 million copies on its first day and broke every streaming record , reaching a billion streams on Spotify within five days.
Swift's tell-all dissections of her love stories have been the fuel powering her global domination, and fans have been poring over "The Tortured Poets Department" for cryptic clues about ex-boyfriend Joe Alwyn, her short-but-dramatic fling with Matty Healy (lead singer of The 1975), and her current partner, American football star Travis Kelce.
"Taylor talks about toxic relationships, impossible love, politics, mental health, and so much more," said Chris as she waited by her tent for the big moment. "I think we can all find a song that resonates with our experiences."
- Taylor Swift
- European Union
More from CBS News
Blue Origin launches first Black astronaut candidate 60 years after rejection
Lainey Wilson the big winner at 2024 Academy of Country Music Awards
Dow closes above 40,000 for first time, notching new milestone
Nazi's photo album shows life of a top Auschwitz officer
Safari Pearl is your source on the Palouse for comics, games, costumes, and theatrical make-up. Our selection of comics and graphic novels offer captivating stories for every taste, age, and reading level. We also have a great selection of board games, card games, role-playing games, 40K, and Age of Sigmar. Games are a great entertainment value, they bring people together, and they build brain power. Feel free to try a game or join an event in our store game room. Safari Pearl is also your local, year-round source for costumes, cosplay, and stage make-up. We can supply everything you need for your theatrical production, we'll happily help you plan a theme party, and we love Halloween...
Shop Our Web Store - Browse Our Pokemon And Magic Singles
Calendar Of Events - Safari Pearl Customer Wish List
Send An eGift Card - Check Your Gift Card Balance
Safari Pearl 660 W Pullman Rd Moscow, ID 83843 Monday - Saturday 11:00 am - 7:00 pm Sunday Noon - 5:00 pm 208-882-9499 - [email protected] Map it!
楖楳⁴獵漠潳楣污洠摥慩
慐瑲敮楲杮琠敄楦敮敄楳湧愠摮䈠極摬夠畯楆慮据慩畆畴敲
敗捬浯潔吠慲汩☠浡㭰匠楷瑦䘠湩湡楣污.
牔楡愦灭※睓晩⁴楆慮据慩獩愠洠汵楴札湥牥瑡潩慮楦慮据慩汰湡楮杮映物桴瑡栠汥獰映浡汩敩湡畢楳敮獳獥漠杲湡穩桴楥楦慮据慩楬敶牡畯摮琠敨瘠污敵桴瑡愠敲洠獯⁴浩潰瑲湡⁴潴琠敨唠楳杮愠湩整牧瑡摥瀠慬湮湩灡牰慯档琠慨⁴潣牯楤慮整湩敶瑳敭瑮愠摮椠獮牵湡散攠灸牥楴敳畯整浡椠湵煩敵祬瀠獯瑩潩敮潴栠汥⁰畯汣敩瑮敤敶潬⁰敳獮景搠物捥楴湯映牯琠敨物映湩湡楣污映瑵牵
瀼㰾散瑮牥㰾浩瑳汹㵥洢硡眭摩桴ㄺ〰∥爠晥牥敲灲汯捩㵹渢ⵯ敲敦牲牥•潬摡湩㵧氢穡≹搠捥摯湩㵧愢祳据•牳㵣栢瑴獰⼺洯摥慩慨摮敬牢慯牤摩敧摡楶潳潣⽭敭楤⽡㤵ㄹ〲琯慲汩猭楷瑦ⴠ楦慮据慩整浡漭瑣〲㌲樮杰•污㵴琢慲汩猭楷瑦ⴠ楦慮据慩整浡漭瑣〲㌲樮杰•楴汴㵥∢㰾振湥整㹲⼼㹰汃敩瑮䌠湥整敲ⵤ圠異⁴畯汣敩瑮楦獲⁴湡敳癲桴浥椠数獲湯污穩摥洠湡敮吠畲瑳䈠獡摥敗氠獩整慣敲畦汬ⱹ欠敥⁰畯潣浭瑩敭瑮ⱳ愠摮瀠潲楶敤琠浩汥⁹敳癲捩潴戠極摬琠畲瑳愠摮栠汥⁰畯汣敩瑮湵敤獲慴摮眠慣敲愠潢瑵琠敨獡椠摮癩摩慵獬桗汯楐瑣牵ⵥ圠潣獮摩牥琠敨搠灥桴愠摮戠敲摡桴漠汣敩瑮爦煳潵猻攠瑮物楦慮据慩楰瑣牵湩琠敨搠癥汥灯敭瑮漠畦汬⁹湩整牧瑡摥映湩湡楣污瀠慬䔠灸牥⁴敌ⵤ圠潣扭湩楨桧氠癥汥漠牰景獥楳湯污攠灸牥楴敳愠摮瀠慲瑣捩污攠灸牥敩据湩琠敨搠獥杩景漠牵挠楬湥♴獲畱㭯楦慮据慩汰湡吠慥慂敳ⵤ圠敨灬漠牵挠楬湥獴攠晦捩敩瑮祬映汯潬⁷桴潲杵楷桴琠敨物朠慯獬椠潣灭敬⁸楦慮据慩潷汲
䔢杮条湩Ⱨ琠畲瑳潷瑲票桴牯畯桧洦慤桳琻敨敳焠慵楬楴獥愠汬搠獥牣扩桴牔楡愦灭※睓晩⁴楆慮据慩整浡桔祥氠癯桴楥潷歲愠摮栠癡楧敶獵瀠牥潳慮ⱬ挠獵潴業敺敳癲捩湩愠汬琠敨映湩湡楣污瀠慬湮湩敷瘧潤敮眠瑩桴浥∮
慓慲䴠慌牷湥散䑍䔠敭杲湥祣删潯潄瑣牯愠⁴片瑩慭敍楤慣敃瑮牥簠渦獢㭰汃敩瑮吠敨琠獥楴潭楮污牰獥湥整慭⁹潮⁴敢爠灥敲敳瑮瑡癩景琠敨攠灸牥敩据景漠桴牥挠楬湥獴愠摮愠敲渠瑯愠朠慵慲瑮敥漠畦畴敲瀠牥潦浲湡散漠畳捣獥
- 汃捩义伭䙆䍉⁅潴猠档摥汵敭瑥湩湩漠牵䴠獯潣⁷晏楦散⠠敭瑥湩楬歮眠汩湩汣摵摡牤獥⥳
- 汃捩䥖呒䅕⁌潴猠档摥汵潚浯洠敥楴杮⠠畯整浡眠汩浥楡潹⁵潚浯洠敥楴杮氠湩牰潩潴礠畯敭瑥湩⥧
桐瑯潣牵整祳漠汁獩湯敍敹偲潨潴牧灡票挮浯
佔䰠䅅乒䴠剏⁅䉁問⁔低呒坈卅䕔乒䴠呕䅕⁌义䕖呓䕍呎匠剅䥖䕃ⱓ䰠䍌䄠䑎䤠協䘠义乁䥃䱁删偅䕒䕓呎呁噉卅䥖䥓㩔䘠义䅒䈠佒䕋䍒䕈䭃
- Work & Careers
- Life & Arts
Become an FT subscriber
Try unlimited access Only $1 for 4 weeks
Then $75 per month. Complete digital access to quality FT journalism on any device. Cancel anytime during your trial.
- Global news & analysis
- Expert opinion
- Special features
- FirstFT newsletter
- Videos & Podcasts
- Android & iOS app
- FT Edit app
- 10 gift articles per month
Explore more offers.
Standard digital.
- FT Digital Edition
Premium Digital
Print + premium digital, ft professional, weekend print + standard digital, weekend print + premium digital.
Essential digital access to quality FT journalism on any device. Pay a year upfront and save 20%.
- Global news & analysis
- Exclusive FT analysis
- FT App on Android & iOS
- FirstFT: the day's biggest stories
- 20+ curated newsletters
- Follow topics & set alerts with myFT
- FT Videos & Podcasts
- 20 monthly gift articles to share
- Lex: FT's flagship investment column
- 15+ Premium newsletters by leading experts
- FT Digital Edition: our digitised print edition
- Weekday Print Edition
- Videos & Podcasts
- Premium newsletters
- 10 additional gift articles per month
- FT Weekend Print delivery
- Everything in Standard Digital
- Everything in Premium Digital
Complete digital access to quality FT journalism with expert analysis from industry leaders. Pay a year upfront and save 20%.
- 10 monthly gift articles to share
- Everything in Print
- Make and share highlights
- FT Workspace
- Markets data widget
- Subscription Manager
- Workflow integrations
- Occasional readers go free
- Volume discount
Terms & Conditions apply
Explore our full range of subscriptions.
Why the ft.
See why over a million readers pay to read the Financial Times.
International Edition
View in English
Universal links for developers
Seamlessly link to content in your app or on your website. With universal links, you can always give users the most integrated mobile experience, even when your app isn’t installed on their device.
What’s new in universal links
Universal links allow your users to intelligently follow links to content in your app or to your website. Learn how the latest enhancements in universal links give your users the most integrated mobile and desktop experience, even when your app isn’t installed on their device.
Watch the video
Development resources
Download Xcode, which includes the iOS SDK, and use the development resources below to build apps that support universal links.
Guides and reference
Get details on how to build apps and websites that support universal links.
- Allowing apps and websites to link to your content
- UIApplicationDelegate
- NSUserActivity
Xcode and iOS
Xcode and the iOS SDK include APIs for building apps that support universal links.
- Download Xcode
Related technologies
Learn how to build more continuity between your apps and websites with Handoff, Shared Web Credentials, and Search.
Provide continuity within your apps and websites across multiple devices. Apps that support universal links automatically work with Handoff.
Shared web credentials
Make it easier for your users to sign in to your iOS app using usernames and passwords saved in Safari with iCloud Keychain.
Help users easily discover information in your apps and websites by surfacing your content in Search on iOS 9 or later.
Advertisement
Supported by
Dartmouth’s Leader Called in Police Quickly. The Fallout Was Just as Swift.
Local law enforcement went in just a couple of hours after a protest encampment went up.
- Share full article
By Vimal Patel
As the police arrested student protesters at Dartmouth College, a 65-year-old professor ended up on the ground.
Two student journalists, reporting that night, ended up arrested themselves.
And a bystander, visiting his father who lives near Dartmouth College, found himself with a fractured shoulder.
That was some of the collateral damage after the president of Dartmouth College, Sian Leah Beilock, took unusually swift action and authorized the police action on May 1 to clear an encampment that students had, just two hours earlier, pitched on the college green.
Dr. Beilock, a cognitive scientist who studies why people choke under pressure, has been facing a campus uproar ever since.
Presidents have faced a platter of unappealing choices in handling the student encampments, which have recently popped up all over the country, to protest Israel’s war in Gaza.
A few colleges, like Northwestern University, struck agreements with their student protesters, and found themselves criticized for being too lenient. Others, like Wesleyan University, said protesters would face discipline but that officials would not use force to clear the tents if students remained nonviolent.
And at places like University of Chicago, administrators had warned against the encampments, and watched them enlarge over days, before calling in the police.
Dartmouth College has stood out for its almost instantaneous response to a nonviolent protest.
Students there erected the tents at about 6:45 p.m., protectively surrounded by more than a hundred supporters, linking arms. After warnings to leave, campus safety officials deferred to the Hanover Police Department, the New Hampshire State Police, and other local agencies. Arrests began around 8:50 p.m.
In an email the day after the arrests, Dr. Beilock said that allowing the university’s shared spaces to be taken over for ideological reasons is “exclusionary at best and, at its worst, as we have seen on other campuses in recent days, can turn quickly into hateful intimidation where Jewish students feel unsafe.”
Moshe L. Gray, the longtime executive director of the Dartmouth chapter of Chabad, an Orthodox Jewish group, said Dr. Beilock has taken “a very principled stand” since Oct. 7, making her stand out from her Ivy peers.
“She has an obligation to keep this school safe,” Rabbi Gray said. “Jewish students feel like she has done that for them.”
But to some faculty members, using law enforcement to arrest nonviolent protesters broke the compact that should exist on college campuses.
“We’re supposed to be a living example for how we manage divisive topics, and the most important thing in this process is that we don’t engage each other as enemies,” said Udi Greenberg, a history professor. “Sending the police on protesters is the exact opposite of engaging each other in good faith.”
There was also the matter of injuries.
Andrew Tefft, visiting his dad from out of town, took a walk to the green as the police moved in. He said he was unconnected to the college or the protesters, so when an officer ordered him to move, he was confused.
”I guess I was dumb enough to say, ‘Where?’” Mr. Tefft, 45, said in an interview. “I feel my phone get knocked out of my hands and go flying and I feel my arms getting pulled. I feel the metal cuffs go on. I was like, ‘Oh, I’m being arrested.’”
He said he fractured his shoulder during a scuffle with the police. An arrest report said that Mr. Tefft did not comply with orders and behaved aggressively during the arrest.
“I grew up in this town,” said Mr. Tefft, who has fond memories of watching bonfires on the green, “and this is the craziest story that’s ever happened to me.”
Annelise Orleck, the former head of Jewish Studies at the university, said she started taking videos of the arrests, when she was knocked to the ground as she tried to grab her phone from a police officer.
Alesandra Gonzales, a student reporter witnessed the professor’s arrest. Then she, too, was arrested. She called out to another student reporter, Charlotte Hampton, a news managing editor, who also ended up zip-tied. In an interview, both said they had press identification.
Local and state police officials did not agree to interview requests.
The last time so many campuses resorted to the police to confront student protesters was 1970 during the antiwar movement, said David Farber, an American history professor at the University of Kansas who has studied the 1960s. Students then were far more militarized than today, he said, noting that they firebombed campus buildings across the country.
“What’s different about this period is there’s been so many confrontations so fast, so many administrators calling in the cops so quickly,” he said.
In the last month, more than 2,800 students have been arrested across the country.
On May 6, in a raucous online meeting with faculty, which quickly met the 500-person limit, Dr. Beilock tried to explain her fast reaction.
“An ongoing encampment is not something we can ensure the safety of,” she said, “especially if people outside Dartmouth decide to join with their own agendas.” She cited Columbia University, where some outsiders had joined the protests, but were certainly not in the majority.
Many faculty were not appeased. They said that the violence came from the police, not the protesters.
“Five tents,” wrote Carolyn Dever, a former Dartmouth provost, in the comments of the chat as Dr. Beilock spoke, which was repeated by many faculty members.
“This is not Columbia,” another faculty member wrote.
“Drop the charges,” wrote another.
Matthew J. Garcia, a history professor, said Dartmouth used a big-city solution for the serene, rural town of Hanover.
“It’s like a place out of time,” he said, adding, “It is absurd to suggest that this is a hotbed of revolution.”
The student newspaper also criticized the university in an editorial , demanding that the university urge the authorities to drop the charges against their reporters.
“The college should be embarrassed,” it stated. “We expect a prompt and public apology from College President Sian Leah Beilock.”
University administrators responded defiantly at first, saying they supported the student reporters’s right to clear their names “through the legal process.”
But as the backlash grew, and press freedom supporters slammed the university, Dr. Beilock relented, stating in a column in the student newspaper that the reporters should not have been arrested. “We are working with local authorities to ensure this error is corrected,” she wrote.
The charges against the reporters were dropped.
Some on campus may not be demand-her-resignation angry. In a measure perhaps of the high social cost of supporting Dr. Beilock, the student council voted publicly for a no-confidence measure, 13-2, with three abstaining. After the student body president vetoed the public vote, citing inadequate deliberation, another vote, held privately, reversed the decision, 9-8 against, with two abstaining. The entire student body is now voting on a no-confidence measure.
The faculty is divided.
“Our president is Jewish herself and has been on top of how Jewish students are feeling on the campus,” said Sergei Kan, an anthropology professor. He said students at the protest were chanting offensive, “borderline antisemitic” slogans like “ From the river to the sea , Palestine will be free.” (Many supporters of the Palestinians say the phrase is a rallying cry for the dignity of Palestinians).
“When they surrounded the tents and held hands, they were ready for a fight,” Dr. Kan said, adding that the green “belongs to all of us.”
Dartmouth’s board has also supported the action. Liz Cahill Lempres, Dartmouth’s board chair, said in an email to The Times that she had spoken with all board members and “each one unequivocally supports” Dr. Beilock.
In any case, the arrests may not deter the protesters. Months before tents became a symbol of pro-Palestinian activism on college campuses nationwide, Kevin Engel and other students set up two outside the Dartmouth administration building to seek divestment from Israel.
Mr. Engel, a first-year student, and another student were arrested on a trespassing charge, an early sign that Dr. Beilock was serious about cracking down on policy violators.
Dr. Beilock’s decision, Mr. Engel said, turbocharged the student activists.
“We’re not going to stop,” he said. “Palestine will be free within our lifetimes. The students are taking up the burden of doing that work because no one else really is.”
Vimal Patel writes about higher education with a focus on speech and campus culture. More about Vimal Patel
We've detected unusual activity from your computer network
To continue, please click the box below to let us know you're not a robot.
Why did this happen?
Please make sure your browser supports JavaScript and cookies and that you are not blocking them from loading. For more information you can review our Terms of Service and Cookie Policy .
For inquiries related to this message please contact our support team and provide the reference ID below.
I flew from LA to Paris to see Taylor Swift. I was only in the city for 48 hours but it was worth it and easier than I expected.
- I left LA on a Thursday, saw Taylor Swift in Paris on Saturday, and returned to LA on Sunday.
- The Eras Tour was as good as everyone says, but I was disappointed one album was left out.
- Overall my 48 hours in Paris was worth it, for Swift and for the food.
I'm not exactly what you would call a Swiftie — so why did I fly 11 hours each way from Los Angeles to Paris for a couple of days just to see Taylor Swift on the opening weekend of the latest leg of her record-shattering Eras Tour?
For one, my soon-to-be mother-in-law invited me on a girls' trip and bought great tickets. Two, because I have been a fan of Swift's for years. (I saw her open for Rascal Flatts in 2008. Yes, open!) And three, because, well, who wouldn't want to see the biggest pop star of her generation at the top of her game?
In 2023, Swift's Eras Tour was estimated to have generated more than $1 billion in ticket sales, the most ever for a tour. Even her film adaptation of the show drew in $250 million, making it the highest grossing concert film of all time. And in the US alone, the Eras Tour was estimated to have generated $5 billion in economic impact.
Taylor Swift is an event, and I didn't want to miss it.
Flying nonstop from LA to Paris on Air France was a breeze
I flew from LA to Paris on Thursday, May 9, and only had to take two days off work — not bad for a trip to Europe. My Air France flight left LAX at 3:20 p.m. and was scheduled to land in Paris the following day, Friday, at 11:15 a.m. local time.
I had an aisle seat in Premium Economy. While nothing like the first-class cabin, where the seats fully reclined into a flat bed, the premium economy seats were wider, had more leg room, and reclined a bit further than the seats in the main cabin. It also had a footrest that could be extended out.
At the start of the flight, Air France offered complimentary glasses of Champagne to all passengers, which I passed on. During dinner, I did have a free glass of red wine, which to my surprise, was actually pretty good.
Dinner was served less than two hours after takeoff. I had mushroom ravioli, which was served with a salad, soft French cheese, biscuits, a roll, and cheesecake — all of which were much better than what I'm used to having on flights. There was coffee and tea service after dinner, which came with a piece of dark chocolate.
I watched "The Lord of the Rings" for the 100th time before and during dinner, which made the time fly by. After the meal, the lights dimmed in the cabin, and it was time to try to sleep.
Armed with eye covers and noise-cancelling headphones, I was able to sleep for around five hours or so, even though it was probably only around 6 p.m. my local time when I fell asleep.
I woke up only when the lights had been turned on, and breakfast was being served, around an hour and a half before landing. Breakfast was a warm spinach and cheese pastry, a roll with butter and jam, orange juice, a fruit cup, and a yogurt drink.
I watched more "Lord of the Rings" and the flight landed on time.
Paris was full of Taylor Swift fans
We went straight from the airport to our hotel, had lunch at a café, and were walking to the Eiffel Tower by around 3 p.m. local time.
I was feeling a little sleepy, but it was surprisingly tolerable. The weather was amazing in Paris and there were people everywhere taking in the sunshine.
Swifties were also everywhere. I spotted plenty of Swift merch and the beaded friendship bracelets that have become a staple of the Eras Tour — which was unsurprising, considering some 42,000 people were expected to attend one of the four dates at La Defense Arena.
Related stories
It was clear the Swifties had come from all over too, including other countries in Europe and the US. Swift was even expected to attract five times as many luxury American travelers to Paris than the Olympics will when it kicks off in the city in July.
Speaking of the Olympics , several areas near the Eiffel Tower and other surrounding areas had temporary scaffolding, as seating and other infrastructure are being put in place to host the games.
After walking around Paris all afternoon, we went back to the hotel to take a quick nap, and then went out for dinner at a classic French brasserie, La Rotonde de la Muette. I had beef tartar with french fries that was so good it alone may have made the trip worth it.
Struggling to stay awake by the end of the evening, I went to sleep that night around 11 p.m. and slept a solid 11 hours — which I am convinced helped me get through the next day and avoid jet lag.
I woke up Saturday morning ready to go. After an amazing café breakfast, more walking, shopping, and croissants, we headed back to the hotel to get ready for the concert.
The concert was over three hours, and she played songs from the new album
Before we even left the hotel, an adorable little girl from the US approached us and asked if we wanted to trade friendship bracelets, the first of several times that would happen that night.
We took an Uber to La Defense Arena, located northwest of the city center and about 15 minutes from our hotel. As we got closer to the arena, the streets were packed with people and police.
The huge crowds outside the arena, waiting to buy merch or lining up to be let in, were decked out in sparkles, sequins, and cowboy hats. I spotted several outfits that looked almost exactly like ones Swift has worn herself, or that were clearly inspired by a specific album.
We finally got in around 5:45 p.m. With our tickets, we had access to a quite bougie lounge that had free food (delicious) and drinks (also delicious). Inside the lounge, we spotted a famous TikToker whose videos of the show that night racked up millions of views, and I casually started chatting to a former top executive of one of the big five tech companies.
We stayed in the lounge while watching the opener, Paramore. When the countdown appeared on the screen for Swift, we went to our actual seats, which were right outside the lounge, stage left.
I won't describe the concert in detail — there is, after all, an entire movie of it — but needless to say, it was as striking as everyone says. The set pieces, the outfits , and the dance numbers were all incredible.
But the real sight to behold was Swift herself, running up and down the stage in heels for more than three hours, never appearing out of breath or even very sweaty, frequently smiling so big and expressing so much gratitude that it was easy to forget this was just one of dozens of tour dates.
There were also some changes to the show, most notably the addition of songs from her new album, "The Tortured Poets Department."
I was shocked and a bit disappointed to realize Swift was not playing any songs from her first album . I was also baffled to learn that she's never explained why she chose to omit her self-titled debut that launched her into stardom from a tour meant to celebrate all the eras of her career.
Theories abound (though most of them also apply to her second album, "Fearless," which she did include), but perhaps the most convincing is simply that the album is not very popular with her fan base compared to her newer work.
But besides making this millennial feel a bit old and a little sad by not playing those songs, the show was still great.
I flew back to LA just two days after arriving and somehow avoided jet lag
We went back to the hotel right after the show to get some sleep before our flights. My Air France flight took off from Paris on Sunday, May 12, at 10:40 a.m. and was set to land in LA the same day at 1:05 p.m. local time, some 11 and a half hours later.
The flight went almost exactly the same as the first, with dinner served less than an hour and a have after take off — this time, it was a mashed pea vegetable dish, salad, roll, biscuits, and a lemon pastry. I watched more "Lord of the Rings" until the lights went out and it was time to sleep again. (I finished the entire trilogy during the flights to and from Paris.)
Surprisingly I was able to sleep on-and-off for around four hours, until eventually the light came back on and it was time for breakfast, about an hour and a half before landing.
We again landed right on time at LAX. I got through customs in about 15 minutes and took an Uber home. It was around 3 p.m., and I was definitely feeling a little bit out of it. Still I forced myself to stay awake and just lounged on the couch the rest of the day — something that I think also helped me avoid jet lag.
I went to sleep at a normal time that Sunday night, about 80 hours after I had first taken off for France, with 22 of those hours spent in the air.
I woke up Monday morning well-rested, feeling exactly how I do after a normal weekend.
Watch: A glitch in air traffic control left thousands of travelers stranded
- Main content
Taylor Swift Expands ‘Tortured Poets Department’ (Again) With Limited Edition First Draft Phone Memos
By Larisha Paul
Larisha Paul
The ever-expanding universe of Taylor Swift ‘s The Tortured Poets Department has spread out once again. The singer and songwriter has released new versions of three songs from the newly-released album. The earliest recorded editions of “The Black Dog,” “Cassandra,” and “Who’s Afraid Of Little Old Me?” billed as “the first draft phone memo” versions are available for purchase now — but not for long.
Stefanik Loses It When Fox News Host Reminds Her She Called Trump a 'Whack Job'
How kid rock went from america's favorite hard-partying rock star to a maga mouthpiece, taylor swift debuts ‘how did it end’ at final 2024 eras tour date in sweden, the mad scientist and the killer whales.
The Tortured Poets Department made chart history when it opened with more than 2.6 million units sold, marking the second-biggest debut behind only Adele’s 25, which had over 3 million album-equivalent units in 2015. Swift’s chart numbers are bolstered largely by traditional sales. Streaming accounts for much of it — it racked up over 891 million streams in its first week — but The Tortured Poets Department earned 1.91 million sales, thanks to the availability of nearly 20 different physical versions of the record.
How Kid Rock Went From America's Favorite Hard-Partying Rock Star to a MAGA Mouthpiece
- Devil With a Cause
- By David Peisner
- Swift in Sweden
- By Althea Legaspi
Sean Combs Claims 'Full Responsibility' for Cassie Assault in Video Apology: 'I Make No Excuses'
- 'i'm truly sorry'
- By Nancy Dillon and Cheyenne Roundtree
Cate Blanchett's Cannes Film 'Rumours' Named After Fleetwood Mac Album, Directors Confirm
- second hand news
- By Daniel Kreps
Charli XCX Isn't Holding Back
- By Hannah Ewens
Most Popular
'young sheldon' series finale breakdown: why jim parsons and mayim bialik became a bigger part of the ending, reba’s return and when the spinoff will pick up, bill maher says he doesn't understand harrison butker's graduation speech criticism, dj akademiks says he'll take entire industry down if convicted in rape lawsuit, jennifer lopez & ben affleck's reported marital troubles stem from this difficult-to-navigate issue, you might also like, demi moore on full frontal nudity with margaret qualley in ‘the substance’: ‘a very vulnerable experience’ but i had a ‘great partner who i felt very safe with’, exclusive: dior names charlize theron as jewelry and skin care ambassador, the best yoga mats for any practice, according to instructors, richard linklater on upcoming movie ‘nouvelle vague’: ‘it reminded me a lot about making my first film’, no a’s in attendance: oakland trails a whopping 553 u.s. teams.
Rolling Stone is a part of Penske Media Corporation. © 2024 Rolling Stone, LLC. All rights reserved.
Verify it's you
Please log in.
IMAGES
VIDEO
COMMENTS
Updated for Xcode 15. SwiftUI gives us a dedicated Link view that looks like a button but opens a URL in Safari when pressed. It's easy enough to use - just give it a title for the button, plus a destination URL to show, like this:
Swift Open Link in Safari. Ask Question Asked 9 years, 8 months ago. Modified 2 years, 2 months ago. Viewed 155k times 183 I am currently opening the link in my app in a WebView, but I'm looking for an option to open the link in Safari instead. webview; swift; safari; Share. Improve this question ...
If you want the user to exit your app and show a website in Safari, it's just one line of code in Swift. I'll make it three here because I'll create the URL in the code too, then safely unwrap it: if let url = URL(string: "https://www.hackingwithswift.com") { UIApplication.shared.open(url) } It's worth adding that you have the option of using ...
A step by step tutorial on opening a webpage in Safari from an iOS, iPadOS or MacOS app. Subscribe The following tutorial builds on our Open Source Swift starter project, which can be downloaded using the link below, and walks you through how to open up a URL in a native Safari browser when a user presses a custom button on an app using Swift.
There's 2 ways of opening a link with SwiftUI, on is using Link and Other one is using openURL environment key. Let's start with the first option using Link: Link's struct receives a title ...
1. Making a web view fill the screen. Sometimes you'll see folks add code to viewDidLoad() to create a web view then make it fill all available space. This is inefficient, and also far harder than it needs to be. A simpler approach is to add a property to your view controller like this: let webView = WKWebView() Then overriding the loadView ...
Overview. Create a link by providing a destination URL and a title. The title tells the user the purpose of the link, and can be a string, a title key that produces a localized string, or a view that acts as a label. The example below creates a link to example.com and displays the title string as a link-styled view: Link("View Our Terms of ...
An SFSafariViewController object presents a self-contained web interface inside your app. Present this view controller to let people view websites from anywhere on the internet without leaving your app. The web interface supports Safari features such as Reader, AutoFill, Fraudulent Website Warning, and content blocking.
Project outline, links, and more for the Swift Safari Follow Along project where you learn data science in Swift!
In SwiftUI, there are two ways to open a URL in Safari. Link view. openURL environment value. Open URL with Link view . We can use a Link view to open a URL in Safari. Link view is similar to a button, but instead of providing an action, we provide a destination URL that we want to open.
Support universal links. Take the following steps to support universal links: Create a two-way association between your app and your website and specify the URLs that your app handles, as described in Supporting associated domains. With universal links, users open your app when they click links to your website within Safari and WKWebView, and ...
Bruno. Dec 13, 2020. Supporting Universal Links with SwiftUI. HN. Imagine you're building a messaging app where you can invite people with a link. Normally, links are opened in Safari, which doesn't give your users the seamless experience you might hope for. Luckily, you can implement a feature called universal links (often referred to as deep ...
This short video will show you how to open a link from your own iOS Application using Swift!Project Code:https://github.com/ajaygandecha/Youtube-Video-FilesF...
In today's short video, we look at how to open a link into a Safari Web View. This is particularly useful to use when you do not need a full on web browsing ...
Following the stop in France, Swift and Kelce, both 34, flew up to Northern Italy for a romantic getaway in Lake Como, where they rented a 16th-century private villa.
Click to email a link to a friend (Opens in new window) Click to copy URL Taylor Swift fans insist they spot hickey on singer's neck at Sweden show after PDA-packed trip with Travis Kelce
Taylor Swift fans traveling to Europe for Eras Tour concerts 00:58. Taylor Swift fever struck Paris on Thursday as the highest-grossing tour in history finally arrived in Europe, with fans treated ...
Updated for Xcode 15. When your user taps a URL shown inside a SwiftUI Text or Link view, it will open in Safari by default. However, you can customize this behavior by replacing the openURL environment key - you might want to handle the link entirely, or perhaps pass it back to the system to open once your custom action completes.. For example, this code adjusts both a Link and a Text view ...
Taylor Swift debuted "How Did It End?" live for the first time at her third and final 2024 Eras Tour date at Friends Arena in Stockholm, Sweden. The song is among the new tracks she's been ...
Send An eGift Card - Check Your Gift Card Balance. Safari Pearl. 660 W Pullman Rd. Moscow, ID 83843. Monday - Saturday 11:00 am - 7:00 pm. Sunday Noon - 5:00 pm. 208-882-9499 - [email protected]. Map it! Safari Pearl, your one stop shop for comics, games, costumes, and more!
Schedule A Meeting With Justin Swift: Click IN-OFFICE to schedule a meeting in our Moscow Office (meeting link will include address) Click VIRTUAL to schedule a Zoom meeting (our team will email you a Zoom meeting link prior to your meeting) 408 S. Jefferson St., Suite 101. Moscow, ID 83843. (208) 892-5724.
Butker is in the final year of a five-year contract worth over $20 million, according to USA Today.Meanwhile, Swift earns between $10 million to $13 million per night on her Eras Tour, Forbes ...
We've successfully integrated deep linking into our iOS application using Universal Links. However, when users click on a link shared in an Instagram story, we currently redirect them to our website instead of opening the app. Our client prefers a dynamic approach: opening the app if it's installed and redirecting to the website if it's not.
Live news: US stocks notch fourth straight week of gains; Investor and 'Dragon' Deborah Meaden: 'I am not mean. What I am is . . . tough'
Learn how to build more continuity between your apps and websites with Handoff, Shared Web Credentials, and Search. Seamlessly link to content inside your app, or on your website in iOS 9 or later. With universal links, you can always give users the most integrated mobile experience, even when your app isn't installed on their device.
Moshe L. Gray, the longtime executive director of the Dartmouth chapter of Chabad, an Orthodox Jewish group, said Dr. Beilock has taken "a very principled stand" since Oct. 7, making her stand ...
Taylor Swift Draws Five Times as Many US Luxury Travelers as the Olympics That's according to one of the largest agencies catering to America's ultrahigh-net-worth jet-setters. Facebook
Ray Dalio warned the probability of a US civil war is as high as 40% — and said he might back Taylor Swift if she ran for president. "We are now on the brink," he told the Financial Times in a ...
The set pieces at Taylor Swift's the Eras Tour were amazing. Kelsey Vlamis We finally got in around 5:45 p.m.
The ever-expanding universe of Taylor Swift's The Tortured Poets Department has spread out once again. The singer and songwriter has released new versions of three songs from the newly-released ...