Home Blog Page 3829

Utilizing SwiftData with Preview in SwiftUI


Within the earlier tutorial, I’ve walked you thru the fundamentals of SwiftData, a brand new framework launched in iOS 17 as a substitute for Core Information. You probably have adopted that tutorial, it is best to now be conversant in utilizing SwiftData to save lots of and handle knowledge in a database. The built-in @Mannequin macro and the @Question macro tremendously simplify the method of defining knowledge mannequin and retrieving data from the database, making it extraordinarily straightforward for builders to deal with persistent knowledge.

The Preview function in SwiftUI is very useful because it permits builders to immediately visualize the app’s consumer interface with out the necessity to launch the simulator. Nevertheless, utilizing SwiftData with SwiftUI Preview requires some extra steps. On this tutorial, we are going to discover easy methods to combine SwiftData with SwiftUI Preview successfully.

Observe: When you haven’t learn the SwiftData tutorial, I extremely suggest checking it out first, as this tutorial references a few of the supplies lined in that tutorial.

Revisiting the Information Mannequin and SwiftData

Within the earlier instance, we now have constructed a mannequin class for ToDoItem like this:

import Basis
import SwiftData

@Mannequin class ToDoItem: Identifiable {
    var id: UUID
    var identify: String
    var isComplete: Bool

    init(id: UUID = UUID(), identify: String = "", isComplete: Bool = false) {
        self.id = id
        self.identify = identify
        self.isComplete = isComplete
    }
}

SwiftData simplifies the method of defining a schema utilizing code. You solely have to mark the mannequin class with the @Mannequin macro. SwiftData will then robotically allow persistence for the info class.

So as to drive the info operations (like replace, insert, learn, and delete), we additionally have to arrange the mannequin container. Within the ToDoDemoAppApp.swift, we now have hooked up the modelContainer modifier like beneath:

struct ToDoDemoAppApp: App {
    var physique: some Scene {
        WindowGroup {
            ContentView()
        }
        .modelContainer(for: ToDoItem.self)
    }
}

This configuration is basically all you want earlier than beginning to work with SwiftData.

Preview with SwiftData and In-memory Container

Within the Todo app demo, we now have a ContentView that masses and shows the to-do merchandise within the record view. Right here is the pattern code:

struct ContentView: View {
    @Atmosphere(.modelContext) non-public var modelContext

    @Question var todoItems: [ToDoItem]

    var physique: some View {
        NavigationStack {
            Checklist {
                ForEach(todoItems) { todoItem in
                    HStack {
                        Textual content(todoItem.identify)

                        Spacer()

                        if todoItem.isComplete {
                            Picture(systemName: "checkmark")
                        }
                    }
                }
            }

            .navigationTitle("To Do Checklist")
        }
    }
    }

You can also make the preview work by writing the preview code like this:

#Preview {
    ContentView()
        .modelContainer(for: ToDoItem.self)
}

Nevertheless, on this case, the preview solely shows an empty Todo record as a result of the container doesn’t have any knowledge populated. When you need to have some pattern knowledge, you’ll be able to create a customized mannequin container particularly for the preview. Right here is an instance:

@MainActor
let previewContainer: ModelContainer = {
    do {
        let container = strive ModelContainer(for: ToDoItem.self,
                                           configurations: .init(isStoredInMemoryOnly: true))

        for _ in 1...10 {
            container.mainContext.insert(generateRandomTodoItem())
        }

        return container
    } catch {
        fatalError("Didn't create container")
    }
}()

func generateRandomTodoItem() -> ToDoItem {
    let duties = [ "Buy groceries", "Finish homework", "Go for a run", "Practice Yoga", "Read a book", "Write a blog post", "Clean the house", "Walk the dog", "Attend a meeting" ]

    let randomIndex = Int.random(in: 0..

We instantiate a ModelContainer with an in-memory configuration and populate the container with 10 random to-do gadgets. To make use of this preview container, you merely modify the preview code and specify to make use of the previewContainer:

#Preview {
    ContentView()
        .modelContainer(previewContainer)
}

When you made the modification, the preview pane ought to present you the Todo record view with 10 random gadgets.

swiftdata-preview-demo

Abstract

SwiftUI Preview is a useful function that enables builders to visualise their app’s consumer interface immediately, with out the necessity to launch the simulator. This tutorial supplies complete steering on successfully utilizing SwiftData with SwiftUI Preview. You must learn to create a customized container populated with pattern knowledge particularly for preview functions.

When you get pleasure from studying this tutorial and wish to be taught extra about SwiftUI, don’t overlook to take a look at our Mastering SwiftUI e book for iOS 17 and Xcode 15.

Notifications in iOS 18.1 may very well be the killer Apple Intelligence characteristic

0


One thing rings true about Apple’s catchphrase for Apple Intelligence: ‘AI for the remainder of us.’ AI can do some actually spectacular (and problematic) issues. However typically it’s the boring, sensible enhancements which are really most helpful. For instance, day by day ‘the remainder of us’ endure the tedious activity of notification administration. And in iOS 18.1, Apple has made notifications so a lot better due to AI summaries.

Notification summaries are a brand new AI characteristic

Apple Intelligence may have a staggered rollout, however notification summaries are one in all a number of options launching this fall.

In case you have a supported Apple Intelligence machine, then when iOS 18.1 arrives (most likely late October), your notifications from key apps can be extra informative than ever earlier than.

I’ve been utilizing the betas for iOS 18.1, iPadOS 18.1, and macOS Sequoia 15.1 since they arrived in July. In that point, notification summaries are simply the Apple Intelligence characteristic I’ve gotten probably the most profit from.

Higher notifications would possibly sound too boring to be a killer AI characteristic, however that’s precisely what they’ve been for me.

How AI notification summaries work

Notification summaries are designed primarily for communication apps.

Whenever you obtain an e-mail, for instance, AI will present a abstract of that e-mail’s contents within the notification.

Mail notification in iOS 18.1

The identical is true for messages. If somebody sends you a quick message, you’ll see the precise message contents within the notification—like at all times.

But when a message is a little bit longer, Apple Intelligence summarizes its content material within the notification you obtain. You received’t see the precise message’s textual content in your notification, however what you get is definitely a lot better.

This additionally works when the group chat blows up. Your prime notification will present a abstract of what the dialog is all about.

All summarized notifications are denoted by a small icon, so you realize it’s not the precise message content material being displayed.

Your iPhone’s deeper understanding of the contents of messages additionally powers the brand new Precedence Notifications characteristic. iOS 18.1 extra prominently shows the alerts it thinks are particularly essential. You’ll additionally see summaries inside your Mail inbox.

Why notifications generally is a killer characteristic

Mail notification summaries iOS 18.1

I’ve been getting summarized notifications from each the Messages app and Apple Mail in iOS and iPadOS 18.1.

Although the characteristic isn’t probably the most thrilling, it’s offered a significant productiveness and a focus profit for me.

All all through my day, whether or not I’m working or I’m hanging out with household and buddies, notifications fill my units.

When a notification arrives, I’ve to make a judgment name: is that this one thing essential, or not?

  • If it’s essential, I’ll cease what I’m doing to deal with it instantly
  • If it’s not essential, I can ignore it and go about my day

This key choice level—which all of us expertise many occasions day by day—is made a lot simpler with Apple Intelligence.

Beforehand, notifications for emails and longer messages had been usually fully ineffective. By together with solely an excerpt of the beginning of a message, they not often offered sufficient information to assist me make an knowledgeable choice round engagement.

As an alternative, what would usually occur is one in all two issues:

  1. Both I’d cease what I’m doing and open the Mail or Messages app, which took extra time and meant higher interruption to what I used to be already doing
  2. Or, I’d ignore the notification, and later uncover both that it was positive to disregard, or I’d be taught it had been essential and I ought to have paid consideration sooner

AI notification summaries have made this drawback a factor of the previous.

Now, my iPhone and iPad present far more informative notifications, which I can shortly look at and resolve whether or not to deal with or ignore.

There’s no must open Messages or Mail until one thing is really essential. And the circulate of my day and my thought sample is minimally disrupted.

Supported apps and units for notification summaries

At the moment within the iOS 18.1 beta, notification summaries can be found for Apple’s Messages and Mail apps.

Within the close to future although, third-party apps will be capable to present the identical utility. Apple’s advertising and marketing supplies present Slack providing summarized notifications, for instance.

Notification summaries are solely out there with Apple Intelligence. Meaning you want a suitable machine, such because the iPhone 15 Professional or an upcoming iPhone 16 mannequin.

One good element: when you have a suitable iPhone, your Apple Watch will profit from AI summaries too.

Have you ever used AI notification summaries? What’s your expertise been like? Tell us within the feedback.

FTC: We use revenue incomes auto affiliate hyperlinks. Extra.

What’s new in Workflows? | Databricks Weblog

0


Databricks Workflows is the cornerstone of the Databricks Knowledge Intelligence Platform, serving because the orchestration engine that powers important knowledge and AI workloads for hundreds of organizations worldwide. Recognizing this, Databricks continues to spend money on advancing Workflows to make sure it meets the evolving wants of recent knowledge engineering and AI tasks.

This previous summer season, we held our greatest but Knowledge + AI Summit, the place we unveiled a number of groundbreaking options and enhancements to Databricks Workflows. Current updates, introduced on the Knowledge + AI Summit, embrace new data-driven triggers, AI-assisted workflow creation, and enhanced SQL integration, all aimed toward enhancing reliability, scalability, and ease of use. We additionally launched infrastructure-as-code instruments like PyDABs and Terraform for automated administration, and the final availability of serverless compute for workflows, guaranteeing seamless, scalable orchestration. Trying forward, 2024 will convey additional developments like expanded management stream choices, superior triggering mechanisms, and the evolution of Workflows into LakeFlow Jobs, a part of the brand new unified LakeFlow resolution.

On this weblog, we’ll revisit these bulletins, discover what’s subsequent for Workflows, and information you on the way to begin leveraging these capabilities immediately.

The Newest Enhancements to Databricks Workflows

The previous 12 months has been transformative for Databricks Workflows, with over 70 new options launched to raise your orchestration capabilities. Beneath are among the key highlights:

Knowledge-driven triggers: Precision once you want it

  • Desk and file arrival triggers: Conventional time-based scheduling isn’t enough to make sure knowledge freshness whereas lowering pointless runs. Our data-driven triggers be certain that your jobs are initiated exactly when new knowledge turns into out there. We’ll test for you if tables have up to date (in preview) or new recordsdata have arrived (usually out there) after which spin up compute and your workloads once you want them. This ensures that they devour sources solely when mandatory, optimizing price, efficiency, and knowledge freshness. For file arrival triggers particularly, we have additionally eradicated earlier limitations on the variety of recordsdata Workflows can monitor.
  • Periodic triggers: Periodic triggers will let you schedule jobs to run at common intervals, resembling weekly or every day, with out having to fret about cron schedules.
Schedules & Triggers

AI-assisted workflow creation: Intelligence at each step

  • AI-Powered cron syntax technology: Scheduling jobs may be daunting, particularly when it includes advanced cron syntax. The Databricks Assistant now simplifies this course of by suggesting the right cron syntax primarily based on plain language inputs, making it accessible to customers in any respect ranges.
  • Built-in AI assistant for debugging: Databricks Assistant can now be used instantly inside Workflows (in preview). It offers on-line assist when errors happen throughout job execution. For those who encounter points like a failed pocket book or an incorrectly arrange activity, Databricks Assistant will supply particular, actionable recommendation that can assist you shortly determine and repair the issue.
AI-assisted workflow creation

Workflow Administration at Scale

  • 1,000 duties per job: As knowledge workflows develop extra advanced, the necessity for orchestration that may scale turns into important. Databricks Workflows now helps as much as 1,000 duties inside a single job, enabling the orchestration of even essentially the most intricate knowledge pipelines.
  • Filter by favourite job and tags: To streamline workflow administration, customers can now filter their jobs by favorites and tags utilized to these jobs. This makes it straightforward to shortly find the roles you want, e.g. of your staff tagged with “Monetary analysts”.
  • Simpler collection of activity values: The UI now options enhanced auto-completion for activity values, making it simpler to cross data between duties with out guide enter errors.
  • Descriptions: Descriptions enable for higher documentation of workflows, guaranteeing that groups can shortly perceive and debug jobs.
  • Improved cluster defaults: We have improved the defaults for job clusters to extend compatibility and scale back prices when going from interactive improvement to scheduled execution.
Workflow Management at Scale

Operational Effectivity: Optimize for efficiency and value

  • Value and efficiency optimization: The brand new timeline view inside Workflows and question insights present detailed details about the efficiency of your jobs, permitting you to determine bottlenecks and optimize your Workflows for each pace and cost-effectiveness.
  • Value monitoring: Understanding the fee implications of your workflows is essential for managing budgets and optimizing useful resource utilization. With the introduction of system tables for Workflows, now you can monitor the prices related to every job over time, analyze tendencies, and determine alternatives for price financial savings. We have additionally constructed dashboards on prime of system tables you can import into your workspace and simply customise. They may also help you reply questions resembling “Which jobs price essentially the most final month?” or “Which staff is projected to exceed their funds?”. It’s also possible to arrange budgets and alerts on these.
Operational Efficiency

Enhanced SQL Integration: Extra Energy to SQL Customers

  • Activity values in SQL: SQL practitioners can now leverage the outcomes of 1 SQL activity in subsequent duties. This characteristic allows dynamic and adaptive workflows, the place the output of 1 question can instantly affect the logic of the subsequent, streamlining advanced knowledge transformations.
  • Multi-SQL assertion help: By supporting a number of SQL statements inside a single activity, Databricks Workflows affords larger flexibility in establishing SQL-driven pipelines. This integration permits for extra subtle knowledge processing with out the necessity to swap contexts or instruments.
Enhanced SQL Integration

Serverless compute for Workflows, DLT, Notebooks

  • Serverless compute for Workflows: We have been thrilled to announce the final availability of serverless compute for Notebooks, Workflows, and Delta Reside Tables at DAIS. This providing was rolled out to most Databricks areas, bringing the advantages of performance-focuses quick startup, scaling, and infrastructure-free administration to your workflows. Serverless compute removes the necessity for advanced configuration and is considerably simpler to handle than traditional clusters.
Serverless compute for Workflows

What’s Subsequent for Databricks Workflows?

Trying forward, 2024 guarantees to be one other 12 months of great developments for Databricks Workflows. This is a sneak peek at among the thrilling options and enhancements on the horizon:

Streamlining Workflow Administration

The upcoming enhancements to Databricks Workflows are centered on enhancing readability and effectivity in managing advanced workflows. These modifications goal to make it simpler for customers to arrange and execute subtle knowledge pipelines by introducing new methods to construction, automate, and reuse job duties. The general intent is to simplify the orchestration of advanced knowledge processes, permitting customers to handle their workflows extra successfully as they scale.

Serverless Compute Enhancements

We’ll be introducing compatibility checks that make it simpler to determine workloads that might simply profit from serverless compute. We’ll additionally leverage the ability of the Databricks Assistant to assist customers transition to serverless compute.

Lakeflow: A unified, clever resolution for knowledge engineering

In the course of the summit we additionally launched LakeFlow, the unified knowledge engineering resolution that consists of LakeFlow Join (ingestion), Pipelines (transformation) and Jobs (orchestration). All the orchestration enhancements we mentioned above will turn out to be part of this new resolution as we evolve Workflows into LakeFlow Jobs, the orchestration piece of LakeFlow.

Attempt the Newest Workflows Options Now!

We’re excited so that you can expertise these highly effective new options in Databricks Workflows. To get began:

Quick Frontend Improvement with David Hsu


Retool is a platform to assist engineers rapidly construct inner frontends. It does this by abstracting away repetitive features of frontend improvement. The platform was began in 2017 and has obtained funding from Sequoia, Stripe Co-Founders, and Nat Friedman.

David Hsu is the founder and CEO of Retool. He joins the present to speak about why he began coding, learning philosophy and pc science, Retool’s tech stack, and extra.

Paweł is the founder at flat.social the world’s first ‘flatverse’ start-up and glot.house, an AI-powered language studying app. Pawel’s background is as a full-stack software program engineer with a lean and experimental strategy in the direction of product improvement. With a powerful grounding in computing science, he spent the final decade getting early-stage merchandise off the bottom – each in startup and company settings. Comply with Paweł on Twitter, LinkedIn and his private web site – pawel.io.

Sponsors

Are you continue to utilizing .env recordsdata to handle your secrets and techniques? Secrets and techniques are important for integrating your infrastructure with databases and SaaS providers, however now there’s a greater method to handle them.

Doppler is a developer-first platform that simplifies your secrets and techniques administration workflow and helps you progress past .env recordsdata. It permits you to securely retailer and simply entry your secrets and techniques, eliminating the chance of human error and unauthorized entry.

Doppler integrates seamlessly together with your current instruments and dev surroundings, streamlining your workflow and saving you worthwhile time. Plus, with role-based entry management and detailed audit logs, you may guarantee your secrets and techniques are all the time beneath management.

Get began with Doppler as we speak and expertise the way forward for secrets and techniques administration. Go to doppler.com/sed for a demo and see how Doppler can revolutionize your improvement course of.

WorkOS is a contemporary id platform constructed for B2B SaaS, offering a faster path to land enterprise offers.

It offers versatile APIs for authentication, person id, and sophisticated options like SSO and SCIM provisioning.

It’s a drop-in substitute for Auth0 (auth-zero) and helps as much as 1 million month-to-month lively customers without spending a dime. At present, a whole bunch of high-growth scale-ups are already powered by WorkOS, together with ones you most likely know, like Vercel, Webflow, Perplexity, and Drata.

Just lately, WorkOS introduced the acquisition of Warrant, the Tremendous Grained Authorization service. Warrant’s product relies on a groundbreaking authorization system referred to as Zanzibar, which was initially designed by Google to energy Google Docs and YouTube. This permits quick authorization checks at huge scale whereas sustaining a versatile mannequin that may be tailored to even probably the most complicated use circumstances.

In case you are at the moment trying to construct Function-Primarily based Entry Management or different enterprise options like SAML , SCIM, or person administration, try workos.com/SED to get began without spending a dime.

Do you like traditional console video video games however don’t like paying unfair costs? Online game Market makes it straightforward to browse total online game console libraries after which purchase video games immediately from particular person sellers with no further charges.

On the lookout for a sealed copy of your favourite recreation? Or simply attempting to gather all of the video games in an obscure RPG collection? Possibly you simply need an inexpensive, used copy of a traditional platforming or combating recreation? Go to vgmarketplace.com to buy retro console video games and discover the bottom costs on-line.

VGMarketplace makes it enjoyable to hunt for the classics you already know and love, and people uncommon hidden gems you’ve all the time wished. Take a look at vgmarketplace.com



A Developer’s Roadmap to Predictive Again (Views)


The primary milestone is to improve to Kotlin 1.8.0 or larger, which is required for different Predictive Again dependencies.

Upgrade to Kotlin 1.8.0 or higher

Again-to-home animation milestone

The back-to-home animation is the keystone predictive again animation.

To get this animation, add android:enableOnBackInvokedCallback=true in your AndroidManifest.xml on your root exercise if you’re a multi-activity app (see per-activity opt-in) or on the software stage if you’re a single-activity app. After this, you’ll see each the back-to-home animation and a cross-task animation the place relevant, that are seen to customers in Android 15+ and behind a developer choice in Android 13 and 14.

In case you are intercepting again occasions in your root exercise (e.g. MainActivity), you possibly can proceed to take action however you’ll want to make use of supported APIs and also you gained’t get the back-to-home animation. Because of this, we usually advocate you solely intercept again occasions for UI logic; for instance, to indicate a dialog asking the person to save lots of earlier than they stop.

See the Add help for the predictive again gesture information for extra particulars.

Milestone grid

Migrate all actions milestone

In case you are a multi-activity app, you’ll must opt-in and deal with again occasions inside these actions too to get a system managed cross-activity animation. Study extra about per-activity opt-in, obtainable for gadgets working Android 14+. The cross-activity animation is seen to customers in Android 15+ and behind a developer choice in Android 13 and 14.

Customized cross exercise animations are additionally obtainable with overrideActivityTransition.

Milestone grid

Fragment milestone

Subsequent, you’ll wish to focus in your fragment animations and transitions. This requires updating to AndroidX fragment 1.7.0 and transition 1.5.0 or later and utilizing Animator or AndroidX Transitions. Assuming these necessities are met, your present fragment animations and transitions will animate consistent with the again gesture. You too can use materials movement with fragments. Most materials motions help predictive again as of 1.12.02-alpha02 or larger, together with MaterialFadeThrough, MaterialSharedAxis and MaterialFade.

Don’t attempt to make your fragment transitions appear like the system’s cross-activity transition. We advocate this full display floor transition as an alternative.

Study extra about Fragments and Predictive Again.

Milestone grid

Materials Parts milestone

Lastly, you’ll wish to benefit from the Materials Part View animations obtainable for Predictive Again. Study extra about obtainable parts.

Milestone grid

After this, you’ve accomplished your quest to help Predictive Again animations in your view based mostly app.

[Optional] AndroidX Transitions milestone

Should you’re up for extra, you may also guarantee your AndroidX transitions are supported with Predictive Again. Learn extra about AndroidX Transitions and the Predictive Again Progress APIs.

Milestone grid

Different Assets