Git Product home page Git Product logo

abfrealmmapview's People

Contributors

bigfish24 avatar bjarkehs avatar phatblat avatar readmecritic avatar sbandol avatar srubin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abfrealmmapview's Issues

import error in objective-c version of ABFRealmMapView version 2.0

Hi,

In the installation guide it says "Starting with Xcode 7.1, there is an issue with CocoaPods 0.39 that caused the interop of the Objective-C code for ABFRealmMapView to fail on compile when used in RealmMapView. This problem has now been resolved as of v1.6.6. Please be sure to use this version or higher with Xcode 7.1."

But I still have the same issue in the latest version ABFRealmMapView (2.0) I use now.
@import RBQFetchedResultsController;
Build error: Module 'RBQFetchedResultsController' not found in ABFLocationFetchRequest.h

I use the latest cocoapod version 1.2.0
I added this line in my pod file:
pod 'ABFRealmMapView'

with pod install I see the following
Installing ABFRealmMapView (2.0)
Installing RBQFetchedResultsController (5.0.2)
Installing RBQSafeRealmObject (1.1)
Installing Realm (2.4.4)
Installing RealmUtilities (0.4)

How can I resolve the build error without adjusting the library itself? Because otherwise it will reoccur when updating the library later on. Thanks in advance!

regards,
Annelies

mapView.bounds being called from background thread.

UIView.bounds should be called from the main thread.


MKZoomScale MKZoomScaleForMapView(MKMapView *mapView)
{
    MKZoomScale currentZoomScale = mapView.bounds.size.width / mapView.visibleMapRect.size.width;
    
    return currentZoomScale;
}

Screen Shot 2019-08-04 at 11 03 59 PM

Stack trace:

PID: 29063, TID: 196647, Thread name: (none), Queue name: com.apple.root.user-initiated-qos, QoS: 25
Backtrace:
4   ABFRealmMapView                     0x000000010432a715 MKZoomScaleForMapView + 85
5   ABFRealmMapView                     0x0000000104332056 -[ABFRealmMapView refreshMapView] + 1766
6   ABFRealmMapView                     0x00000001043345b4 __46-[ABFRealmMapView registerChangeNotification:]_block_invoke_2.232 + 164
7   Realm                               0x0000000106fba0b1 _ZZ23RLMAddNotificationBlockIN5realm7ResultsEEP20RLMNotificationTokenP11objc_objectRT_U13block_pointerFvS5_P19RLMCollectionChangeP7NSErrorEbENKUlRKNS0_19CollectionChangeSetESt13exception_ptrE_clESG_SH_ + 705
8   Realm                               0x0000000106fb9c05 _ZN5realm24CollectionChangeCallback4ImplIZ23RLMAddNotificationBlockINS_7ResultsEEP20RLMNotificationTokenP11objc_objectRT_U13block_pointerFvS7_P19RLMCollectionChangeP7NSErrorEbEUlRKNS_19CollectionChangeSetESt13exception_ptrE_E5afterESI_ + 69
9   Realm                               0x0000000106e7358e _ZN5realm24CollectionChangeCallback5afterERKNS_19CollectionChangeSetE + 46
10  Realm                               0x0000000106e734e9 _ZZN5realm5_impl18CollectionNotifier13after_advanceEvENK3$_9clINSt3__111unique_lockINS4_5mutexEEENS1_8CallbackEEEDaRT_RT0_ + 169
11  Realm                               0x0000000106e5c896 _ZN5realm5_impl18CollectionNotifier17for_each_callbackIZNS1_13after_advanceEvE3$_9EEvOT_ + 166
12  Realm                               0x0000000106e5c7e9 _ZN5realm5_impl18CollectionNotifier13after_advanceEv + 25
13  Realm                               0x0000000106e5dd23 _ZN5realm5_impl15NotifierPackage13after_advanceEv + 147
14  Realm                               0x00000001072611a6 _ZN12_GLOBAL__N_126advance_with_notificationsIZN5realm5_impl11transaction7advanceERKNSt3__110unique_ptrINS1_11SharedGroupENS4_14default_deleteIS6_EEEEPNS1_14BindingContextERNS2_15NotifierPackageEE3$_1EEvSD_SB_OT_SF_ + 998
15  Realm                               0x0000000107260db9 _ZN5realm5_impl11transaction7advanceERKNSt3__110unique_ptrINS_11SharedGroupENS2_14default_deleteIS4_EEEEPNS_14BindingContextERNS0_15NotifierPackageE + 57
16  Realm                               0x0000000106f2274c _ZN5realm5_impl16RealmCoordinator16advance_to_readyERNS_5RealmE + 972
17  Realm                               0x00000001071a28ad _ZN5realm5Realm6notifyEv + 653
18  Realm                               0x00000001072897c0 _ZNK5realm5_impl17WeakRealmNotifier8CallbackclEv + 64
19  Realm                               0x000000010728c92c _ZZN5realm4util15EventLoopSignalINS_5_impl17WeakRealmNotifier8CallbackEEC1EOS4_ENKUlPvE_clES7_ + 28
20  Realm                               0x000000010728c905 _ZZN5realm4util15EventLoopSignalINS_5_impl17WeakRealmNotifier8CallbackEEC1EOS4_ENUlPvE_8__invokeES7_ + 21
21  CoreFoundation                      0x000000010a5ecdb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22  CoreFoundation                      0x000000010a5ec633 __CFRunLoopDoSources0 + 243
23  CoreFoundation                      0x000000010a5e6cef __CFRunLoopRun + 1231
24  CoreFoundation                      0x000000010a5e64d2 CFRunLoopRunSpecific + 626
25  CoreFoundation                      0x000000010a5e7458 CFRunLoopRun + 88
26  ABFRealmMapView                     0x0000000104333f51 __46-[ABFRealmMapView registerChangeNotification:]_block_invoke + 193
27  libdispatch.dylib                   0x000000010b3cfd7f _dispatch_call_block_and_release + 12
28  libdispatch.dylib                   0x000000010b3d0db5 _dispatch_client_callout + 8
29  libdispatch.dylib                   0x000000010b3e1806 _dispatch_root_queue_drain + 819
30  libdispatch.dylib                   0x000000010b3e1fca _dispatch_worker_thread2 + 130
31  libsystem_pthread.dylib             0x000000010b7b96b3 _pthread_wqthread + 583
32  libsystem_pthread.dylib             0x000000010b7b93fd start_wqthread + 13

Add a tutorial to get items

Hi Adam!
What do you think about to add a tutorial to get the itens inside de clustered item? I need do it on my application, but I don`t know how to do it :(

Can't reach unique pins

Consider that I am having the following code:

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        if let annotationABF = annotation as? ABFAnnotation {
            if annotationABF.type == .unique {
            ......
            //more code

I am trying to get to the unique pins, but it seems like the I can never reach inside the if annotationABF.type == .unique. Quite strange because annotationABF.type of all the objects on the map seems to return .cluster.

A workaround that I found was having:

if annotationABF.safeObjects.count == 1 {
  guard let object = annotationABF.safeObjects.first?.rlmObject() as? MyObject else {
                    return nil
    }
}

So Any ideas of why am I not getting to the unique pins using annotationABF.type == .unique ?

mapview: regionDidChangeAnimated: to get current visible data (question)

Hi, I want to get the currently visible data (annotations) on the map always when users drags/zooms the map using the delegate method:

- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    DLog(@"regionDidChangeAnimated %lu",
         (unsigned long)[((ABFRealmMapView*)mapView).fetchResultsController.safeObjects count],
}

It works well except the results count is one step backwards. Like the count of visible annotations before I have swiped or zoomed the map. (Probably because before is this method called on delegate, it is called internally and it calls refreshMapView which is probably async - otherwise I don't know why the count should be back one step)

I noticed there is also this delegate method:

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
    DLog(@"didAddAnnotationViews %lu", (unsigned long)[((ABFRealmMapView*)mapView).fetchResultsController.safeObjects count]);
}

This seemed to return correct number of annotations. But I have noticed this is also not solution, because if there is for example on the map 10 annotations, 2 on the right side, and I drag the map to the left side (8 annotations will become hidden, 2 will remain, nothing will be added) then the method above will not be called, because 10 annotations has been already added before the drag.

So the only solution at moment I have is async delayed call like this: (which returns correct number of results)

- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        DLog(@"regionDidChangeAnimatedAfter %lu",
             (unsigned long)[((ABFRealmMapView*)mapView).fetchResultsController.safeObjects count])
                 });
}

Or do you have any other solution how to get the list of visible items on the map after user drags/zooms the map?

Drawback of my solution is, that 1 second is quite long for update, but if I use shorter delay and there is lot of data, it can be too soon.

Thx

Otherwise your code is great and I am happy that it is so easy to withdraw even the Realm data when user drags/zooms the map. (Because the data source for my table displayed below the map also uses Realm objects, so the table can easily cooperate with the map)

Method didAddAnnotationViews crashing

Hi.

After some logs of Bugsnag. I noticed that some devices crash on this method.

Frameworks/RealmMapView.framework/RealmMapView:0TTSf4g_g_n___TFC12RealmMapView12RealmMapView7mapViewfS0_FTCSo9MKMapView21didAddAnnotationViewsGSaCSo16MKAnnotationView__T_

The full log:

EXC_BREAKPOINT
UmadApp mh_execute_header
unknown _mh_execute_header
UmadApp mh_execute_header
Frameworks/UIKit.framework/UIKit -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
Frameworks/UIKit.framework/UIKit -[UITableView _createPreparedCellForGlobalRow:willDisplay:]
Frameworks/UIKit.framework/UIKit -[UITableView _updateVisibleCellsNow:isRecursive:]
Frameworks/UIKit.framework/UIKit -[UITableView _performWithCachedTraitCollection:]
Frameworks/UIKit.framework/UIKit -[UITableView layoutSubviews]
Frameworks/UIKit.framework/UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
Frameworks/QuartzCore.framework/QuartzCore -[CALayer layoutSublayers]
Frameworks/QuartzCore.framework/QuartzCore _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE
Frameworks/UIKit.framework/UIKit -[UIView(Hierarchy) layoutBelowIfNeeded]
UmadApp mh_execute_header
Frameworks/UIKit.framework/UIKit +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:]
Frameworks/UIKit.framework/UIKit +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:]
UmadApp mh_execute_header
UmadApp mh_execute_header
UmadApp mh_execute_header
UmadApp mh_execute_header
Frameworks/RealmMapView.framework/RealmMapView TTSf4g_g_n___TFC12RealmMapView12RealmMapView7mapViewfS0_FTCSo9MKMapView21didAddAnnotationViewsGSaCSo16MKAnnotationView__T_
Frameworks/MapKit.framework/MapKit -[MKMapView annotationManager:didSelectAnnotationRepresentation:]
Frameworks/MapKit.framework/MapKit -[MKAnnotationManager selectAnnotation:animated:avoid:]
Frameworks/MapKit.framework/MapKit -[MKMapView _handleSelectionAtPoint:]
Frameworks/MapKit.framework/MapKit -[MKMapView _handleTapToSelect:]
Frameworks/UIKit.framework/UIKit _UIGestureRecognizerSendTargetActions
Frameworks/UIKit.framework/UIKit _UIGestureRecognizerSendActions
Frameworks/UIKit.framework/UIKit -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
Frameworks/UIKit.framework/UIKit ___UIGestureRecognizerUpdate_block_invoke904
Frameworks/UIKit.framework/UIKit _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
Frameworks/UIKit.framework/UIKit _UIGestureRecognizerUpdate
Frameworks/CoreFoundation.framework/CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
Frameworks/CoreFoundation.framework/CoreFoundation __CFRunLoopDoObservers
Frameworks/CoreFoundation.framework/CoreFoundation __CFRunLoopRun
Frameworks/CoreFoundation.framework/CoreFoundation CFRunLoopRunSpecific
Frameworks/CoreFoundation.framework/CoreFoundation CFRunLoopRunInMode
PrivateFrameworks/GraphicsServices.framework/GraphicsServices GSEventRunModal
Frameworks/UIKit.framework/UIKit UIApplicationMain
UmadApp mh_execute_header

The device:

device_erro

Thanks!

v2.0 not available in CocoaPods

RealmMapView v2.0 not available in cocoapods.

[!] Unable to satisfy the following requirements:

- `ABFRealmMapView (>= 2.0)` required by `RealmMapView (2.0)`

None of your spec sources contain a spec satisfying the dependency: `ABFRealmMapView (>= 2.0)`.

Cluster's annotation count is not always right

Hi guys.

I was testing the framework and I've found a problem with the count label not being always right.

For example, I have this cluster saying it has one annotation, but if I press it the callout says it has two:
screen shot 2017-03-15 at 23 13 53

And if I zoom in, there are 2 pins there, confirming what is shown in the callout above:
screen shot 2017-03-15 at 23 25 33

Maybe a problem when reusing annotations @bigfish24 ? Can you help me on that?

exc_bad_access(code=1)

Hi,

I'm trying to create a simple example using core location and
RealmMapView but I keep getting the error mentioned in the title.

The issue comes from this line in ABFLocationFetchedResultsController.m:

ABFLocationSafeRealmObject *safeObject = [self safeObjectFromObject:object];
    safeObject->_coordinate = coordinate;
    safeObject->_title = title ? title : @"";
    safeObject->_subtitle = subtitle ? subtitle : @"";

The problem is that [self safeObjectFromObject:object] is returning nil.

object seems to be correct:

(lldb) po object
Location {
    latitude = 37.33156519;
    longitude = -122.03057969;
    title = point;
    subtitle = subtitle;
}

(lldb) po coordinate
 (latitude = 37.331565189999999, longitude = -122.03057969)

I'm using Swift 2.1, ABFRealmMapView (1.7.3) and Realm (0.97.0). I
have an model in the DB called location which I update every time
there is a location update event. I wonder if is a problem on my end
(maybe I'm missing a config value) or if is something in the lib.

I put an example in the following Github repo https://github.com/abuiles/_____RealmMapView

Thanks!

Unable to build framework using Carthage

Cartfile: github "bigfish24/ABFRealmMapView"

When I run

carthage update ABFRealmMapView --platform iOS --configuration Debug --no-use-binaries

I get this:

*** Checking out ABFRealmMapView at "v2.0"
*** xcodebuild output can be found in /var/folders/d6/ztmyx0jx7mx452wllmk0fhz00000gn/T/carthage-xcodebuild.AtqE6e.log
*** Building scheme "Realm" in Realm.xcworkspace
*** Skipped building ABFRealmMapView due to the error:
Dependency "ABFRealmMapView" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at Optional("https://github.com/bigfish24/ABFRealmMapView/issues/new")

Crash when interrupt internet connection

Hi Realm team.
While I`m testing my app, I noticed that RealmMapView(1.4.1) has a problem to handle the interruption of internet connection. The app crashes because an error (@RealmMapView.swift, line 270) of the loading map happen. (The problem happen with my sample app too, Fun-With-Swift).

captura de tela 2015-12-02 as 09 45 38

Test it if you can. Start the app, wait the map to load and disable your internet connection, drag the map and bang! This problem happen with the emulator. But I don't think it is a problem with the emulator/device.

Swift 2
Xcode 7.0.1
CocoaPod 0.39.0

Setting basePredicate Not Having Any Effect

Hey there,

I'm setting the base predicate and calling refreshMapView in an attempt to change the filtering used on the map based on some user interaction. The map view annotations disappear but all reappear without any filtering from the base predicate appearing to take place. This also happens if setting the basePredicate on viewDidLoad.

let allAnnotations = self.mapView.annotations self.mapView.removeAnnotations(allAnnotations) mapView.basePredicate = NSPredicate(format: "locationType == %@", state.get(string: "locationType")) mapView.refreshMapView()

It appears the condition to unwrap the base predicate along with the fetchRequest predicate never fulfills.

screen shot 2017-04-01 at 10 59 34 pm

screen shot 2017-04-01 at 10 59 52 pm

Any advice? Also on a related note - if I update the basePredicate is the expected behavior that all annotations that don't match the predicate shall be removed from the map automatically or am I correct to assume I'd need to remove annotations from the map before refreshing?

Possible to make it asynchronously?

First, thank you very much for sharing this cool realm.io add-on with us.
What I recently recognized is that fetching the data and creating the clustered images on the map is pretty slow and you can't move the map while it is working.
It seems the process of adding things to the map is not dispatched. This makes it a bit unhandy and laggy. Is this right? Or is it just something I got?

Loading more annotations degrades map responivenes

I tried loading around 4k annotations and it clustered but if user continuously play with map then it hangs at a point and crashes at times. Anyone faces the same issue? Any comments or suggestions are welcome.

Error

Whenever I try to build this Xcode gives me this error:

"Overiding method with selector shouldPerformSegueWithIdentifier has incompatible type"

Thanks

No podspec found

Anyone else seeing this?

$ pod install
Analyzing dependencies
Fetching podspec for SwiftFetchedResultsController from ../../RBQFetchedResultsController
[!] No podspec found for SwiftFetchedResultsController in ../../RBQFetchedResultsController

Crash when using latitude and longitude in property

My coordinates are stored not stored directly in my Object, but in an property of type Coordinates, which has a latitude and longitude variable of type string.

final class Coordinates: Object, Decodable { dynamic var longitude: String = "" dynamic var latitude: String = "" }

I thought it should be possible to access them by using "coordinates.longitude" and "coordinates.latitude" as latitudeKeyPath and longitudeKeyPath.

However the app crashes with this:
Terminating app due to uncaught exception 'Invalid value', reason: 'Expected object of type string for property 'coordinates.latitude' on object of type 'XXX', but received: 91.17809'

91.17809 is by the way no available coordinate and even no available value in the Realm.

Is my approach possible at all? Thanks for any help!

CocoaPods spec doesn't validate

Using CocoaPods 1.1.1 and Xcode 8.1 the podspec fails to validate due to a "include of non-modular header inside framework module" error.

Validating spec
 -> ABFRealmMapView (1.8)
    - WARN  | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - WARN  | xcodebuild:  Realm/Realm/ObjectStore/src/sync_session.cpp:293:17: warning: enumeration values 'invalid_error' and 'disabled_session' not handled in switch [-Wswitch]
    - ERROR | xcodebuild:  /Users/admin/Library/Developer/Xcode/DerivedData/App-dleskvpyfcpmljeszyycxycdeqls/Build/Products/Release-iphonesimulator/ABFRealmMapView/ABFRealmMapView.framework/Headers/ABFLocationFetchRequest.h:14:9: error: include of non-modular header inside framework module 'ABFRealmMapView.ABFLocationFetchRequest' [-Werror,-Wnon-modular-include-in-framework-module]
    - ERROR | xcodebuild:  /Users/admin/Library/Developer/Xcode/DerivedData/App-dleskvpyfcpmljeszyycxycdeqls/Build/Products/Release-iphonesimulator/ABFRealmMapView/ABFRealmMapView.framework/Headers/ABFLocationFetchedResultsController.h:17:9: error: include of non-modular header inside framework module 'ABFRealmMapView.ABFLocationFetchedResultsController' [-Werror,-Wnon-modular-include-in-framework-module]
    - NOTE  | [iOS] xcodebuild:  /var/folders/rj/b3q1yrj102s6d7m3bcfv0_hw0000gn/T/CocoaPods/Lint/App/main.m:3:9: fatal error: could not build module 'ABFRealmMapView'

[!] The `ABFRealmMapView.podspec.json` specification does not validate.

Documentation and sample code

Documentation and sample code are very short and I think it should be filled with a description of how to customize everything.
Having a very simple sample code is nice but when we need to push a little further it is hard to find the way to do it.

Pod always installing

I use pod install

pod 'ABFRealmMapView'
pod 'RealmSFRestaurantData'

after long time

Analyzing dependencies
Downloading dependencies
Installing ABFRealmMapView (1.8)
Installing RBQFetchedResultsController (4.0.4)
Installing Realm (1.0.2)

[!] /bin/bash -c 
set -e
sh build.sh cocoapods-setup

core is not a symlink. Deleting...
Downloading dependency: core 1.3.1
Downloading core failed:
curl: (56) SSLRead() return error -9806

toObject in viewFor annotation

I'm trying to get an object from an ABFAnnottation, in the previous version I could get this object, but after the update I can not anymore.

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        
        if (annotation is MKUserLocation) {
            //if annotation is not an MKPointAnnotation (eg. MKUserLocation),
            //return nil so map draws default view for it (eg. blue dot)...
            return nil
        }
       
        if let annotationABF = annotation as? ABFAnnotation {
            if annotationABF.type == .unique {
                if let element = annotationABF.safeObjects.first {

                    let object = element.toObject(MyObject.self)

                    // my custom pin configurations

                    return pinView
                } else {
                    return nil
                }
                
            } else {

                let view = ABFClusterAnnotationView(annotation: annotationABF, reuseIdentifier: "cluster")
                view.color = UIColor(red:0.093, green:0.741, blue:0.335, alpha:1)
                view.count = UInt(annotationABF.safeObjects.count)
                view.canShowCallout = true
                
                return view
                
            }
        }
        return nil
    }

Whenever it will do the toObject it hangs at this point

extension ABFLocationSafeRealmObject {
    public func toObject<T>(_ type: T.Type) -> T {
        return unsafeBitCast(self.rlmObject(), to: T.self)
    }
}

fatal error: can't unsafeBitCast between types of different sizes

'Realm.Configuration' has no member path

Goals

using RealmMapView

Actual Results

Pods/RealmMapView/RealmMapView/RealmMapView.swift:282:13: Value of type 'Realm.Configuration' has no member 'path'

Steps to Reproduce

  • Add following lines to podfile
pod 'RealmMapView'
# Map data set
pod 'RealmSwiftSFRestaurantData'
  • Build

Version of Realm and Tooling

ProductName: Mac OS X
ProductVersion: 10.11.5
BuildVersion: 15F34

/Applications/Xcode.app/Contents/Developer
Xcode 7.3.1
Build version 7D1014

/Users/Air/.rvm/gems/ruby-2.1.1/bin/pod
1.0.0
Realm (0.103.1)
RealmSwift (0.103.1)

Does not compile on Swift 4

All closures that take no arguments fail to compile when written as:

BlockOperation { _ in // should remove the _ because this takes no args
    ....
}

Realm RealmMapView.toObject โ€” unsafeBitCast returns error โ€” swift 3.0.2

I've been trying the Building an iOS Clustered Map View for Swift, and every time I get the following error from the code below:
fatal error: can't unsafeBitCast between types of different sizes

The error is being thrown in RealmMapView.toObject(), invoked as shown (copy/paste from the web page, with the addition of ".self" to get rid of a warning):

extension ViewController: MKMapViewDelegate {
  func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) {
    if let safeObjects = ABFClusterAnnotationView.safeObjectsForClusterAnnotationView(view) {
      if let firstObjectName = safeObjects.first?.toObject(ABFRestaurantObject.self).name {
        print("First Object: \(firstObjectName)")
      }
    }
  }
}

I've never managed to get around this error. It seems like the framework is trying to convert an annotation to an ABFRestaurantObject, but maybe I'm confused. Is there a workaround for this, or am I just missing something?

The Podfile just references RealmMapView and RealmSwiftSFRestaurantData.

Here is the effect of a pod install:

Using ABFRealmMapView (2.0)
Using RBQFetchedResultsController (5.0.2)
Using RBQSafeRealmObject (1.1)
Using Realm (2.4.4)
Using RealmMapView (2.0)
Using RealmSwift (2.4.4)
Using RealmSwiftSFRestaurantData (0.5)
Using RealmUtilities (0.4)
Using SafeRealmObject (1.1)
Using SwiftFetchedResultsController (5.0.2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.