Skip to content

Commit

Permalink
#297: Share Extension 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph704 committed Aug 12, 2024
1 parent d932c53 commit 2c271ed
Show file tree
Hide file tree
Showing 5 changed files with 309 additions and 1 deletion.
18 changes: 18 additions & 0 deletions StreetDrop/ShareExtension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>TRUEPREDICATE</string>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
</dict>
</plist>
24 changes: 24 additions & 0 deletions StreetDrop/ShareExtension/View/Base.lproj/MainInterface.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="j1y-V4-xli">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Share View Controller-->
<scene sceneID="ceB-am-kn3">
<objects>
<viewController id="j1y-V4-xli" customClass="ShareViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" opaque="NO" contentMode="scaleToFill" id="wbc-yd-nQP">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="1Xd-am-t49"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
26 changes: 26 additions & 0 deletions StreetDrop/ShareExtension/View/ShareViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ShareViewController.swift
// ShareExtension
//
// Created by 차요셉 on 8/12/24.
//

import UIKit
import Social

final class ShareViewController: SLComposeServiceViewController {


override func isContentValid() -> Bool {
return true
}

override func didSelectPost() {
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
}

override func configurationItems() -> [Any]! {
return []
}

}
49 changes: 49 additions & 0 deletions StreetDrop/ShareExtension/ViewModel/ShareViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// ShareViewModel.swift
// ShareExtension
//
// Created by 차요셉 on 8/12/24.
//

import CoreLocation
import Foundation

import RxSwift
import RxRelay

protocol ShareViewModelType {
associatedtype Input
associatedtype Output

func convert(input: Input, disposedBag: DisposeBag) -> Output
}

final class ShareViewModel: NSObject, ShareViewModelType {
private let output: Output = .init()
private let locationManger: CLLocationManager = .init()

struct Input {
let viewDidLoadEvent: Observable<Void>
}

struct Output {

}

func convert(input: Input, disposedBag: DisposeBag) -> Output {
input.viewDidLoadEvent
.subscribe(with: self) { owner, _ in
owner.locationManger.delegate = self
owner.locationManger.requestWhenInUseAuthorization()
owner.locationManger.startUpdatingLocation()
}
.disposed(by: disposedBag)


return output
}
}

extension ShareViewModel: CLLocationManagerDelegate {

}
Loading

0 comments on commit 2c271ed

Please sign in to comment.