PackageTrack
Sign in Get early access

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 2024
2023 2024 2025 2026
Release Pre-release Withdrawn

Releases

latest 8
  1. 0.1.2 17 Apr 2024

    Nothing published for this version

  2. 0.1.1 17 Apr 2024
    Release notes

    Deprecated

    • Deprecated the icrate crate, it has been split into multiple smaller crates.
    Open source →
  3. 0.1.0 23 Dec 2023
    Release notes

    Added

    • Added MainThreadMarker From implementation for MainThreadOnly types.
    • Added Send and Sync implementations for a bunch more types (same as the ones Swift marks as @Sendable).
    • Made some common methods in AppKit safe.
    • Added missing NSCopying and NSMutableCopying zone methods.
    • Added Eq and Ord implementations for NSNumber, since its handling of floating point values allows it.
    • Added NS[Mutable]Dictionary::from_id_slice and NS[Mutable]Dictionary::from_slice.
    • Added NSMutableDictionary::insert and NSMutableSet::insert which 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 to icrate::Foundation::ns_string. The old location in the crate root is deprecated.

    • BREAKING: The following two methods on MTLAccelerationStructureCommandEncoder now take a nullable scratch buffer:

      • refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset
      • refitAccelerationStructure_descriptor_destination_scratchBuffer_scratchBufferOffset_options
    • BREAKING: Marked UI-related classes as MainThreadOnly, and UI-related protocols as IsMainThreadOnly.

      This means that they can now only be constructed, retrieved and used on the main thread, meaning you usually have to aquire a MainThreadMarker first.

      // 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 NSApp static to be a function taking MainThreadMarker.

    • BREAKING: Renamed NS[Mutable]Dictionary::from_keys_and_objects to NS[Mutable]Dictionary::from_vec.

    • BREAKING: Renamed NSMutableDictionary::insert and NSMutableSet::insert to insert_id.

    • BREAKING: CWWiFiClient::interfaceNames has been renamed to CWWiFiClient::interfaceNames_class.

    • BREAKING: Updated objc2 to v0.5.0.

    • BREAKING: Updated block2 to v0.4.0.

    Removed

    • BREAKING: Removed the MainThreadMarker argument from the closure passed to MainThreadBound::get_on_main.
    • BREAKING: Removed Foundation::CopyHelper since it is superseded by objc2::mutability::CounterpartOrSelf.
    • BREAKING: Removed the following APIs, as they are no longer available in macOS 14 / iOS 17:
      • NSFileProviderDomain::volumeUUID
      • CLBeaconIdentityConstraint::UUID
      • CLBeaconIdentityConstraint::major
      • CLBeaconIdentityConstraint::minor
      • ASIdentifierManager::clearAdvertisingIdentifier
    • Removed private MetricKit::_MXSignpostMetricsSnapshot function.

    Fixed

    • BREAKING: Added Eq + Hash requirement on most NSDictionary and NSSet methods, thereby making sure that the types are actually correct to use in such hashing collections.
    • BREAKING: Added HasStableHash requirement on NSDictionary and NSSet creation methods, fixing a long-standing soundess issue.
    • Fixed the protocol names of NSAccessibilityElementProtocol, NSTextAttachmentCellProtocol and NSFileProviderItemProtocol.
    • BREAKING: Generic types no longer strictly require Message (although most of their trait implementations still require that).
    • BREAKING: Removed a workaround that made the NSCopying and NSMutableCopying protocols not act as regular protocols (many methods used AnyObject instead of the correct ProtocolObject<dyn NSCopying>).
    • Update the minimum deployment target, which adds a few missing protocol implementations and methods for NSPopover and NSLayoutAnchor.
    • BREAKING: CKSystemSharingUIObserver and CKLocationSortDescriptor are no longer marked thread safe.
    • BREAKING: NSColor::ignoresAlpha now requires a main thread marker.
    Open source →
  4. 0.0.4 31 Jul 2023
    Release notes

    Changed

    • BREAKING: Updated block2 to v0.3.0.

    Fixed

    • Documentation on docs.rs.
    Open source →
  5. 0.0.3 20 Jun 2023
    Release notes

    Added

    • Added the following frameworks:
      • HealthKit
      • MediaPlayer
      • MetricKit
      • PhotoKit
    • Added NSCopying and NSMutableCopying implementations for the classes that implement those protocols.
    • Added the following methods:
      • NSArray::get_retained
      • NSArray::first_retained
      • NSArray::last_retained
      • NSSet::get_retained
      • NSSet::to_vec
      • NSSet::to_vec_retained
      • NSDictionary::get_retained
      • NSDictionary::keys_retained
      • NSDictionary::values_retained
    • Added MainThreadMarker::alloc for allocating objects that need to be so on the main thread.
    • Added automatically generated new/init methods for all types.
    • Added FromIterator impls for various collection types.

    Changed

    • BREAKING: Renamed the from_slice method on NSArray, NSSet, NSMutableArray and NSMutableSet to from_id_slice, and provided a new from_slice method that takes &[&T] instead.

    • BREAKING: Changed NSMutableArray::replace to return an Result in case the index was out of bounds.

    • BREAKING: Changed NSMutableArray::remove to return an Option in 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_copy to ::mutableCopy.

    • BREAKING: The default value for NSUUID was changed from a nil UUID to a new random UUID.

    • BREAKING: Changed how iteration works.

      Instead of the single NSFastEnumerator, we now have concrete types array::Iter, array::IterMut, array::IterRetained and array::IntoIter, which allows iterating over NSArray in different ways.

      Combined with proper IntoIterator implementations 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 NSSet and NSDictionary).

    • BREAKING: Renamed NSDictionary methods:

      • 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_retained and NSDictionary::values_retained now return an iterator instead.

    • BREAKING: Updated objc2 to v0.4.0.

    • BREAKING: Updated block2 to v0.2.0.

    Removed

    • BREAKING: Removed various redundant NSProxy methods.
    • BREAKING: Removed NSArray::to_shared_vec and NSArray::into_vec, use NSArray::to_vec or NSArray::to_vec_retained instead.
    • BREAKING: Removed associated types from NSCopying and NSMutableCopying, that information is now specified in ClassType::Mutability instead.
    • BREAKING: Removed a few init methods 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.
    Open source →
  6. 0.0.2 07 Feb 2023
    Release notes

    Added

    • Added the following frameworks:
      • Accessibility
      • AdServices
      • AdSupport
      • AutomaticAssessmentConfiguration
      • Automator
      • BackgroundAssets
      • BackgroundTasks
      • BusinessChat
      • CallKit
      • ClassKit
      • CloudKit
      • Contacts
      • CoreLocation
      • DataDetection
      • DeviceCheck
      • EventKit
      • ExceptionHandling
      • ExtensionKit
      • ExternalAccessory
      • FileProvider
      • FileProviderUI
      • GameController
      • GameKit
      • IdentityLookup
      • InputMethodKit
      • LinkPresentation
      • LocalAuthentication
      • LocalAuthenticationEmbeddedUI
      • MailKit
      • MapKit
      • Metal
      • MetalFX
      • MetalKit
      • OSAKit
      • CoreAnimation (also known as QuartzCore)
      • SoundAnalysis
      • Speech
      • StoreKit
      • UniformTypeIdentifiers
      • UserNotifications
      • WebKit
    • Updated the SDK version from XCode 14.0.1 to 14.2.
      • See differences here.
    • Added Foundation::MainThreadBound helper 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::threadPriority vs. NSThread::threadPriority_class).
    • Properly implemented protocols for defined classes.

    Changed

    • Cfg-gated static ns_string! functionality behind the unstable-static-nsstring cargo 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 the Foundation_NSThread and Foundation_NSString cargo features.

    • BREAKING: Updated objc2 to v0.3.0-beta.5.

    • BREAKING: Updated block2 to v0.2.0-alpha.8.

    Removed

    • BREAKING: The optional uuid integration, since one might want to use icrate internally in that crate in the future, and that would break.
    • BREAKING: Removed NSNib::instantiateWithOwner_topLevelObjects, NSBundle::loadNibNamed_owner_topLevelObjects and NSFreeMapTable since they had weird memory management.

    Fixed

    • Ensure we never hit a memory management issue again.
    • BREAKING: Fixed a few *mut pointers 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 NSProxy trait methods.
    • BREAKING: Fixed type in methods that worked with out-parameters.
    Open source →
  7. 0.0.1 24 Dec 2022
    Release notes

    Added

    • Added NSString::write_to_file.
    • Added NSLock class and NSLocking protocol.
    • Added autogenerated implementations of the following frameworks:
      • AppKit
      • AuthenticationServices
      • CoreData
      • Foundation

    Changed

    • BREAKING: Moved from objc2::foundation into icrate::Foundation.
    • BREAKING: Changed the following methods:
      • NSString
        • concat -> stringByAppendingString
        • join_path -> stringByAppendingPathComponent
        • has_prefix -> hasPrefix
        • has_suffix -> hasSuffix
      • NSMutableString
        • from_nsstring -> stringWithString
        • with_capacity -> stringWithCapacity
        • push_nsstring -> appendString
        • replace -> setString
      • NSAttributedString
        • init_with_attributes -> unsafe initWithString_attributes
        • init_with_string -> initWithString
        • new_with_attributes -> unsafe new_with_attributes
        • len_utf16 -> length
      • NSMutableAttributedString
        • replace -> setAttributedString
      • NSBundle
        • main -> mainBundle
        • info -> infoDictionary
      • NSDictionary
        • keys_array -> allKeys
        • into_values_array -> allValues
      • NSMutableDictionary
        • clear -> removeAllObjects
      • NSMutableArray
        • clear -> removeAllObjects
      • NSMutableSet
        • clear -> removeAllObjects
      • NSError
        • user_info -> userInfo
        • localized_description -> localizedDescription
      • NSException
        • user_info -> userInfo
      • NSMutableData
        • from_data -> dataWithData
        • with_capacity -> dataWithCapacity
        • set_len -> setLength
      • NSUUID
        • new_v4 -> UUID
        • string -> UUIDString
      • NSThread
        • current -> currentThread
        • main -> mainThread
        • is_main -> isMainThread
      • NSProcessInfo
        • process_info -> processInfo
    • BREAKING: Make NSComparisonResult work like all other enums.
    • BREAKING: Changed NSDictionary to be Shared by default.
    • BREAKING (TEMPORARY): Renamed NSEnumerator, NSFastEnumeration and NSFastEnumerator until the story around them are properly figured out.
    • BREAKING: Make NSArray::objects_in_range return an Option (it was unsound before).

    Fixed

    • Fixed NSZone not specifying a #[repr(...)].
    Open source →
  8. 0.0.0 19 Sep 2022 withdrawn

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive