icrate
Bindings to Apple's frameworks
0.1.2
7.0M downloads/mo
#3780 most downloaded on crates.io
madsmtm/objc2
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Ships fairly regularly
a new release about every 4 months
Most releases are documented
notes for 6 of 7 stable releases
1 version withdrawn
withdrawn after publishing
4 years old
8 releases · first in 2022
0 releases in the last 12 months
see the full history below
Release timeline
8 releases · Sep 2022 to Apr 2024Releases
latest 8-
0.1.217 Apr 2024Nothing published for this version
-
0.1.117 Apr 2024Release notes
Open source →Deprecated
- Deprecated the
icratecrate, it has been split into multiple smaller crates.
- Deprecated the
-
0.1.023 Dec 2023Release notes
Open source →Added
- Added
MainThreadMarkerFromimplementation forMainThreadOnlytypes. - Added
SendandSyncimplementations for a bunch more types (same as the ones Swift marks as@Sendable). - Made some common methods in
AppKitsafe. - Added missing
NSCopyingandNSMutableCopyingzone methods. - Added
EqandOrdimplementations forNSNumber, since its handling of floating point values allows it. - Added
NS[Mutable]Dictionary::from_id_sliceandNS[Mutable]Dictionary::from_slice. - Added
NSMutableDictionary::insertandNSMutableSet::insertwhich can be more efficient than the previous insertion methods.
Changed
-
Updated SDK from Xcode 14.2 to 15.0.1.
View the release notes to learn more details:
Breaking changes are noted elsewhere in this changelog entry.
-
Moved the
ns_string!macro toicrate::Foundation::ns_string. The old location in the crate root is deprecated. -
BREAKING: The following two methods on
MTLAccelerationStructureCommandEncodernow take a nullable scratch buffer:refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffsetrefitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_options
-
BREAKING: Marked UI-related classes as
MainThreadOnly, and UI-related protocols asIsMainThreadOnly.This means that they can now only be constructed, retrieved and used on the main thread, meaning you usually have to aquire a
MainThreadMarkerfirst.// Before let app = unsafe { NSApplication::sharedApplication() }; let view = unsafe { NSView::initWithFrame(NSView::alloc(), frame) }; // Do something with `app` and `view` // After let mtm = MainThreadMarker::new().unwrap(); let app = unsafe { NSApplication::sharedApplication(mtm) }; let view = unsafe { NSView::initWithFrame(mtm.alloc(), frame) }; // Do something with `app` and `view` -
BREAKING: Changed the
NSAppstatic to be a function takingMainThreadMarker. -
BREAKING: Renamed
NS[Mutable]Dictionary::from_keys_and_objectstoNS[Mutable]Dictionary::from_vec. -
BREAKING: Renamed
NSMutableDictionary::insertandNSMutableSet::inserttoinsert_id. -
BREAKING:
CWWiFiClient::interfaceNameshas been renamed toCWWiFiClient::interfaceNames_class. -
BREAKING: Updated
objc2tov0.5.0. -
BREAKING: Updated
block2tov0.4.0.
Removed
- BREAKING: Removed the
MainThreadMarkerargument from the closure passed toMainThreadBound::get_on_main. - BREAKING: Removed
Foundation::CopyHelpersince it is superseded byobjc2::mutability::CounterpartOrSelf. - BREAKING: Removed the following APIs, as they are no longer available in macOS 14 / iOS 17:
NSFileProviderDomain::volumeUUIDCLBeaconIdentityConstraint::UUIDCLBeaconIdentityConstraint::majorCLBeaconIdentityConstraint::minorASIdentifierManager::clearAdvertisingIdentifier
- Removed private
MetricKit::_MXSignpostMetricsSnapshotfunction.
Fixed
- BREAKING: Added
Eq + Hashrequirement on mostNSDictionaryandNSSetmethods, thereby making sure that the types are actually correct to use in such hashing collections. - BREAKING: Added
HasStableHashrequirement onNSDictionaryandNSSetcreation methods, fixing a long-standing soundess issue. - Fixed the protocol names of
NSAccessibilityElementProtocol,NSTextAttachmentCellProtocolandNSFileProviderItemProtocol. - BREAKING: Generic types no longer strictly require
Message(although most of their trait implementations still require that). - BREAKING: Removed a workaround that made the
NSCopyingandNSMutableCopyingprotocols not act as regular protocols (many methods usedAnyObjectinstead of the correctProtocolObject<dyn NSCopying>). - Update the minimum deployment target, which adds a few missing protocol
implementations and methods for
NSPopoverandNSLayoutAnchor. - BREAKING:
CKSystemSharingUIObserverandCKLocationSortDescriptorare no longer marked thread safe. - BREAKING:
NSColor::ignoresAlphanow requires a main thread marker.
- Added
-
0.0.431 Jul 2023Release notes
Open source →Changed
- BREAKING: Updated
block2tov0.3.0.
Fixed
- Documentation on docs.rs.
- BREAKING: Updated
-
0.0.320 Jun 2023Release notes
Open source →Added
- Added the following frameworks:
HealthKitMediaPlayerMetricKitPhotoKit
- Added
NSCopyingandNSMutableCopyingimplementations for the classes that implement those protocols. - Added the following methods:
NSArray::get_retainedNSArray::first_retainedNSArray::last_retainedNSSet::get_retainedNSSet::to_vecNSSet::to_vec_retainedNSDictionary::get_retainedNSDictionary::keys_retainedNSDictionary::values_retained
- Added
MainThreadMarker::allocfor allocating objects that need to be so on the main thread. - Added automatically generated
new/initmethods for all types. - Added
FromIteratorimpls for various collection types.
Changed
-
BREAKING: Renamed the
from_slicemethod onNSArray,NSSet,NSMutableArrayandNSMutableSettofrom_id_slice, and provided a newfrom_slicemethod that takes&[&T]instead. -
BREAKING: Changed
NSMutableArray::replaceto return anResultin case the index was out of bounds. -
BREAKING: Changed
NSMutableArray::removeto return anOptionin case the index was out of bounds. -
BREAKING: Removed ownership parameter from generic types, since the ownership/mutability information is now stored in
ClassType::Mutability. -
BREAKING: Renamed
NSMutableCopying::mutable_copyto::mutableCopy. -
BREAKING: The default value for
NSUUIDwas changed from a nil UUID to a new random UUID. -
BREAKING: Changed how iteration works.
Instead of the single
NSFastEnumerator, we now have concrete typesarray::Iter,array::IterMut,array::IterRetainedandarray::IntoIter, which allows iterating overNSArrayin different ways.Combined with proper
IntoIteratorimplementations for collection types, you can now do:let mut array: Id<NSMutableArray<T>> = ...; for item in &array { // item: &T } // If T: IsMutable for item in &mut array { // item: &mut T } // If T: IsIdCloneable for item in array.iter_retained() { // item: Id<T> } for item in array { // item: Id<T> }(similar functionality exist for
NSSetandNSDictionary). -
BREAKING: Renamed
NSDictionarymethods:keys->keys_vec.values->values_vec.values_mut->values_vec_mut.keys_and_objects->to_vecs.iter_keys->keys.iter_values->values.
-
BREAKING:
NSDictionary::keys_retainedandNSDictionary::values_retainednow return an iterator instead. -
BREAKING: Updated
objc2tov0.4.0. -
BREAKING: Updated
block2tov0.2.0.
Removed
- BREAKING: Removed various redundant
NSProxymethods. - BREAKING: Removed
NSArray::to_shared_vecandNSArray::into_vec, useNSArray::to_vecorNSArray::to_vec_retainedinstead. - BREAKING: Removed associated types from
NSCopyingandNSMutableCopying, that information is now specified inClassType::Mutabilityinstead. - BREAKING: Removed a few
initmethods on subclasses that were declared on categories on their superclass. These should be re-added at some point.
Fixed
- Soundness issues with enumeration / iteration over collection types.
- Added the following frameworks:
-
0.0.207 Feb 2023Release notes
Open source →Added
- Added the following frameworks:
AccessibilityAdServicesAdSupportAutomaticAssessmentConfigurationAutomatorBackgroundAssetsBackgroundTasksBusinessChatCallKitClassKitCloudKitContactsCoreLocationDataDetectionDeviceCheckEventKitExceptionHandlingExtensionKitExternalAccessoryFileProviderFileProviderUIGameControllerGameKitIdentityLookupInputMethodKitLinkPresentationLocalAuthenticationLocalAuthenticationEmbeddedUIMailKitMapKitMetalMetalFXMetalKitOSAKitCoreAnimation(also known asQuartzCore)SoundAnalysisSpeechStoreKitUniformTypeIdentifiersUserNotificationsWebKit
- Updated the SDK version from XCode
14.0.1to14.2.- See differences here.
- Added
Foundation::MainThreadBoundhelper struct for things that are only accesible from the main thread. - Added
#[deprecated]annotations to the autogenerated output. - Added disambiguation for duplicated methods (e.g.
NSThread::threadPriorityvs.NSThread::threadPriority_class). - Properly implemented protocols for defined classes.
Changed
-
Cfg-gated static
ns_string!functionality behind theunstable-static-nsstringcargo feature. -
Autogenerated method parameters are now in snake-case, for better IDE support.
-
BREAKING: Cfg-gate all classes, and everything that references said classes.
This means that to use e.g.
Foundation::NSThread::name, you have to enable theFoundation_NSThreadandFoundation_NSStringcargo features. -
BREAKING: Updated
objc2tov0.3.0-beta.5. -
BREAKING: Updated
block2tov0.2.0-alpha.8.
Removed
- BREAKING: The optional
uuidintegration, since one might want to useicrateinternally in that crate in the future, and that would break. - BREAKING: Removed
NSNib::instantiateWithOwner_topLevelObjects,NSBundle::loadNibNamed_owner_topLevelObjectsandNSFreeMapTablesince they had weird memory management.
Fixed
- Ensure we never hit a memory management issue again.
- BREAKING: Fixed a few
*mutpointers that should've been*const. - BREAKING: Fixed a few generic ownership parameters that defaulted to
Shared. - Removed a few instances of
TodoProtocols. - Fixed type-encoding of a few
structs. - Fixed
NSProxytrait methods. - BREAKING: Fixed type in methods that worked with out-parameters.
- Added the following frameworks:
-
0.0.124 Dec 2022Release notes
Open source →Added
- Added
NSString::write_to_file. - Added
NSLockclass andNSLockingprotocol. - Added autogenerated implementations of the following frameworks:
AppKitAuthenticationServicesCoreDataFoundation
Changed
- BREAKING: Moved from
objc2::foundationintoicrate::Foundation. - BREAKING: Changed the following methods:
NSStringconcat->stringByAppendingStringjoin_path->stringByAppendingPathComponenthas_prefix->hasPrefixhas_suffix->hasSuffix
NSMutableStringfrom_nsstring->stringWithStringwith_capacity->stringWithCapacitypush_nsstring->appendStringreplace->setString
NSAttributedStringinit_with_attributes->unsafe initWithString_attributesinit_with_string->initWithStringnew_with_attributes->unsafe new_with_attributeslen_utf16->length
NSMutableAttributedStringreplace->setAttributedString
NSBundlemain->mainBundleinfo->infoDictionary
NSDictionarykeys_array->allKeysinto_values_array->allValues
NSMutableDictionaryclear->removeAllObjects
NSMutableArrayclear->removeAllObjects
NSMutableSetclear->removeAllObjects
NSErroruser_info->userInfolocalized_description->localizedDescription
NSExceptionuser_info->userInfo
NSMutableDatafrom_data->dataWithDatawith_capacity->dataWithCapacityset_len->setLength
NSUUIDnew_v4->UUIDstring->UUIDString
NSThreadcurrent->currentThreadmain->mainThreadis_main->isMainThread
NSProcessInfoprocess_info->processInfo
- BREAKING: Make
NSComparisonResultwork like all other enums. - BREAKING: Changed
NSDictionaryto beSharedby default. - BREAKING (TEMPORARY): Renamed
NSEnumerator,NSFastEnumerationandNSFastEnumeratoruntil the story around them are properly figured out. - BREAKING: Make
NSArray::objects_in_rangereturn anOption(it was unsound before).
Fixed
- Fixed
NSZonenot specifying a#[repr(...)].
- Added
-
0.0.019 Sep 2022 withdrawnNothing published for this version