realm / realm/SwiftLint

Make type_contents_order to enable placement init() in SwiftUI views above computed properties

Open
#3,548 5 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

I think for SwiftUI views such order should be supported by default
Or there should be possibility to exclude some content types from ordering like only initializers to enable random placing.

struct MainTabView: View {

    @StateObject var tabState: TabState

    init(state: TabState) {
        _tabState = StateObject(wrappedValue: state)
    }

    var body: some View {
        TabView(selection: $tabState.selection) {
            DashboardView()
            ProfileView()
        }
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the type_contents_order rule and its configuration, then compare its current ordering behavior with the SwiftUI example in the issue. Done means initializers can be placed above computed properties by default or the relevant content types can be excluded from ordering, with coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.