# Exclude whole category of Objective-C class

**URL:** <https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410>\
**Category:** Using Swift\
**Created:** [June 28, 2019, 10:39am UTC](https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410 "2019-06-28T10:39:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolgear](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lolgear/32/4790_2.png) [@lolgear](https://forums.swift.org/u/lolgear)\
**Post date:** [June 28, 2019, 10:39am UTC](https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410/1 "2019-06-28T10:39:59Z")

</div>

I know that it is possible to set \_\_deprecated attribute to category.

Is it possible to exclude whole category of Objective-C class by, for example, exclude attribute?

---

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [June 28, 2019, 3:49pm UTC](https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410/2 "2019-06-28T15:49:29Z")

</div>

` __attribute__ ((unavailable))` (or `UNAVAILABLE_ATTRIBUTE` in Apple headers) might do what you want. There's also `NS_SWIFT_UNAVAILABLE` if you just want to mark things unavailable from Swift.

---

<div class="post-metadata">

**Author:** ![lolgear](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lolgear/32/4790_2.png) [@lolgear](https://forums.swift.org/u/lolgear)\
**Post date:** [June 29, 2019, 3:12pm UTC](https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410/3 "2019-06-29T15:12:49Z")

</div>

Did you try it?

I mark category interface in header as unavailable and still have category symbols in Swift.

---

<div class="post-metadata">

**Author:** ![michelf](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/michelf/32/1180_2.png) [@michelf](https://forums.swift.org/u/michelf)\
**Post date:** [June 30, 2019, 3:05am UTC](https://forums.swift.org/t/exclude-whole-category-of-objective-c-class/26410/4 "2019-06-30T03:05:17Z")

</div>

Another option...

```swift
#if DEPLOYMENT_RUNTIME_SWIFT
// Swift should see nothing.
#else

@interface MyObject (CategoryName)
- (void)someCategoryMethod;
@end

#endif

```
