Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7623457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:42:41+00:00 2026-05-31T04:42:41+00:00

I have a protocol from QuickLook framework: /*! * @abstract The QLPreviewItem protocol declares

  • 0

I have a protocol from QuickLook framework:

/*!
 * @abstract The QLPreviewItem protocol declares the methods that a QLPreviewController  instance uses to access the contents of a given item.
 */
@protocol QLPreviewItem <NSObject>

@required

/*!
 * @abstract The URL of the item to preview.
 * @discussion The URL must be a file URL. 
 */
@property(readonly) NSURL * previewItemURL;

@optional

/*!
 * @abstract The item's title this will be used as apparent item title.
 * @discussion The title replaces the default item display name. This property is optional.
 */
@property(readonly) NSString * previewItemTitle;


@end

/*!
 * @abstract This category makes NSURL instances as suitable items for the Preview Controller.
 */
@interface NSURL (QLPreviewConvenienceAdditions) <QLPreviewItem>
@end

I’m trying to create the getter and setter for the readonly property previewItemTitle so I can add my custom tile:

.h

#import <Foundation/Foundation.h>
#import <QuickLook/QuickLook.h>

@interface QLPreviewItemCustom : NSObject <QLPreviewItem> {
    NSURL * previewItemURL;
    NSString *previewItemTitle;
}


@property(readonly) NSURL * previewItemURL;
@property (readonly) NSString *previewItemTitle;


@end

.m

#import "QLPreviewItemCustom.h"


@implementation QLPreviewItemCustom

@synthesize previewItemTitle;
@synthesize previewItemURL;


@end

This way, as I understand, I will create just the getter with the synthesize method. How can I create the setter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:42:43+00:00Added an answer on May 31, 2026 at 4:42 am

    If it’s just in your implementation of QLPreviewItemCustom that you want to access the setter, then why not extend the property in a class continuation category to read-write:

    QLPreviewItemCustom.m

    #import "QLPreviewItemCustom.h"
    
    @interface QLPreviewItemCustom ()
    
    @property (readwrite) NSURL *previewItemURL;
    @property (readwrite) NSString *previewItemTitle;
    
    @end
    
    @implementation QLPreviewItemCustom
    
    @synthesize previewItemTitle;
    @synthesize previewItemURL;
    
    @end
    

    If you want to use the setter everywhere then you’ll have to use a different ivar name and write your getter for the original to pass through to your new one. Like this:

    QLPreviewItemCustom.h

    #import <Foundation/Foundation.h>
    #import <QuickLook/QuickLook.h>
    
    @interface QLPreviewItemCustom : NSObject <QLPreviewItem> {
        NSURL *url;
        NSString *title;
    }
    
    
    @property (readwrite) NSURL *url;
    @property (readwrite) NSString *title;
    
    @end
    

    QLPreviewItemCustom.m

    #import "QLPreviewItemCustom.h"
    
    @implementation QLPreviewItemCustom
    
    @synthesize url;
    @synthesize title;
    
    - (NSURL*)previewItemURL {
        return self.url;
    }
    
    - (NSString*)previewItemTitle {
        return self.title;
    }
    
    @end
    

    It’s worth also pointing out that it’s not generally a good idea to use the same class prefix yourself as is used by another framework. i.e. don’t call it QLPreviewItemCustom – call it something like ABCPreviewItemCustom.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a protocol that requires a length field up to 32-bits, and it
I have a class that executes the MSNP15 protocol. The protocol requires clients to
i have a C# app that registers a protocol. When you click BLAH://djfhgjfdghjkd in
I have .Net service that listens on single port over TCP protocol. Clients connect
I have an algorithm that uses the following OpenSSL calls: HMAC_update() / HMAC_final() //
I have a protocol that my ApplicationDelegate implements. I want to pass this to
We have a communication protocol that requires us to Base64 Encoded a SHA1 hash
So we have http://127.0.0.1:4773/robot10382.flv?action=read we need to get out from it protocol , ip/
For every object that can have a delegate, there is a corresponding protocol, that
I have run headfirst into this reject error from exim4: 2010-02-15 01:46:05 SMTP protocol

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.