<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1" -->

---
title: Swift protocols and the main actor | daily.dev
description: Explores how Swift&#x27;s @MainActor attribute interacts with protocol declarations, covering two distinct approaches: isolating an entire protocol to the main...
canonical: https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Swift protocols and the main actor | daily.dev
og:description: Explores how Swift&#x27;s @MainActor attribute interacts with protocol declarations, covering two distinct approaches: isolating an entire protocol to the main...
og:url: https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1
og:image: https://api.daily.dev/og/posts/c2wwA6HX1.png
og:image:alt: Swift protocols and the main actor
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Swift protocols and the main actor

**[Swift by Sundell](https://daily.dev/sources/swiftbysundell)** · 6 min read · 1 upvotes · 0 comments

## Summary

Explores how Swift's @MainActor attribute interacts with protocol declarations, covering two distinct approaches: isolating an entire protocol to the main actor versus annotating individual requirements. Isolating a whole protocol makes main actor isolation a conformance requirement, which can unexpectedly change the isolation of conforming types and prevents custom actors from conforming. Marking individual requirements with @MainActor instead decouples the protocol from that isolation, allowing custom actors to conform and enabling mixed isolated/non-isolated requirements within the same protocol. The author recommends whole-protocol isolation only for protocols exclusively adopted by main-actor-bound types like SwiftUI Views or UIKit view controllers.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.swiftbysundell.com/articles/swift-protocols-and-the-main-actor>

## Similar posts on daily.dev

- [An Even Closer Look at Protocols and Global Actors](https://daily.dev/posts/an-even-closer-look-at-protocols-and-global-actors-vi6craiff) · Matt Massicotte · 0 upvotes · 0 comments
- [Should you opt-in to Swift 6.2’s Main Actor isolation? – Donny Wals](https://daily.dev/posts/should-you-opt-in-to-swift-6-2-s-main-actor-isolation-donny-wals-n4cyosvtk) · Donny Wals · 0 upvotes · 0 comments
- [MainActorMessage & AsyncMessage: Concurrency-safe notifications](https://daily.dev/posts/mainactormessage-asyncmessage-concurrency-safe-notifications-lllck2gts) · SwiftLee · 0 upvotes · 0 comments

---

Tags: [#swift](https://daily.dev/tags/swift)

[View this post on daily.dev](https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Swift protocols and the main actor","url":"https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1"},"datePublished":"2026-07-31T12:13:15.511Z","dateModified":"2026-07-31T18:18:20.913Z","description":"Explores how Swift's @MainActor attribute interacts with protocol declarations, covering two distinct approaches: isolating an entire protocol to the main...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3a8399451e7bfda5d55fe84fbf8db1b3?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3a8399451e7bfda5d55fe84fbf8db1b3?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Swift by Sundell","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Swift by Sundell","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/42173ef29edf4b928c02307e3051f0d7","url":"https://daily.dev/sources/swiftbysundell"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/swift-protocols-and-the-main-actor-c2wwa6hx1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"swift","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Swift by Sundell","item":"https://daily.dev/sources/swiftbysundell"},{"@type":"ListItem","position":3,"name":"Swift protocols and the main actor"}]}
```

