Avatar ·

Objective-C से #pragma mark को Swift में कैसे बदलें? क्या कोई विकल्प है?

सभी को नमस्कार! मैं हाल ही में Objective-C से Swift पर आया हूँ और मुझे #pragma mark का कोई विकल्प नहीं मिल रहा है। Objective-C में मैं बड़ी फ़ाइलों में कोड को संरचित करने के लिए #pragma mark - Lifecycle, #pragma mark - TableView Delegate आदि का उपयोग करता था। इससे Xcode में Jump Bar के माध्यम से नेविगेट करने में बहुत मदद मिलती थी।

मैंने // MARK: दो स्लैश और एक स्पेस के साथ लिखने की कोशिश की, लेकिन Xcode कभी-कभी इसे नेविगेशन पैनल में नहीं दिखाता। यहाँ मेरे कोड का एक उदाहरण है:

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
    }

    private func setupUI() {
        // इंटरफ़ेस सेटअप
    }

    // MARK: - TableView DataSource

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return UITableViewCell()
    }
}