

#Swift share custom text social media code#
For example, here is a chart that fetches the data from the Codemagic REST API and displays the build times using Swift Charts!Īnd here is the corresponding code for the whole view: One of the biggest surprises this year for SwiftUI has been the announcement of an entirely new framework: Swift Charts, a data visualization framework written in SwiftUI that enables you to create beautiful charts.Ĭustom charts that would otherwise take hundreds of lines of code to create can now be simplified to a few lines of code. So, let’s dive into everything that SwiftUI 4.0 has to offer you! Swift Charts We’ve architected a new SwiftUI app structure and much more. We’ve introduced some amazing new graphical techniques. We’ve made more custom experiences possible. With this year’s APIs, we’ve gone deeper.

Here’s a quote from the session on “ What’s new in SwiftUI”: The team behind SwiftUI has taken into account the feedback they got on Twitter and other social networking sites, resulting in some fantastic APIs to work and play with this year! To get a solid background, we do the same thing as with a gradient, but the two colors have to match.Since Apple started using SwiftUI in its operating systems, it has been experiencing a noticeable evolution, from redesigns of apps to deep system integrations. In this case, we have to pass a string with the HEX value of the color. The key for the sticker is: Gradient backgroundįor a gradient background, we need to pass two colors: one for the top and one for the bottom. Instagram will open and it will show our image in the story composer.īut what about using a video, gradient, or sticker as the background? Background image/videoĪs said above, in order to have a background image or video, we need to set a data object for one of these two keys: StickerĪs an image, a sticker also accepts data.

We also create the options for the pasteboard, and in this case, we set the expiration date for our image. Sharer.js is a very small Javascript library for creating custom social sharing components on the DOM elements of your website. We now create an array of dictionaries the type we need to put something in the pasteboard.Once we convert our image or video to the correct format, we need to copy that in the system pasteboard, where Instagram will get the data from. In order to pass an image or a video, we have to convert it into data. Once we are sure of that, we can proceed.You can choose a different standard font, like title or caption, using the font (:) view modifier. After that, we checked if the system can open Instagram - or rather if it is on the device. A text view draws a string in your app’s user interface using a body font that’s appropriate for the current platform.We are using the optional binding if-let because the URL init returns an optional value. Basically, here we created a URL with Instagram’s scheme.
